Switching CI to GitHub actions #255
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: CI & Release | |
| # Requires secrets: | |
| # DOCKERHUB_USERNAME, DOCKERHUB_PASSWORD -- optional (for seamless pulls) | |
| # GITHUB_TOKEN -- implicitly injected | |
| # POETRY_PYPI_TOKEN_PYPI -- Pypi token, required for release | |
| # POETRY_PYPI_TOKEN_TESTPYPI -- testpypi token, for CI debugging | |
| on: | |
| # NOTE: Release job includes extra guardrails (see job condition below) | |
| # Without them, only linting and testing run | |
| pull_request: | |
| push: | |
| branches: | |
| - "master" | |
| - "ci/**" # CI debugging branches | |
| #- "v*.*" # optional: support for independent major release branches (e.g., 2.x, 3.x) | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: ./.github/actions/setup | |
| - name: Lint | |
| id: lint | |
| run: tox -e lint | |
| continue-on-error: true | |
| - name: Emit warning if lint failed | |
| if: ${{ steps.lint.outcome != 'success' }} | |
| run: echo "::warning::Linter failure suppressed (continue-on-error=true)" | |
| test: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ ubuntu-latest ] | |
| python: | |
| - "3.12" | |
| - "3.11" | |
| - "3.10" | |
| - "3.9.14" | |
| - "3.8" | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: ./.github/actions/setup | |
| with: | |
| python: ${{ matrix.python }} | |
| - name: Test | |
| run: tox | |
| smoketest: | |
| runs-on: ubuntu-latest | |
| needs: [ 'lint','test' ] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: dockerhub login (for seamless docker pulling) | |
| uses: ./.github/actions/dockerhub-login | |
| env: | |
| DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} | |
| DOCKERHUB_USERNAME: ${{ vars.DOCKERHUB_USERNAME }} | |
| continue-on-error: true | |
| - id: setup | |
| uses: ./.github/actions/setup | |
| - run: poetry build | |
| - run: ci/run_tests.sh | |
| env: | |
| SMOKETEST_DOCKER_IMAGE: python:${{ steps.setup.outputs.python-version }} | |
| release: | |
| # NOTE: release is allowed only on selected branches | |
| # NOTE: publishing target (prod or testpypi) is derived as PYPI_PUBLISH_REPO below | |
| # full example: | |
| # if: ( github.ref_name == 'master' || startsWith(github.ref_name, 'ci/') || startsWith(github.ref_name,'v') ) | |
| if: github.ref_name == 'master' | |
| needs: ['smoketest','lint','test'] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: ./.github/actions/setup-semantic-release # node+semantic-release | |
| - uses: ./.github/actions/setup # poetry | |
| - name: configure poetry repos | |
| run: | | |
| poetry config repositories.pypi https://upload.pypi.org/legacy/ | |
| poetry config repositories.testpypi https://test.pypi.org/legacy/ | |
| - run: semantic-release --branches ${{ github.ref_name }} | |
| env: | |
| GIT_AUTHOR_NAME: appland-release | |
| GIT_AUTHOR_EMAIL: release@app.land | |
| GIT_COMMITTER_NAME: appland-release | |
| GIT_COMMITTER_EMAIL: release@app.land | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| POETRY_PYPI_TOKEN_PYPI: ${{ secrets.POETRY_PYPI_TOKEN_PYPI }} | |
| POETRY_PYPI_TOKEN_TESTPYPI: ${{ secrets.POETRY_PYPI_TOKEN_TESTPYPI }} | |
| PYPI_PUBLISH_REPO: ${{ github.ref == 'refs/heads/master' && 'pypi' || 'testpypi' }} |