[vendor-schemas] automated update (#480) #1290
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: | |
jobs: | |
run-tox-env: | |
strategy: | |
matrix: | |
toxenv: [mypy, twine-check] | |
py: ["3.x"] | |
include: | |
- toxenv: py-mindeps | |
py: "3.8" | |
runs-on: ubuntu-latest | |
name: "Run '${{ matrix.toxenv }}' on python ${{ matrix.py }}" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: get date for caching | |
run: /bin/date -u "+%U" > cachedate.txt | |
shell: bash | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "${{ matrix.py }}" | |
cache: "pip" | |
cache-dependency-path: | | |
.github/workflows/build.yaml | |
pyproject.toml | |
tox.ini | |
cachedate.txt | |
- run: python -m pip install tox | |
- run: python -m tox run -e "${{ matrix.toxenv }}" | |
# run tests after building an sdist and unpacking it | |
test-sdist: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: install requirements | |
run: python -m pip install build tox | |
- name: build and unpack sdist | |
run: | | |
python -m build --sdist | |
version="$(grep '^version' pyproject.toml | head -n1 | cut -d'"' -f2)" | |
cd dist | |
tar -xzf "check_jsonschema-${version}.tar.gz" | |
- name: test | |
run: | | |
version="$(grep '^version' pyproject.toml | head -n1 | cut -d'"' -f2)" | |
cd "dist/check_jsonschema-${version}" | |
python -m tox run -m ci | |
ci-test-matrix: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
py: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
name: "Run tests on ${{ matrix.os }}, py${{ matrix.py }}" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: get date for caching | |
run: /bin/date -u "+%U" > cachedate.txt | |
shell: bash | |
- uses: actions/setup-python@v5 | |
id: setup-python | |
with: | |
python-version: ${{ matrix.py }} | |
cache: "pip" | |
cache-dependency-path: | | |
.github/workflows/build.yaml | |
pyproject.toml | |
tox.ini | |
cachedate.txt | |
- run: python -m pip install tox | |
- name: cache tox virtualenvs | |
uses: actions/cache@v4 | |
with: | |
path: .tox | |
key: > | |
tox | |
os=${{ runner.os }} | |
python=${{ steps.setup-python.outputs.python-version }} | |
hash=${{ hashFiles('.github/workflows/build.yaml', 'pyproject.toml', 'tox.ini', 'cachedate.txt') }} | |
- name: test | |
run: | | |
python -m tox run -m ci -- -v --junitxml pytest.{envname}.xml | |
python -m tox run -e cov | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: pytest-report-py${{ matrix.py }}-${{ matrix.os }} | |
path: pytest.*.xml | |
collate-tests: | |
needs: [ci-test-matrix] | |
runs-on: ubuntu-latest | |
name: "Collate results to check for skipped tests" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
# download everything | |
- uses: actions/download-artifact@v4 | |
with: | |
path: artifacts/ | |
# collate and report | |
- run: python ./scripts/aggregate-pytest-reports.py artifacts/*/pytest.*.xml | |
# this job ensures that any changes to the hook config are reflected properly | |
# in hook config generation | |
# if it fails, please see the CONTRIBUTING.md for the repo and read the section titled | |
# "Adding new hooks" | |
ensure-catalog-matches-hook-config: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: get date for caching | |
run: /bin/date -u "+%U" > cachedate.txt | |
shell: bash | |
- uses: actions/setup-python@v5 | |
id: setup-python | |
with: | |
python-version: "3.x" | |
cache: "pip" | |
cache-dependency-path: | | |
.github/workflows/build.yaml | |
pyproject.toml | |
tox.ini | |
cachedate.txt | |
- run: python -m pip install tox | |
- name: regenerate hook config | |
run: tox run -e generate-hooks-config | |
- name: fail if .pre-commit-hooks.yaml changed | |
run: git diff --exit-code -- .pre-commit-hooks.yaml | |
self-check: | |
name: "Self-Check" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: get date for caching | |
run: /bin/date -u "+%U" > cachedate.txt | |
shell: bash | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
cache: "pip" | |
cache-dependency-path: | | |
.github/workflows/build.yaml | |
pyproject.toml | |
tox.ini | |
cachedate.txt | |
- name: install from source | |
run: python -m pip install . | |
- name: run on own workflows via HTTPS schema | |
run: check-jsonschema --schemafile "https://json.schemastore.org/github-workflow" .github/workflows/*.yaml | |
- name: run on own workflows via vendored schema | |
run: check-jsonschema --builtin-schema vendor.github-workflows .github/workflows/*.yaml |