-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (41 loc) · 1.53 KB
/
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
name: '[CI] Test'
on:
# Caches have a certain level of isolation, see https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache
# We run on push to main to have all caches in the main branch so that they can be reused for PRs.
push:
branches:
- main
merge_group:
pull_request:
# Cancel a previous job if the same workflow is triggers on the same PR or commit.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- uses: MyAlbum/purge-cache@881eb5957687193fa612bf74c0042adc78ea5e54 # v2
with:
max-age: 604800 # Leave only caches accessed in the last 7 days (default)
- uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1
id: cache-env
with:
path: |
./env
key: conda-env|${{ hashFiles('environment-dev.yml') }}
- name: Setup conda environment
if: steps.cache-env.outputs.cache-hit != 'true'
run: make setup
- name: Run static type check
run: make type-check
- name: Run tests
run: make test
- name: Report coverage
id: coverage
if: ${{ !cancelled() }}
uses: MishaKav/pytest-coverage-comment@fa1c641d7e3fa1d98ed95d5f658ccd638b774628 # v1.1.52
with:
title: Coverage Report
pytest-xml-coverage-path: ./coverage.xml