Fix/webhook dynamisation #18
Workflow file for this run
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
| name: Python Poetry Application | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| pull_request: | |
| branches: ["main"] | |
| permissions: | |
| contents: write | |
| pull-requests: write # Needed for commenting on PRs | |
| env: | |
| PYTHON_VERSION: "3.13" | |
| POETRY_VERSION: "2.2.0" | |
| jobs: | |
| test: | |
| name: Run Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Cache Poetry | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.local | |
| key: poetry-${{ github.runner.os }}-${{ env.POETRY_VERSION }} | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1 | |
| with: | |
| version: ${{ env.POETRY_VERSION }} | |
| virtualenvs-create: true | |
| virtualenvs-in-project: true | |
| - name: Cache Dependencies | |
| id: cache-deps | |
| uses: actions/cache@v4 | |
| with: | |
| path: .venv | |
| key: deps-${{ github.runner.os }}-${{ hashFiles('**/poetry.lock') }} | |
| - name: Install Dependencies | |
| run: poetry install --no-interaction | |
| if: steps.cache-deps.outputs.cache-hit != 'true' | |
| - name: Run Pre-commit Checks | |
| run: poetry run pre-commit run --all-files | |
| - name: Prepare config file | |
| run: cp runners_config.yaml.dist runners_config.yaml | |
| - name: Run Tests with Coverage | |
| run: poetry run pytest --cov=src --cov-report=xml --cov-report=term | |
| - name: Comment Coverage on PR | |
| if: ${{ github.event_name == 'pull_request' }} | |
| uses: MishaKav/pytest-coverage-comment@main | |
| with: | |
| pytest-xml-coverage-path: ./coverage.xml | |
| - name: Upload Coverage to Codecov | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| release: | |
| name: Build & Release | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Cache Poetry | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.local | |
| key: poetry-${{ github.runner.os }}-${{ env.POETRY_VERSION }} | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1 | |
| with: | |
| version: ${{ env.POETRY_VERSION }} | |
| virtualenvs-create: true | |
| virtualenvs-in-project: true | |
| - name: Cache Dependencies | |
| id: cache-deps | |
| uses: actions/cache@v4 | |
| with: | |
| path: .venv | |
| key: deps-${{ github.runner.os }}-${{ hashFiles('**/poetry.lock') }} | |
| - name: Install Dependencies | |
| run: poetry install --no-dev --no-interaction | |
| if: steps.cache-deps.outputs.cache-hit != 'true' | |
| - name: Extract version from Git tag and set in pyproject.toml | |
| run: | | |
| VERSION=${GITHUB_REF#refs/tags/v} | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| poetry version $VERSION | |
| - name: Build Distribution | |
| run: poetry build | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ env.VERSION }} | |
| files: | | |
| dist/*.whl | |
| dist/*.tar.gz | |
| - name: Docker Login | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Build Docker Image | |
| run: > | |
| docker build | |
| --build-arg APP_VERSION=${{ env.VERSION }} | |
| -t glefer/github-runner-manager:${{ env.VERSION }} | |
| -t glefer/github-runner-manager:latest . | |
| - name: Push Docker Image | |
| run: | | |
| docker push glefer/github-runner-manager:${{ env.VERSION }} | |
| docker push glefer/github-runner-manager:latest |