Use image from docker.io registry #43
Workflow file for this run
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
--- | |
# Run basic tests for this app on the latest aiidalab-docker image. | |
name: continuous-integration | |
on: [push, pull_request] | |
# https://docs.github.com/en/actions/using-jobs/using-concurrency | |
concurrency: | |
# only cancel in-progress jobs or runs for the current workflow - matches against branch & tags | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
pre-commit: | |
# Adapted from: https://github.com/CasperWA/voila-optimade-client | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
cache: pip | |
cache-dependency-path: | | |
.pre-commit-config.yaml | |
**/setup.cfg | |
**/pyproject.toml | |
**/requirements*.txt | |
- uses: pre-commit/[email protected] | |
test-notebooks: | |
needs: [pre-commit] | |
strategy: | |
matrix: | |
browser: [Chrome, Firefox] | |
python-version: ['3.10'] | |
aiida-core-version: [aiida-2.1.2, aiida-2.4.3] # test on the latest and the oldest supported version | |
fail-fast: false | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
steps: | |
- name: Check out app | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: pip | |
cache-dependency-path: | | |
**/setup.cfg | |
**/pyproject.toml | |
**/requirements*.txt | |
- name: Install package test dependencies | |
# Test test will actually happened in the container, here only need to install | |
# the pytest-docker dependency. | |
# To add the dependencies to the container, we need to add them to the | |
# installation command in the `test_notebooks/conftest.py`. | |
run: pip install -e .[dev] | |
- name: Set jupyter token env | |
run: echo "JUPYTER_TOKEN=$(openssl rand -hex 32)" >> $GITHUB_ENV | |
# The Firefox and its engine geckodrive need do be installed manually to run | |
# selenium tests. | |
- name: Install Firefox | |
uses: browser-actions/setup-firefox@latest | |
with: | |
firefox-version: '96.0' | |
if: matrix.browser == 'Firefox' | |
- name: Install geckodriver | |
run: | | |
wget -c https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz | |
tar xf geckodriver-v0.30.0-linux64.tar.gz -C /usr/local/bin | |
if: matrix.browser == 'Firefox' | |
- name: Run pytest | |
run: pytest -v --driver ${{ matrix.browser }} tests_notebooks | |
env: | |
TAG: ${{ matrix.aiida-core-version }} | |
- name: Upload screenshots as artifacts | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Screenshots-${{ matrix.aiida-core-version }}-${{ matrix.browser }} | |
path: screenshots/ | |
if-no-files-found: error | |
test-package: | |
needs: [pre-commit] | |
strategy: | |
matrix: | |
tag: [latest] | |
python-version: ['3.9', '3.10'] | |
fail-fast: false | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
services: | |
rabbitmq: | |
image: rabbitmq:latest | |
ports: | |
- 5672:5672 | |
steps: | |
- name: Check out app | |
uses: actions/checkout@v4 | |
- name: Install povray | |
run: sudo apt-get install povray | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: pip | |
cache-dependency-path: | | |
**/setup.cfg | |
**/pyproject.toml | |
**/requirements*.txt | |
- name: Install package | |
run: pip install -e .[dev,smiles,optimade] | |
- name: Run pytest | |
run: pytest -v tests --cov | |
env: | |
TAG: ${{ matrix.tag }} | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
flags: python-${{ matrix.python-version }} |