.github/workflows/main.yaml #597
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
on: # yamllint disable-line rule:truthy | |
workflow_dispatch: | |
push: { branches: [main] } | |
pull_request: { branches: [main] } | |
schedule: [{ cron: 43 5 * * * }] | |
jobs: | |
build: | |
runs-on: [ubuntu-latest] | |
outputs: | |
ready: ${{ steps.ready.outcome }} | |
version: ${{ steps.version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- run: echo "version=$(python qgrid/_version.py)" >> "$GITHUB_OUTPUT" | |
id: version | |
- name: Setup latest stable Python | |
uses: actions/setup-python@v5 | |
with: { python-version: "3.x" } | |
id: setup | |
- name: Setup Node JS current release | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- run: >- | |
pipx run "--python=${{ steps.setup.outputs.python-path }}" | |
reproducibly --version | |
- run: >- | |
pipx run "--python=${{ steps.setup.outputs.python-path }}" | |
reproducibly . dist | |
- run: >- | |
pipx run "--python=${{ steps.setup.outputs.python-path }}" | |
reproducibly dist/*.tar.gz dist | |
- run: pipx run twine check --strict dist/* | |
- run: sha256sum dist/* | tee dist_checksums.txt | |
- uses: actions/upload-artifact@v4 | |
with: { path: "dist/\ndist_checksums.txt\n" } | |
- run: pipx run .github/ready.py | |
continue-on-error: true | |
id: ready | |
if: "endswith(github.ref, '/main') && !github.event.schedule" | |
test: | |
runs-on: [ubuntu-latest] | |
needs: build | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: 3.11-requirement | |
version: "3.11" | |
requirement: requirements.txt | |
- name: 3.11-latest | |
version: "3.11" | |
- name: 3.12-latest | |
version: "3.12" | |
static-analysis: true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.version }} | |
uses: actions/setup-python@v5 | |
with: { python-version: "${{ matrix.version }}" } | |
- uses: actions/download-artifact@v4 | |
with: { name: artifact } | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: >- | |
${{ runner.os }}-${{ matrix.version }}-${{ matrix.requirement | |
}}-pip-${{ hashFiles('**/setup.py') }} | |
- run: python -m pip install --upgrade pip | |
- run: pip install --requirement=${{ matrix.requirement }} | |
if: matrix.requirement | |
# python3.12 -m venv --upgrade-deps .venv ; . .venv/bin/activate | |
- name: Install wheel with test extras | |
run: > | |
pip install "dist/qgridtrusted-$(python | |
qgrid/_version.py)-py3-none-any.whl[test]" | |
- name: Lint with flake8 | |
run: flake8 | |
if: matrix.static-analysis | |
- name: Check that imports are sorted with usort | |
run: git ls-files '*.py' | xargs usort check | |
if: matrix.static-analysis | |
- run: python -P -c "import qgrid; print(qgrid.__file__)" | |
- run: python -P -m pytest | |
- run: >- | |
printf | |
'ready=%s version=%s' | |
"${{ needs.build.outputs.ready }}" | |
"${{ needs.build.outputs.version }}" | |
pypi: | |
needs: [build, test] | |
if: endswith(github.ref, '/main') && needs.build.outputs.ready == 'success' | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: >- | |
https://pypi.org/project/qgridtrusted/${{ | |
needs.build.outputs.version | |
}}/ | |
permissions: { id-token: write } | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: { name: artifact } | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: { print-hash: true } | |
# vim: set filetype=yaml.action : |