build #2225
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: build | |
on: | |
push: | |
pull_request: | |
# build weekly at 4:00 AM UTC | |
schedule: | |
- cron: '0 4 * * 1' | |
jobs: | |
lint: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
name: "lint on ${{ matrix.os }} " | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- name: Identify week number | |
shell: bash | |
run: | | |
date +'%V' > week-number.txt | |
date +'week-number=%V' >> $GITHUB_ENV | |
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 | |
id: setup-python | |
with: | |
python-version: "3.12" | |
cache: "pip" | |
cache-dependency-path: | | |
.github/workflows/build.yaml | |
setup.cfg | |
setup.py | |
tox.ini | |
week-number.txt | |
- name: Restore cache | |
id: restore-cache | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: | | |
.tox/ | |
.venv/ | |
key: > | |
lint | |
week=${{ env.week-number }} | |
os=${{ matrix.os }} | |
python=${{ steps.setup-python.outputs.python-version }} | |
hash=${{ hashFiles('.github/workflows/build.yaml', 'tox.ini', 'setup.cfg', 'setup.py') }} | |
- name: Identify venv path | |
shell: bash | |
run: echo 'venv-path=${{ runner.os == 'Windows' && '.venv/Scripts' || '.venv/bin' }}' >> $GITHUB_ENV | |
- name: install tox | |
if: steps.restore-cache.outputs.cache-hit == false | |
run: | | |
python -m venv .venv | |
${{ env.venv-path }}/pip install --upgrade pip setuptools wheel | |
${{ env.venv-path }}/pip install tox | |
- name: run mypy | |
run: ${{ env.venv-path }}/tox -e mypy | |
test: | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
# we do not want a large number of windows and macos builds, so | |
# enumerate them explicitly | |
include: | |
- os: windows-latest | |
python-version: "3.12" | |
- os: macos-latest | |
python-version: "3.12" | |
name: "test py${{ matrix.python-version }} on ${{ matrix.os }}" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- name: Identify week number | |
shell: bash | |
run: | | |
date +'%V' > week-number.txt | |
date +'week-number=%V' >> $GITHUB_ENV | |
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 | |
id: setup-python | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
cache-dependency-path: | | |
.github/workflows/build.yaml | |
setup.cfg | |
setup.py | |
tox.ini | |
week-number.txt | |
- name: Restore cache | |
id: restore-cache | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: | | |
.tox | |
.venv | |
key: > | |
test | |
week=${{ env.week-number }} | |
os=${{ matrix.os }} | |
python=${{ steps.setup-python.outputs.python-version }} | |
hash=${{ hashFiles('.github/workflows/build.yaml', 'setup.cfg', 'setup.py', 'tox.ini') }} | |
- name: Identify venv path | |
shell: bash | |
run: echo 'venv-path=${{ runner.os == 'Windows' && '.venv/Scripts' || '.venv/bin' }}' >> $GITHUB_ENV | |
- name: install tox | |
if: steps.restore-cache.outputs.cache-hit == false | |
run: | | |
python -m venv .venv | |
${{ env.venv-path }}/pip install --upgrade pip setuptools wheel | |
${{ env.venv-path }}/pip install tox | |
- name: run tests | |
run: ${{ env.venv-path }}/tox -e py | |
docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- name: Identify week number | |
shell: bash | |
run: | | |
date +'%V' > week-number.txt | |
date +'week-number=%V' >> $GITHUB_ENV | |
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 | |
id: setup-python | |
with: | |
python-version: "3.12" | |
cache: "pip" | |
cache-dependency-path: | | |
.github/workflows/build.yaml | |
setup.cfg | |
setup.py | |
tox.ini | |
week-number.txt | |
- name: Restore cache | |
id: restore-cache | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: | | |
.tox | |
.venv | |
key: > | |
docs | |
week=${{ env.week-number }} | |
python=${{ steps.setup-python.outputs.python-version }} | |
hash=${{ hashFiles('.github/workflows/build.yaml', 'setup.cfg', 'setup.py', 'tox.ini') }} | |
- name: install tox | |
if: steps.restore-cache.outputs.cache-hit == false | |
run: | | |
python -m venv .venv | |
.venv/bin/pip install --upgrade pip setuptools wheel | |
.venv/bin/pip install tox | |
- name: test reference docs generation | |
run: .venv/bin/tox -e reference | |
test-package-metadata: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- name: Identify week number | |
shell: bash | |
run: | | |
date +'%V' > week-number.txt | |
date +'week-number=%V' >> $GITHUB_ENV | |
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 | |
id: setup-python | |
with: | |
python-version: "3.12" | |
cache: "pip" | |
cache-dependency-path: | | |
.github/workflows/build.yaml | |
setup.cfg | |
setup.py | |
tox.ini | |
week-number.txt | |
- name: Restore cache | |
id: restore-cache | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: | | |
.tox | |
.venv | |
key: > | |
test-package-metadata | |
week=${{ env.week-number }} | |
python=${{ steps.setup-python.outputs.python-version }} | |
hash=${{ hashFiles('.github/workflows/build.yaml', 'setup.cfg', 'setup.py', 'tox.ini') }} | |
- name: install tox | |
if: steps.restore-cache.outputs.cache-hit == false | |
run: | | |
python -m venv .venv | |
.venv/bin/pip install --upgrade pip setuptools wheel | |
.venv/bin/pip install tox | |
- name: check package metadata | |
run: .venv/bin/tox -e twine-check | |
test-mindeps: | |
runs-on: ubuntu-latest | |
name: "mindeps" | |
steps: | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- name: Identify week number | |
shell: bash | |
run: | | |
date +'%V' > week-number.txt | |
date +'week-number=%V' >> $GITHUB_ENV | |
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 | |
id: setup-python | |
with: | |
python-version: "3.8" | |
cache: "pip" | |
cache-dependency-path: | | |
.github/workflows/build.yaml | |
setup.cfg | |
setup.py | |
tox.ini | |
week-number.txt | |
- name: Restore cache | |
id: restore-cache | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: | | |
.tox | |
.venv | |
key: > | |
test-mindeps | |
week=${{ env.week-number }} | |
python=${{ steps.setup-python.outputs.python-version }} | |
hash=${{ hashFiles('.github/workflows/build.yaml', 'setup.cfg', 'setup.py', 'tox.ini') }} | |
- name: install tox | |
if: steps.restore-cache.outputs.cache-hit == false | |
run: | | |
python -m venv .venv | |
.venv/bin/pip install --upgrade pip setuptools wheel | |
.venv/bin/pip install tox | |
- name: test | |
run: .venv/bin/tox -e py-mindeps | |
test-sdk-main: | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.12"] | |
runs-on: ubuntu-latest | |
name: "sdk-main" | |
steps: | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- name: Identify week number | |
shell: bash | |
run: | | |
date +'%V' > week-number.txt | |
date +'week-number=%V' >> $GITHUB_ENV | |
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 | |
id: setup-python | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
cache-dependency-path: | | |
.github/workflows/build.yaml | |
setup.cfg | |
setup.py | |
tox.ini | |
week-number.txt | |
- name: Restore cache | |
id: restore-cache | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: | | |
.tox | |
.venv | |
key: > | |
test-sdk-main | |
week=${{ env.week-number }} | |
python=${{ steps.setup-python.outputs.python-version }} | |
hash=${{ hashFiles('.github/workflows/build.yaml', 'setup.cfg', 'setup.py', 'tox.ini') }} | |
- name: install tox | |
if: steps.restore-cache.outputs.cache-hit == false | |
run: | | |
python -m venv .venv | |
.venv/bin/pip install --upgrade pip setuptools wheel | |
.venv/bin/pip install tox | |
- run: .venv/bin/tox -e py-sdkmain |