tests #368
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: | |
branches: [master] | |
pull_request: | |
schedule: | |
# Run every Sunday | |
- cron: "0 0 * * 0" | |
workflow_dispatch: | |
jobs: | |
code-quality: | |
name: Code Quality | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements-dev.txt | |
- name: Lint package | |
run: | | |
make lint | |
tests: | |
name: Tests (${{ matrix.os }}, Python ${{ matrix.python-version }}) | |
needs: code-quality | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: [3.7, 3.8, 3.9, "3.10", 3.11] | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} with Miniconda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
channels: conda-forge | |
- name: Install dependencies | |
run: | | |
which python | |
python --version | |
conda update pip | |
conda install pandoc | |
python -m pip install -r requirements-dev.txt | |
- name: Run tests | |
run: | | |
make test | |
- name: Build distribution and test installation | |
run: | | |
make dist | |
if [[ ${{ matrix.os }} == "windows-latest" ]]; then | |
PYTHON_BIN=Scripts/python | |
else | |
PYTHON_BIN=bin/python | |
fi | |
echo "=== Testing wheel installation ===" | |
python -m venv .venv-whl | |
.venv-whl/$PYTHON_BIN -m pip install --upgrade pip | |
.venv-whl/$PYTHON_BIN -m pip install dist/nbautoexport-*.whl | |
.venv-whl/$PYTHON_BIN -m nbautoexport --version | |
echo "=== Testing source installation ===" | |
python -m venv .venv-sdist | |
.venv-sdist/$PYTHON_BIN -m pip install --upgrade pip | |
.venv-sdist/$PYTHON_BIN -m pip install dist/nbautoexport-*.tar.gz | |
.venv-sdist/$PYTHON_BIN -m nbautoexport --version | |
- name: Test building documentation | |
run: | | |
make docs | |
if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.8 | |
- name: Deploy site preview to Netlify | |
if: | | |
matrix.os == 'ubuntu-latest' && matrix.python-version == 3.8 | |
&& github.event.pull_request != null | |
uses: nwtgck/[email protected] | |
with: | |
publish-dir: "./docs/site" | |
production-deploy: false | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
deploy-message: "Deploy from GitHub Actions" | |
enable-pull-request-comment: true | |
enable-commit-comment: false | |
overwrites-pull-request-comment: true | |
alias: deploy-preview-${{ github.event.number }} | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
timeout-minutes: 1 | |
- name: Upload coverage to codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./coverage.xml | |
fail_ci_if_error: true | |
if: matrix.os == 'ubuntu-latest' | |
integration-tests: | |
name: Integration tests | |
needs: [tests] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
app: [lab, nbclassic, notebook] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
which python | |
python --version | |
python -m pip install -r integration_tests/requirements/${{ matrix.app }}.txt | |
- name: Install post-save hook | |
run: | | |
nbautoexport install -vv | |
- name: Run integration test | |
run: bash integration_tests/test.sh ${{ matrix.app }} | |
notify: | |
name: Notify failed build | |
needs: [code-quality, tests, integration-tests] | |
if: failure() && github.event.pull_request == null | |
runs-on: ubuntu-latest | |
steps: | |
- uses: jayqi/failed-build-issue-action@v1 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} |