-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (100 loc) · 3.25 KB
/
ci.yaml
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: CI
on:
pull_request:
paths-ignore:
- 'docs/**'
push:
branches:
- main
paths-ignore:
- 'docs/**'
# The goal here is to cancel older workflows when a PR is updated (because it's pointless work)
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
jobs:
unittest:
name: unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ".[test]"
- name: Create mock AWS credentials
run: |
mkdir ~/.aws && touch ~/.aws/credentials
echo -e "[test]\naws_access_key_id = test\naws_secret_access_key = test" > ~/.aws/credentials
- name: Test with pytest
run: |
python -m pytest --cov-report xml --cov=cumulus_library tests
- name: Log missing coverage
run: |
coverage report -m --skip-covered
- name: Generate coverage report
if: github.ref != 'refs/heads/main'
uses: orgoro/[email protected]
with:
coverageFile: coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}
thresholdAll: .9
thresholdNew: 1
thresholdModified: 1
lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install linters
run: |
python -m pip install --upgrade pip
pip install ".[dev]"
- name: Run sqlfluff on jinja templates
run: |
sqlfluff lint
- name: Run ruff
if: success() || failure() # still run ruff if above checks fails
run: |
ruff check
ruff format --check
regression:
runs-on: ubuntu-latest
permissions:
id-token: write # This is required for requesting the JWT
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
# See https://github.com/aws-actions/configure-aws-credentials for configuring
# the aws side of this - the below action is just a light wrapper
- name: Configure AWS Credentials
uses: mcblair/[email protected]
with:
role-arn: arn:aws:iam::${{secrets.AWS_ACCOUNT}}:role/cumulus-library-ci
region: us-east-1
profile-name: cumulus-library-ci
- name: Rebuild tables
env:
PROFILE: cumulus-library-ci
WG: cumulus
DB: cumulus_library_regression_db
run: |
cumulus-library build -t vocab -t core --profile $PROFILE --workgroup $WG --database $DB
cumulus-library export -t vocab -t core ./tests/regression/data_export/ --profile $PROFILE --workgroup $WG --database $DB
- name: Compare vs known data
run: python ./tests/regression/run_regression.py