Bump actions/cache from 3 to 4 #10
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: Test | |
on: | |
push: | |
branches: | |
- develop | |
pull_request: | |
env: | |
FORCE_COLOR: 1 | |
PRE_COMMIT_COLOR: "always" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
- uses: actions/cache@v4 | |
name: Configure pip caching | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install linter requirements | |
run: pip install -r requirements/lint.txt | |
- name: Install dependencies | |
run: | | |
pip install -e . | |
- name: Run all pre-commit checks | |
run: | | |
pre-commit run --all-files --verbose --show-diff-on-failure | |
test: | |
needs: [ lint ] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11" ] | |
os: [ ubuntu-latest, macos-latest, windows-latest ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: actions/cache@v4 | |
name: Configure pip caching | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: | | |
pip install -e . | |
pip install -r requirements/test.txt | |
- name: Run tests | |
run: | | |
make test | |
test-deploy: | |
needs: [ test ] | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/develop' && github.event_name == 'push' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.7' | |
- name: Install build requirements | |
run: pip install -r requirements/build.txt | |
- name: Create wheel | |
run: make build | |
- name: List directory structure | |
run: ls -R dist/* | |
- name: Validate wheel | |
run: twine check dist/* | |
- name: Install | |
run: make install | |
- name: Publish package | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
skip-existing: true | |
user: __token__ | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} |