setup: extras: dev: scitt-emulator: Bump to e89a60584fa717382f279ae24… #61
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: Tests | |
on: | |
push: | |
paths-ignore: | |
- .github/workflows/release.yml | |
pull_request: | |
paths-ignore: | |
- .github/workflows/release.yml | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: | |
- "3.10" | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Get pip cache | |
id: pip-cache | |
run: | | |
python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)" | |
- name: pip cache | |
uses: actions/cache@v1 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.cfg') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dev dependencies | |
run: | | |
pip install -U pip setuptools wheel | |
pip install -e .[dev] | |
python -m pip freeze | |
- name: Build | |
run: | | |
python -m build . | |
- name: Generate SBOM | |
id: generate-sbom | |
uses: pdxjohnny/sbom4python@github-action | |
with: | |
python-version: ${{ matrix.python-version }} | |
module-name: httptest | |
output-directory: sbom | |
- name: in-toto attestation for cyclonedx SBOM | |
id: in-toto-cyclonedx | |
run: | | |
echo "attestation<<GITHUB_OUTPUT_EOF" >> $GITHUB_OUTPUT | |
tee -a $GITHUB_OUTPUT <<EOF | |
{ | |
"_type": "https://in-toto.io/Statement/v0.1", | |
"subject": [ | |
{ | |
"name": "$(cd dist/ && echo *.tar.gz)", | |
"digest": {"sha256": "$(cd dist/ && sha256sum $(echo *.tar.gz) | awk '{print $1}')"} | |
}, | |
{ | |
"name": "$(cd dist/ && echo *.whl)", | |
"digest": {"sha256": "$(cd dist/ && sha256sum $(echo *.whl) | awk '{print $1}')"} | |
} | |
], | |
"predicateType": "https://cyclonedx.org/bom/v1.4", | |
"predicate": $(cat "httptest-py${{ matrix.python-version }}.json") | |
} | |
} | |
EOF | |
echo "GITHUB_OUTPUT_EOF" >> $GITHUB_OUTPUT | |
- name: Submit SBOM to SCITT | |
id: scitt-submit-sbom | |
uses: pdxjohnny/scitt-api-emulator@github-action | |
with: | |
issuer: did:web:github.com:pdxjohnny.keys | |
payload: ${{ steps.in-toto-cyclonedx.outputs.attestation }} | |
scitt-url: https://scitt.unstable.chadig.com | |
- name: Create Pull Request | |
if: ${{ steps.generate-sbom.outputs.changed }} | |
uses: peter-evans/[email protected] | |
with: | |
commit-message: "chore: update SBOM for Python ${{ matrix.python-version }}" | |
title: "chore: update SBOM for Python ${{ matrix.python-version }}" | |
branch: chore-sbom-py${{ matrix.python-version }} | |
delete-branch: true | |
author: GitHub Actions <[email protected]> | |
add-paths: sbom | |
unittest: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-latest | |
- windows-latest | |
python-version: | |
- "3.10" | |
- "3.11" | |
- "3.12" | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Get pip cache | |
id: pip-cache | |
run: | | |
python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)" | |
- name: pip cache | |
uses: actions/cache@v1 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.cfg') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dev dependencies | |
run: | | |
pip install -U pip setuptools wheel | |
pip install -e .[dev] | |
python -m pip freeze | |
- name: Test without coverage | |
if: ${{ matrix.python-version != '3.10' }} | |
run: | | |
python -m unittest discover -v | |
- name: Coverage Test | |
if: ${{ matrix.python-version == '3.10' && matrix.os == 'ubuntu-latest' }} | |
run: | | |
python -m coverage run -m unittest discover -v | |
python -m coverage report -m | |
- name: Upload coverage to codecov | |
if: ${{ matrix.python-version == '3.10' && matrix.os == 'ubuntu-latest' }} | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
run: | | |
pip install -U codecov | |
codecov |