Add code snippets to groups #3156
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
name: Tests | |
on: | |
push: | |
branches: [ '**' ] | |
pull_request: | |
branches: [ main, dev, web ] | |
jobs: | |
matrix_prep: | |
name: Initial setup | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
# Required as the JSON input file needs to be read | |
- uses: actions/checkout@v3 | |
- name: Conditional Build Matrix | |
id: set-matrix | |
uses: JoshuaTheMiller/conditional-build-matrix@main | |
with: | |
# Filtering the default input file: '.github/workflows/matrix_includes.json' | |
# using JMESPath https://jmespath.org/examples.html | |
filter: "[? '${{ secrets.LMFDB_CI_ACCESS }}' || server == 'devmirror']" | |
test: | |
runs-on: ubuntu-latest | |
needs: matrix_prep | |
strategy: | |
fail-fast: false | |
matrix: ${{fromJson(needs.matrix_prep.outputs.matrix)}} | |
name: ${{matrix.server}} ${{matrix.folders}} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
activate-environment: lmfdb | |
auto-activate-base: false | |
# environment-file: .environment.yml # now we install after cache | |
channel-priority: strict | |
# IMPORTANT: use-only-tar-bz2: true needs to be set for caching to work properly! | |
use-only-tar-bz2: true | |
- name: Cache conda | |
uses: actions/cache@v3 | |
id: condacache | |
env: | |
# Increase this value to reset cache if .environment.yml has not changed | |
CACHE_NUMBER: 0 | |
with: | |
path: | | |
/usr/share/miniconda/envs/lmfdb | |
key: | |
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ | |
hashFiles('.environment.yml') }} | |
- name: Run install script | |
# Only need to run install when deps has been changed | |
if: steps.condacache.outputs.cache-hit != 'true' | |
run: conda env create -f .environment.yml || conda env update -f .environment.yml | |
- name: Show conda info | |
shell: bash -l {0} | |
run: | | |
conda info | |
conda list | |
- name: Cache pip | |
uses: actions/cache@v3 | |
with: | |
# This path is specific to Ubuntu | |
path: ~/.cache/pip | |
# Look to see if there is a cache hit for the corresponding requirements file | |
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
${{ runner.os }}- | |
- name: pip stuff | |
shell: bash -l {0} | |
run: | | |
sage -pip install -r requirements.txt | |
pip install pyflakes pylint pycodestyle | |
- name: checking that we didn't miss any test files | |
shell: bash -l {0} | |
# If this fails you need to update the file list above and file count | |
run: test $(find lmfdb -name 'test_*.py' -or -name '*_test.py' | wc -l) -eq 41 | |
- name: Config LMFDB to run tests against proddb | |
if: matrix.files != 'lint' && matrix.server == 'proddb' | |
env: | |
LMFDB_CI_ACCESS: ${{ secrets.LMFDB_CI_ACCESS }} | |
shell: bash -l {0} | |
run: | | |
sage -python lmfdb/utils/config.py --postgresql-host proddb.lmfdb.xyz --postgresql-pass "$LMFDB_CI_ACCESS" | |
- name: Run LMFDB tests | |
if: matrix.files != 'lint' | |
shell: bash -l {0} | |
run: tox -e tests -- ${{ matrix.files}} | |
- name: Run linting | |
if: matrix.files == 'lint' | |
shell: bash -l {0} | |
run: tox -e lint |