CI #80
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
| # see https://github.com/karlicoss/pymplate for up-to-date reference | |
| name: CI | |
| on: | |
| push: | |
| branches: '*' | |
| tags: 'v[0-9]+.*' # only trigger on 'release' tags for PyPi | |
| # Ideally I would put this in the pypi job... but github syntax doesn't allow for regexes there :shrug: | |
| # Needed to trigger on others' PRs. | |
| # Note that people who fork it need to go to "Actions" tab on their fork and click "I understand my workflows, go ahead and enable them". | |
| pull_request: | |
| # Needed to trigger workflows manually. | |
| workflow_dispatch: | |
| inputs: | |
| debug_enabled: | |
| type: boolean | |
| description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' | |
| required: false | |
| default: false | |
| schedule: | |
| - cron: '31 18 * * 5' # run every Friday | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: [ubuntu-latest, macos-latest] # windows-latest | |
| python-version: ['3.12', '3.13'] | |
| # vvv just an example of excluding stuff from matrix | |
| # exclude: [{platform: macos-latest, python-version: '3.6'}] | |
| runs-on: ${{ matrix.platform }} | |
| # useful for 'optional' pipelines | |
| # continue-on-error: ${{ matrix.platform == 'windows-latest' }} | |
| steps: | |
| # ugh https://github.com/actions/toolkit/blob/main/docs/commands.md#path-manipulation | |
| - run: echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 # nicer to have all git history when debugging/for tests | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - uses: astral-sh/setup-uv@v5 | |
| with: | |
| enable-cache: false # we don't have lock files, so can't use them as cache key | |
| - uses: mxschmitt/action-tmate@v3 | |
| if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |
| # explicit bash command is necessary for Windows CI runner, otherwise it thinks it's cmd... | |
| - run: bash .ci/run | |
| env: | |
| # only compute lxml coverage on ubuntu; it crashes on windows | |
| CI_MYPY_COVERAGE: ${{ matrix.platform == 'ubuntu-latest' && '--cobertura-xml-report .coverage.mypy' || '' }} | |
| - if: matrix.platform == 'ubuntu-latest' # no need to compute coverage for other platforms | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| fail_ci_if_error: true # default false | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| flags: mypy-${{ matrix.python-version }} | |
| files: .coverage.mypy/cobertura.xml | |
| # only deploy plots for latest python version | |
| - if: github.event_name == 'push' && github.event.ref == format('refs/heads/{0}', github.event.repository.master_branch) && matrix.platform == 'ubuntu-latest' && matrix.python-version == '3.13' | |
| name: deploy plots | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./test-outputs | |
| # todo keep_files? if I create a demo page or something |