[Experimental] Replace Travis with Github Actions #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python application test | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_ROOT_PASSWORD: root | |
MYSQL_DATABASE: runner_ensembl_metadata | |
MYSQL_USER: testuser | |
MYSQL_PASSWORD: password | |
ports: | |
- 3306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5 | |
strategy: | |
matrix: | |
python-version: [3.8, 3.9] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
pip install -r requirements.txt | |
pip install -r requirements-test.txt | |
pip install . | |
- name: Set PYTHONPATH | |
run: echo "PYTHONPATH=$PYTHONPATH:$GITHUB_WORKSPACE/src" >> $GITHUB_ENV | |
- name: Start MySQL | |
run: | | |
while ! mysqladmin ping -h"127.0.0.1" --silent; do | |
sleep 1 | |
done | |
- name: Show DB_HOST ENV | |
run: echo "DB_HOST ENV ${{ job.services.mysql.ports[3306] }}" | |
- name: Run tests | |
env: | |
DB_HOST: 127.0.0.1 | |
run: | | |
coverage run -m pytest --server mysql://testuser:[email protected]:3306 |