-
Notifications
You must be signed in to change notification settings - Fork 3
76 lines (59 loc) · 2.12 KB
/
linux-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Linux test
on: push
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}
strategy:
fail-fast: false
matrix:
python-version: [3.8]
steps:
- name: Checkout github repo
uses: actions/checkout@v2
- name: Cache conda
uses: actions/cache@v2
env:
cache-name: cache-conda-env
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-${{ env.cache-name }}-${{ hashFiles('environment.yml') }}
- name: Install package dependencies with setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
miniforge-variant: Mambaforge
channels: conda-forge
channel-priority: true
activate-environment: geoapis
environment-file: environment.yml
auto-activate-base: false
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
- run: |
conda info
conda list
conda config --show-sources
conda config --show
printenv | sort
- name: Install test dependencies
run: |
mamba install flake8 pytest
- name: Create .env file with API keys
env:
ENV_BASE64: ${{ secrets.ENV_BASE64 }}
run: |
echo import .env file contents stored in a GitHub secret and regenerate the expected .env file
echo $ENV_BASE64 | base64 -d > .env
- name: Run lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Run tests with pytest
run: |
pytest