Skip to content

Commit 788776b

Browse files
Merge pull request #23 from BikeNetKit/add_test_workflow
added test.yml for testing workflow
2 parents 538319e + 7f2dfce commit 788776b

1 file changed

Lines changed: 88 additions & 0 deletions

File tree

.github/workflows/test.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: # on all branches except `typos`
6+
- '**'
7+
- '!typos'
8+
paths-ignore:
9+
- 'docs/**'
10+
- 'examples/**'
11+
- 'data/**'
12+
- '.git*'
13+
- 'README.md'
14+
pull_request:
15+
branches:
16+
- '**'
17+
schedule: # Every Monday at 04:00 UTC
18+
- cron: '0 4 * * 1'
19+
20+
jobs:
21+
caching:
22+
strategy:
23+
matrix:
24+
python-version: ["3.12"]
25+
os: [ ubuntu-latest ]
26+
fail-fast: false
27+
env:
28+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
29+
30+
defaults:
31+
run:
32+
shell: bash -elo pipefail {0}
33+
34+
name: Cache for ${{ matrix.python-version }} on ${{ matrix.os }}
35+
runs-on: ${{ matrix.os }}
36+
steps:
37+
- uses: actions/checkout@v6
38+
39+
- name: Get week number
40+
run: echo "WEEK=$(date +'%V')" >> $GITHUB_ENV
41+
42+
- name: Set up Python ${{ matrix.python-version }}
43+
uses: mamba-org/setup-micromamba@v2
44+
with:
45+
create-args: python=${{ matrix.python-version }}
46+
environment-file: environment-dev.yml
47+
cache-environment: true
48+
cache-environment-key: W${{ env.WEEK }}
49+
50+
run-tests:
51+
needs: caching
52+
strategy:
53+
matrix:
54+
python-version: ["3.12"]
55+
os: [ ubuntu-latest ]
56+
submodule:
57+
- {
58+
name: "Functions",
59+
pytest_args: "tests/test_functions.py" }
60+
fail-fast: false
61+
62+
name: ${{ matrix.submodule.name }} (${{ matrix.python-version }} on ${{ matrix.os }})
63+
runs-on: ${{ matrix.os }}
64+
timeout-minutes: 60
65+
defaults:
66+
run:
67+
shell: bash -el {0}
68+
69+
steps:
70+
- uses: actions/checkout@v6
71+
72+
- name: Get week number
73+
run: echo "WEEK=$(date +'%V')" >> $GITHUB_ENV
74+
75+
- name: Set up Python ${{ matrix.python-version }}
76+
uses: mamba-org/setup-micromamba@v2
77+
with:
78+
create-args: python=${{ matrix.python-version }}
79+
environment-file: environment-dev.yml
80+
cache-environment: true
81+
cache-environment-key: W${{ env.WEEK }}
82+
83+
- name: Install fixbikenet
84+
run: pip install --no-build-isolation --no-deps -e .
85+
86+
- name: "Run tests ${{ matrix.submodule.name }}"
87+
run: |
88+
pytest ${{ matrix.submodule.pytest_args }}

0 commit comments

Comments
 (0)