Merge pull request #371 from nanotaboada/feature/compose #1012
This file contains hidden or 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
| # Building and testing Python | |
| # https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | |
| name: Python CI | |
| permissions: | |
| contents: read | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| env: | |
| PYTHON_VERSION: 3.13.3 | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/[email protected] | |
| - name: Lint commit messages | |
| uses: wagoid/[email protected] | |
| - name: Set up Python ${{ env.PYTHON_VERSION }} | |
| uses: actions/[email protected] | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements-lint.txt | |
| - name: Lint with Flake8 | |
| run: | | |
| flake8 . | |
| test: | |
| needs: lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/[email protected] | |
| - name: Set up Python ${{ env.PYTHON_VERSION }} | |
| uses: actions/[email protected] | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements-test.txt | |
| - name: Run tests with pytest | |
| run: | | |
| pytest -v | |
| - name: Generate coverage report | |
| run: | | |
| pytest --cov=./ --cov-report=xml --cov-report=term | |
| - name: Upload coverage report artifact | |
| uses: actions/[email protected] | |
| with: | |
| name: coverage.xml | |
| path: ./coverage.xml | |
| coverage: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| service: [codecov, codacy] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/[email protected] | |
| - name: Download coverage report artifact | |
| uses: actions/[email protected] | |
| with: | |
| name: coverage.xml | |
| - name: Upload coverage report to ${{ matrix.service }} | |
| if: ${{ matrix.service == 'codecov' }} | |
| uses: codecov/[email protected] | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: coverage.xml | |
| - name: Upload coverage report to ${{ matrix.service }} | |
| if: ${{ matrix.service == 'codacy' }} | |
| uses: codacy/[email protected] | |
| with: | |
| project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
| coverage-reports: coverage.xml | |
| container: | |
| needs: coverage | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/[email protected] | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/[email protected] | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/[email protected] | |
| - name: Build and push Docker image to GitHub Container Registry | |
| uses: docker/[email protected] | |
| with: | |
| context: . | |
| push: true | |
| platforms: linux/amd64 | |
| provenance: false | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| tags: | | |
| ghcr.io/${{ github.repository }}:latest | |
| ghcr.io/${{ github.repository }}:sha-${{ github.sha }} |