|
| 1 | +name: Build, and run tests lint and format |
| 2 | +env: |
| 3 | + IN_GITHUB_ACTION: 1 |
| 4 | + |
| 5 | +on: [push] |
| 6 | + |
| 7 | +jobs: |
| 8 | + build-linux: |
| 9 | + # require 8-core machines (Github Actions Larger Runners) to have more than 14GB disk space |
| 10 | + runs-on: 8-core-ubuntu # ubuntu-latest |
| 11 | + strategy: |
| 12 | + max-parallel: 5 |
| 13 | + |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v4 |
| 16 | + - name: Set up Python 3.8 |
| 17 | + uses: actions/setup-python@v5 |
| 18 | + with: |
| 19 | + python-version: '3.8' |
| 20 | + |
| 21 | + # Building/caching the environment |
| 22 | + |
| 23 | + - name: Add conda to system path |
| 24 | + run: | |
| 25 | + # $CONDA is an environment variable pointing to the root of the miniconda directory |
| 26 | + echo $CONDA |
| 27 | + echo $CONDA/bin >> $GITHUB_PATH |
| 28 | + echo $CONDA_PREFIX |
| 29 | +
|
| 30 | + - name: Cache conda env |
| 31 | + id: cache-conda |
| 32 | + uses: actions/cache@v4 |
| 33 | + env: |
| 34 | + # change name here (only) to invalidate cache |
| 35 | + cache-name: cache-conda-env-v0 |
| 36 | + with: |
| 37 | + key: ${{ env.cache-name }}-${{ hashFiles('pyproject.toml') }} |
| 38 | + path: ./ci_env |
| 39 | + |
| 40 | + - name: Create conda env & Install dependencies |
| 41 | + run: | |
| 42 | + sudo apt-get update |
| 43 | + sudo apt-get install rsync |
| 44 | + if [ ! -d "./ci_env" ]; then \ |
| 45 | + # creates the env if it does not exist (not loaded from cache) |
| 46 | + conda create -p ./ci_env python=3.10 ipython -y |
| 47 | + fi |
| 48 | + source activate ./ci_env |
| 49 | + pip install --progress-bar off --upgrade pip |
| 50 | + pip install --progress-bar off -U -e .[dev] |
| 51 | +
|
| 52 | + - name: Print installed packages |
| 53 | + run: | |
| 54 | + source activate ./ci_env |
| 55 | + pip freeze |
| 56 | +
|
| 57 | + # start checks |
| 58 | + |
| 59 | + - name: Test lint |
| 60 | + run: | |
| 61 | + source activate ./ci_env |
| 62 | + pip show mypy |
| 63 | + make use_venv=0 lint |
| 64 | +
|
| 65 | + - name: Test coverage |
| 66 | + run: | |
| 67 | + source activate ./ci_env |
| 68 | + make use_venv=0 test_coverage |
| 69 | +
|
| 70 | + - name: Test format |
| 71 | + run: | |
| 72 | + source activate ./ci_env |
| 73 | + make use_venv=0 format |
| 74 | +
|
| 75 | +
|
0 commit comments