Add basic spectrum CLI #942
Workflow file for this run
This file contains hidden or 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 on the latest aiidalab/full-stack and ispg-group/atmospec docker images. | |
| name: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| env: | |
| FORCE_COLOR: 1 | |
| jobs: | |
| pre-commit: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| # nbstripout requires python 3.10 | |
| python-version: "3.10" | |
| activate-environment: true | |
| - name: Install app for type checking | |
| run: uv pip install -e .[dev,test] | |
| - uses: j178/prek-action@v3.0.0 | |
| test-app: | |
| needs: pre-commit | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| permissions: | |
| packages: read | |
| contents: read | |
| strategy: | |
| matrix: | |
| tag: [latest] | |
| image: ["ghcr.io/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@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Check out app | |
| uses: actions/checkout@v7 | |
| - name: Set up Python | |
| uses: actions/setup-python@v7 | |
| with: | |
| python-version: "3.12" | |
| 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 | |
| - name: Run pytest | |
| run: pytest -sv --tb=short --driver ${{ matrix.browser }} -o cache_dir=$PYTEST_CACHE_DIR tests_integration/ | |
| - 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@v7 | |
| with: | |
| name: Screenshots-${{env.IMAGE_NAME}}-${{ matrix.tag }}-${{ matrix.browser }} | |
| path: screenshots/ | |
| if-no-files-found: error | |
| unit-tests: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| permissions: | |
| packages: read | |
| contents: read | |
| strategy: | |
| matrix: | |
| python-version: ['3.9', '3.12'] | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@v10.0.1 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| activate-environment: true | |
| - name: Install dependencies for tests | |
| run: uv pip install -e .[test] | |
| - name: Run pytest | |
| run: pytest --cov aiidalab_ispg tests/ | |
| - name: Smoke test spectrum.py | |
| run: uv run -s aiidalab_ispg/app/spectrum.py -h | |
| - name: Smoke test wigner.py | |
| run: uv run -s aiidalab_ispg/wigner/wigner.py -h | |
| - name: Upload coverage report | |
| uses: codecov/codecov-action@v7 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| fail_ci_if_error: true |