|
1 |
| -# This workflow is setup by Fei Zhang to use Github Actions 202-09-14 |
| 1 | +# This workflow is setup by Fei Zhang to use Github Actions 2020-09-14 |
| 2 | +# Updated by Melyn Roberts 2025 June to run tests using Anaconda3-2021.11 and Python and package versions designated in linux startup script |
2 | 3 |
|
3 | 4 | name: hiperseis_main_ci
|
4 | 5 |
|
|
8 | 9 | build:
|
9 | 10 |
|
10 | 11 | runs-on: ubuntu-latest
|
11 |
| - strategy: |
12 |
| - matrix: |
13 |
| - python-version: [3.6, 3.7, 3.8] |
14 | 12 |
|
15 | 13 | steps:
|
16 |
| - - uses: actions/checkout@v2 |
17 |
| - - name: Set up Python ${{ matrix.python-version }} |
18 |
| - uses: actions/setup-python@v2 |
| 14 | + - uses: actions/checkout@main |
| 15 | + - uses: awalsh128/cache-apt-pkgs-action@latest |
19 | 16 | with:
|
20 |
| - python-version: ${{ matrix.python-version }} |
| 17 | + packages: openmpi-bin libopenmpi-dev libhdf5-dev |
| 18 | + version: 1.0 |
| 19 | + - name: Cache dependencies |
| 20 | + id: cache-dependencies |
| 21 | + uses: actions/cache@main |
| 22 | + with: |
| 23 | + path: | |
| 24 | + /home/runner |
| 25 | + /usr/share/miniconda/envs/hiperseis |
| 26 | + key: anaconda |
| 27 | + - name: Setting up environment |
| 28 | + if: steps.cache-dependencies.outputs.cache-hit != 'true' |
| 29 | + run: | |
| 30 | + wget -q https://repo.anaconda.com/archive/Anaconda3-2021.11-Linux-x86_64.sh -O anaconda.sh |
| 31 | + bash anaconda.sh -b -p $HOME/anaconda3 > /dev/null 2>&1 |
| 32 | + export PATH="$HOME/anaconda3/bin:$PATH" |
| 33 | + conda init bash |
| 34 | + source ~/.bashrc |
21 | 35 | - name: Install dependencies
|
| 36 | + if: steps.cache-dependencies.outputs.cache-hit != 'true' |
22 | 37 | run: |
|
23 | 38 | git submodule update --init --recursive
|
24 |
| - sudo apt-get install libhdf5-dev |
25 |
| - sudo apt-get install libmpich-dev |
26 |
| - sudo apt-get install libproj-dev proj-bin |
27 |
| - sudo apt-get install libgeos-dev |
28 |
| - sudo apt-get install libnetcdf-dev |
29 |
| -
|
30 |
| - python -m pip install --upgrade pip |
31 |
| -
|
32 |
| - pip install numpy |
33 |
| - pip install Cython --install-option="--no-cython-compile" |
34 |
| - pip install flake8 pytest |
35 |
| - pip install pytest-cov |
36 |
| - pip install coveralls |
37 |
| - pip install pip-tools |
38 |
| - pip-compile --upgrade |
39 |
| -
|
40 |
| - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
41 |
| - pip install -r tests/requirements.txt |
42 |
| - pip list |
43 |
| -# - name: Lint with flake8 |
44 |
| -# run: | |
45 |
| -# # stop the build if there are Python syntax errors or undefined names |
46 |
| -# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
47 |
| -# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
48 |
| -# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
| 39 | + source setup_scripts/conda_env_linux.sh hiperseis |
49 | 40 | - name: Running pytest
|
50 | 41 | run: |
|
51 |
| - python -m pytest ./tests |
52 |
| -
|
| 42 | + eval "$(conda shell.bash hook)" |
| 43 | + conda init |
| 44 | + conda activate hiperseis |
| 45 | + pytest --cov --cov-report=xml ./tests |
| 46 | + - name: Upload coverage reports to Codecov |
| 47 | + uses: codecov/codecov-action@main |
| 48 | + with: |
| 49 | + token: ${{ secrets.CODECOV_TOKEN }} |
0 commit comments