Skip to content

Update linters

Update linters #698

Workflow file for this run

# Run basic tests for this app on the latest aiidalab/full-stack docker image.
name: CI
on:
push:
branches:
- main
tags:
- "v*"
pull_request:
branches:
- "*"
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Check out app
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"
cache-dependency-path: |
**/setup.cfg
**/pyproject.toml
- name: Run pre-commit
uses: pre-commit/[email protected]
test-app:
needs: pre-commit
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
packages: read
contents: read
strategy:
matrix:
tag: [latest]
image: ["aiidalab/full-stack", "ghcr.io/ispg-group/atmospec"]
browser: [Firefox, Chrome]
fail-fast: false
env:
IMAGE: ${{ matrix.image }}
TAG: ${{ matrix.tag }}
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Check out app
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: pip
cache-dependency-path: |
**/setup.cfg
**/pyproject.toml
**/requirements*.txt
- name: Install dependencies for tests
run: pip install -r requirements-test.txt
- 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
if: matrix.browser == 'Firefox'
uses: browser-actions/setup-firefox@latest
with:
firefox-version: "96.0"
- name: Install geckodriver
if: matrix.browser == 'Firefox'
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
- name: Run pytest
run: pytest -sv --driver ${{ matrix.browser }} -o cache_dir=$PYTEST_CACHE_DIR tests/app/
- name: Replace slashes in image name
if: always()
run: echo "IMAGE_NAME=${IMAGE//\//-}" >> $GITHUB_ENV
- name: Upload screenshots as artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: Screenshots-${{env.IMAGE_NAME}}-${{ matrix.tag }}-${{ matrix.browser }}
path: screenshots/
if-no-files-found: error
release:
if: >-
github.repository == 'ispg-group/aiidalab-ispg'
&& github.ref_type == 'tag'
needs: [pre-commit, test-app]
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
steps:
- uses: softprops/[email protected]
name: Create release
if: startsWith(github.ref, 'refs/tags/v')
with:
generate_release_notes: true