Persist credentials for mike push jobs (#196) #515
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
name: Lint and test nnbench | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
lint: | |
name: Run code checks and formatting hooks | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Install uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
python-version: "3.10" | |
- name: Run pre-commit checks | |
run: uv run pre-commit run --all-files --verbose --show-diff-on-failure | |
test: | |
name: Test nnbench on ${{ matrix.os }} on Python ${{ matrix.python-version }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest, macos-latest, windows-latest ] | |
python-version: [ "3.10", 3.11, 3.12, 3.13 ] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Install uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Test with Python ${{ matrix.python-version }} | |
run: uv run --frozen pytest -s | |
docs: | |
name: Publish latest documentation for nnbench | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
persist-credentials: true # needed for mike to publish. | |
- name: Install uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
python-version: "3.11" | |
- name: Install the project | |
run: uv sync --group docs | |
- name: Build documentation using mike | |
uses: ./.github/actions/mike-docs | |
with: | |
version: latest | |
pre_release: true # include pre-release notification banner | |
push: ${{ github.ref == 'refs/heads/main' }} # build always, publish on 'main' only to prevent version clutter |