migrate to justfile (#208) #1783
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: [main] | |
pull_request: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 5 * * *" | |
concurrency: | |
group: test-${{ github.head_ref }} | |
cancel-in-progress: true | |
env: | |
PYTHONUNBUFFERED: 1 | |
FORCE_COLOR: 1 | |
jobs: | |
test: | |
name: py ${{ matrix.python-version }} | |
strategy: | |
fail-fast: false | |
matrix: | |
# os: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: [3.9, "3.10", 3.11, 3.12] | |
node-version: [18] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: extractions/setup-just@v2 | |
# ------------------------------------------------------------------------ | |
# JS | |
- name: Set up pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install JS deps | |
run: | | |
just js-install | |
- name: Build JS | |
run: | | |
just js-build | |
# ------------------------------------------------------------------------ | |
# Python | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: actions/cache@v3 | |
id: cached-python-env | |
with: | |
path: ${{ env.pythonLocation }} | |
key: > | |
python | |
${{ runner.os }} | |
python-${{ matrix.python-version }} | |
${{ hashFiles('pyproject.toml') }} | |
${{ hashFiles('requirements*') }} | |
- name: Install dependencies | |
if: steps.cached-python-env.outputs.cache-hit != 'true' | |
run: pip install -r requirements-dev.lock | |
- name: Install Hatch | |
run: pip install --upgrade hatch | |
- name: Print Python info | |
run: | | |
which python | |
python --version | |
which pip | |
pip --version | |
pip freeze | |
# ------------------------------------------------------------------------ | |
# Test | |
- name: Build package | |
run: hatch build | |
- name: Install package | |
run: | | |
pip install dist/*.tar.gz | |
pip freeze | |
- name: Run tests | |
run: | | |
pytest . | |
just report | |
- name: Codecov | |
uses: codecov/codecov-action@v2 | |
with: | |
file: ./coverage.xml | |
- name: Upload test results to GitHub | |
uses: actions/upload-artifact@v2 | |
if: failure() | |
with: | |
name: test-results-py${{ matrix.python-version }} | |
path: htmlcov |