Skip to content

Migrate Jenkins workflow to Github Actions #487

Migrate Jenkins workflow to Github Actions

Migrate Jenkins workflow to Github Actions #487

Workflow file for this run

name: ReSDK CI
on:
push:
branches:
- master
tags:
- "[0-9]+.[0-9]+.[0-9]+*"
pull_request:
workflow_dispatch:
jobs:
unittest:
runs-on: arc-runner
env:
TOX_COMMAND: "tox --skip-missing-interpreters false"
strategy:
fail-fast: false
matrix:
toxenv: [py38, py39, py310, py311, py312, docs, linters, package]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Assert PR is up-to-date
if: github.event_name == 'pull_request'
run: |
git fetch origin ${{ github.base_ref }}
git_change_target_merge_base=$(git merge-base HEAD origin/${{ github.base_ref }})
git_change_target_sha=$(git rev-parse origin/${{ github.base_ref }})
if [[ "${git_change_target_merge_base}" != "${git_change_target_sha}" ]]; then
echo 'Pull request is not up-to-date!'
echo "Please, rebase your pull request on top of '${{ github.base_ref }}' (commit: ${git_change_target_sha})."
exit 1
fi
- name: Run Tests
run: >
${{ env.TOX_COMMAND }} -e ${{ matrix.toxenv }}
e2e:
runs-on: arc-runner
needs: unittest
env:
GENESIS_POSTGRESQL_NAME: resolwe-genialis
GENESIS_POSTGRESQL_USER: genialis-base
GENESIS_POSTGRESQL_PORT: 55434
GENESIS_REDIS_PORT: 56381
GENESIS_RESDK_PATH: ".."
GENESIS_REST_THROTTLING: '{"login": "100000/hour", "credentials": "100000/hour", "email": "100000/hour"}'
services:
postgres:
image: public.ecr.aws/docker/library/postgres:14
env:
POSTGRES_USER: genialis-base
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 55434:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: public.ecr.aws/docker/library/redis:7-alpine
ports:
- 56381:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout resolwe-bio-py
uses: actions/checkout@v4
- name: Checkout genialis-base
uses: actions/checkout@v4
with:
repository: genialis/genialis-base
path: genialis-base
ssh-key: ${{ secrets.GHA_SSH_PRIVATE_KEY_GENIALIS_DEPLOY }}
- name: Run tests
run: |
cd genialis-base
# Prepare frontend configuration
mkdir -p frontend/genjs/schema
echo '{}' > frontend/genjs/schema/configuration.json
# Make sure `python` refers to the tox environment's Python
export PATH=`pwd`/.tox/py310-e2e-resdk/bin:$PATH
tox --skip-missing-interpreters false -e py310-e2e-resdk
build:
runs-on: arc-runner
needs: [unittest, e2e]
if: startsWith(github.ref, 'refs/tags')
env:
PYTHON: "python3.12"
steps:
- uses: actions/checkout@v4
- name: Install build
run: ${{ env.PYTHON }} -m pip install --user build
- name: Build a binary wheel and a source tarball
run: ${{ env.PYTHON }} -m build --sdist --wheel --outdir dist/ .
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
file: .coverage
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1.8
with:
password: ${{ secrets.pypi_password }}