Python Package #1770
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: Python Package | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 6 * * *' | |
push: | |
paths: | |
- 'src/**' | |
- 'tests/**' | |
- 'poetry.lock' | |
- 'pyproject.toml' | |
- '.github/workflows/test.yml' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 2 | |
matrix: | |
python-version: [3.7, 3.8, 3.9, '3.10'] | |
steps: | |
- uses: actions/checkout@v3.6.0 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4.7.0 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip poetry | |
poetry config virtualenvs.in-project true | |
poetry config virtualenvs.create true | |
poetry install | |
- name: Run tests | |
env: | |
SKJOLD_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PYTHONPATH: src | |
run: | | |
poetry run pytest -x --cov=src tests | |
- name: Upload coverage report | |
if: matrix.python-version == 3.8 && success() && github.ref == 'refs/heads/master' | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
GIT_COMMIT_SHA: ${{ github.sha }} | |
GIT_BRANCH: master | |
run: | | |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter | |
chmod +x ./cc-test-reporter | |
poetry run coverage xml | |
./cc-test-reporter after-build | |
- name: Run github example | |
env: | |
SKJOLD_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PYTHONPATH: src | |
run: | | |
echo "urllib3==1.23" | poetry run skjold -v audit -o json -r -s github - | |
- name: Run gemnasium example | |
env: | |
PYTHONPATH: src | |
run: | | |
echo "urllib3==1.23" | poetry run skjold -v audit -o json -r -s gemnasium - | |
- name: Run pyup example | |
env: | |
PYTHONPATH: src | |
run: | | |
echo "urllib3==1.22" | poetry run skjold -v audit -o json -r -s pyup - | |
- name: Run pypa example | |
env: | |
PYTHONPATH: src | |
run: | | |
echo "urllib3==1.22" | poetry run skjold -v audit -o json -r -s pypa - | |
- name: Run osv example | |
env: | |
PYTHONPATH: src | |
run: | | |
echo "urllib3==1.22" | poetry run skjold -v audit -o json -r -s osv - | |
- name: Run .skjoldignore example | |
env: | |
PYTHONPATH: src | |
run: | | |
echo "urllib3==1.23" | poetry run skjold audit -s pypa -i tests/fixtures/formats/ignore/all - |