Resolwe CI #2804
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: Resolwe CI | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- "[0-9]+.[0-9]+.[0-9]+*" | |
pull_request: | |
schedule: | |
- cron: "30 2 * * *" | |
jobs: | |
test: | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
tox-env: [py311, py310, linters, packaging, migrations] | |
include: | |
- tox-env: py311 | |
python-version: "3.11" | |
- tox-env: py310 | |
python-version: "3.10" | |
- tox-env: linters | |
python-version: "3.11" | |
- tox-env: packaging | |
python-version: "3.11" | |
- tox-env: migrations | |
python-version: "3.11" | |
services: | |
postgres: | |
image: postgres:14-alpine | |
env: | |
POSTGRES_USER: resolwe | |
POSTGRES_DB: resolwe | |
POSTGRES_PASSWORD: resolwe | |
ports: | |
- 5432/tcp | |
redis: | |
image: redis:alpine | |
ports: | |
- 6379/tcp | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install tox~=4.4.11 | |
- name: Build communication container | |
working-directory: ./resolwe/flow/docker_images | |
run: docker build -f Dockerfile.communication -t resolwe/com:testing ../../ | |
- name: Run Tests | |
run: > | |
RESOLWE_COMMUNICATOR_IMAGE=resolwe/com:testing | |
tox -e ${{ matrix.tox-env }} | |
--skip-missing-interpreters false | |
--recreate | |
env: | |
RESOLWE_REDIS_PORT: ${{ job.services.redis.ports[6379] }} | |
RESOLWE_POSTGRESQL_HOST: localhost | |
RESOLWE_POSTGRESQL_NAME: resolwe | |
RESOLWE_POSTGRESQL_USER: resolwe | |
RESOLWE_POSTGRESQL_PASS: resolwe | |
RESOLWE_POSTGRESQL_PORT: ${{ job.services.postgres.ports[5432] }} | |
- name: Upload coverage to Codecov | |
if: matrix.tox-env == 'py36' || matrix.tox-env == 'py37' || matrix.tox-env == 'py38' || matrix.tox-env == 'py39' || matrix.tox-env == 'py310' | |
uses: codecov/codecov-action@v3 | |
with: | |
file: .coverage | |
build: | |
runs-on: ubuntu-22.04 | |
needs: test | |
if: "startsWith(github.ref, 'refs/tags')" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install build | |
run: python -m pip install --user build | |
- name: Build a binary wheel and a source tarball | |
run: python -m build --sdist --wheel --outdir dist/ . | |
- name: Publish distribution to PyPI | |
uses: pypa/gh-action-pypi-publish@master | |
with: | |
password: ${{ secrets.pypi_password }} |