[GEN-703] Validation status with version #829
Workflow file for this run
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
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: build | |
on: | |
push: | |
branches: [main, develop, 'GEN*', 'gen*'] | |
pull_request: | |
release: | |
types: | |
- created | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.8, 3.9] | |
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: | | |
sudo apt-get install -y bedtools | |
python -m pip install --upgrade pip | |
pip install flake8 pytest pytest-cov cython | |
pip install . | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
# - 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 tests/ --cov=genie --cov=genie_registry --cov-report=html | |
- name: Upload pytest test results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pytest-results-${{ matrix.python-version }} | |
path: htmlcov | |
# Use always() to always run this step to publish test results when there are test failures | |
if: ${{ always() }} | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: psf/black@stable | |
with: | |
version: "~=23.12" | |
deploy: | |
needs: [test, lint] | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools wheel build | |
- name: Build distributions | |
run: python -m build | |
- name: Publish to pypi | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
build-container: | |
needs: [test, lint] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Docker buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log into registry ${{ env.REGISTRY }} | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Format tags as registry refs | |
id: registry_refs | |
env: | |
TAGS: ${{ steps.meta.outputs.json }} | |
run: | | |
echo tags=$(echo $TAGS | jq '.tags[] | "type=registry,ref=" + . + "_cache"| @text') >> $GITHUB_OUTPUT | |
- name: Build and push Docker image | |
id: build-and-push | |
uses: docker/build-push-action@v5 | |
if: github.event_name != 'pull_request' | |
with: | |
context: . | |
push: true | |
provenance: false | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: ${{ steps.registry_refs.outputs.tags }},mode=max | |
cache-to: ${{ steps.registry_refs.outputs.tags }},mode=max |