This repository has been archived by the owner on Jul 20, 2024. It is now read-only.
test #1375
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: | |
branches: [main] | |
schedule: | |
- cron: "0 5 * * *" | |
workflow_dispatch: | |
concurrency: | |
group: test-${{ github.head_ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
name: test / py ${{ matrix.python-version }} / node ${{ matrix.node-version }} | |
strategy: | |
matrix: | |
python-version: [3.8, 3.9, "3.10"] | |
node-version: [18] | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: arduino/setup-task@v1 | |
# ------------------------------------------------------------------------ | |
# JS | |
- name: Setup Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Load cached node_modules | |
id: cached-node_modules | |
uses: actions/cache@v3 | |
with: | |
path: js/node_modules | |
key: node_modules-${{ runner.os }}-node${{ matrix.node-version }}-${{ hashFiles('js/package*.json') }} | |
- name: Install JS deps | |
if: steps.cached-node_modules.outputs.cache-hit != 'true' | |
run: | | |
make npm-install | |
- name: Build JS | |
run: | | |
make npm-build | |
# ------------------------------------------------------------------------ | |
# Python | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: 1.6.1 | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Load cached venv | |
id: cached-python-env | |
uses: actions/cache@v3 | |
with: | |
path: python/.venv | |
key: venv-test-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}-1 | |
- name: Ensure cache is healthy | |
id: cached-python-env-check | |
continue-on-error: true | |
if: steps.cached-python-env.outputs.cache-hit == 'true' | |
run: | | |
.venv/bin/activate/bin/python --version | |
# poetry run python --version | |
- name: Debug options | |
run: | | |
echo ${{ steps.cached-python-env.outputs.cache-hit }} | |
echo ${{ steps.cached-python-env-check.outcome }} | |
- name: Install Python dependencies | |
if: steps.cached-python-env.outputs.cache-hit != 'true' || steps.cached-python-env-check.outcome != 'success' | |
run: | | |
cd python | |
rm -rf .venv || true | |
poetry install --no-interaction --no-root --with test | |
- name: Print Python info | |
run: | | |
source python/.venv/bin/activate | |
which python | |
python --version | |
which pip | |
pip --version | |
pip freeze | |
# ------------------------------------------------------------------------ | |
# Test | |
- name: Build Python Package | |
run: | | |
source python/.venv/bin/activate | |
make pkg | |
- name: Install package | |
run: | | |
source python/.venv/bin/activate | |
cd python | |
pip install dist/*.tar.gz | |
pip freeze | |
- name: Run tests | |
run: | | |
source python/.venv/bin/activate | |
make test-all | |
make report | |
- name: Codecov | |
uses: codecov/codecov-action@v2 | |
with: | |
file: python/coverage.xml | |
- name: Upload test results to GitHub | |
uses: actions/upload-artifact@v2 | |
if: failure() | |
with: | |
name: test-results-py${{ matrix.python-version }} | |
path: python/htmlcov |