Merge pull request #33 from c3g/dev #203
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: Tests suite | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
branches: ['main', 'dev'] | |
push: | |
tags: '[0-9]+.[0-9]+.[0-9]+' | |
branches: ['main', 'dev'] | |
env: | |
REGISTRY_USER: c3genomics+github_pusher | |
IMAGE_REGISTRY: quay.io | |
REGISTRY_PASSWORD: ${{ secrets.QUAY_ROBOT_TOKEN }} | |
IMAGE: c3genomics/project_tracking | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
python-version: ["3.11"] | |
os: [ubuntu-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install .[tests] flake8 | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is | |
# 127 chars wide | |
flake8 . --count --exit-zero --max-complexity=10 \ | |
--max-line-length=127 --statistics | |
- name: Test with pytest | |
run: | | |
pytest -v | |
build: | |
needs: test | |
if: startsWith(github.ref, 'refs/tags') | |
name: Build image | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: set tag | |
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: Buildah Action | |
uses: redhat-actions/buildah-build@v2 | |
with: | |
image: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE }} | |
tags: ${{ env.RELEASE_VERSION }} | |
containerfiles: ./Containerfile | |
- name: Push to repo | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
username: ${{ env.REGISTRY_USER }} | |
password: ${{ env.REGISTRY_PASSWORD }} | |
registry: ${{ env.IMAGE_REGISTRY }} | |
image: ${{ env.IMAGE }} | |
tags: ${{ env.RELEASE_VERSION }} | |
- name: Print image url | |
run: echo "Image pushed to ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE }}:${{ env.RELEASE_VERSION }}" | |