Skip to content

Commit 0c3544a

Browse files
authored
ci: add test matrix (#1234)
2 parents 1e894f4 + 2f7da3f commit 0c3544a

File tree

14 files changed

+637
-345
lines changed

14 files changed

+637
-345
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 2
22
updates:
33
- package-ecosystem: pip
4-
directory: "/"
4+
directory: /
55
schedule:
66
interval: monthly
77
labels:

.github/publish-git-tag.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

.github/workflows/_before.yaml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: Setup package
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
os:
7+
required: true
8+
type: string
9+
10+
numpy:
11+
required: true
12+
type: string
13+
14+
python:
15+
required: true
16+
type: string
17+
18+
activate_command:
19+
required: true
20+
type: string
21+
22+
jobs:
23+
deps:
24+
runs-on: ${{ inputs.os }}
25+
name: deps-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}
26+
env:
27+
# To colorize output of make tasks.
28+
TERM: xterm-256color
29+
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
34+
- name: Set up Python
35+
uses: actions/setup-python@v5
36+
with:
37+
python-version: ${{ inputs.python }}
38+
39+
- name: Use zstd for faster cache restore (windows)
40+
if: ${{ startsWith(inputs.os, 'windows') }}
41+
shell: cmd
42+
run: echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"
43+
44+
- name: Cache dependencies
45+
id: restore-deps
46+
uses: actions/cache@v4
47+
with:
48+
path: venv
49+
key: deps-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{
50+
hashFiles('setup.py') }}
51+
restore-keys: deps-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python
52+
}}-
53+
54+
- name: Install dependencies
55+
run: |
56+
python -m venv venv
57+
${{ inputs.activate_command }}
58+
make install-deps install-dist
59+
60+
build:
61+
runs-on: ${{ inputs.os }}
62+
needs: [deps]
63+
name: build-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}
64+
env:
65+
TERM: xterm-256color
66+
67+
steps:
68+
- name: Checkout
69+
uses: actions/checkout@v4
70+
71+
- name: Set up Python
72+
uses: actions/setup-python@v5
73+
with:
74+
python-version: ${{ inputs.python }}
75+
76+
- name: Use zstd for faster cache restore (windows)
77+
if: ${{ startsWith(inputs.os, 'windows') }}
78+
shell: cmd
79+
run: echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"
80+
81+
- name: Cache dependencies
82+
uses: actions/cache@v4
83+
with:
84+
path: venv
85+
key: deps-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{
86+
hashFiles('setup.py') }}
87+
88+
- name: Cache build
89+
uses: actions/cache@v4
90+
with:
91+
path: venv/**/[Oo]pen[Ff]isca*
92+
key: build-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{
93+
hashFiles('setup.py') }}-${{ github.sha }}
94+
restore-keys: |
95+
build-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{ hashFiles('setup.py') }}-
96+
build-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-
97+
98+
- name: Cache release
99+
uses: actions/cache@v4
100+
with:
101+
path: dist
102+
key: release-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{
103+
hashFiles('setup.py') }}-${{ github.sha }}
104+
105+
- name: Build package
106+
run: |
107+
${{ inputs.activate_command }}
108+
make install-test clean build

.github/workflows/_lint.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Lint package
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
os:
7+
required: true
8+
type: string
9+
10+
numpy:
11+
required: true
12+
type: string
13+
14+
python:
15+
required: true
16+
type: string
17+
18+
activate_command:
19+
required: true
20+
type: string
21+
22+
jobs:
23+
lint:
24+
runs-on: ${{ inputs.os }}
25+
name: lint-doc-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}
26+
env:
27+
TERM: xterm-256color # To colorize output of make tasks.
28+
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
33+
- name: Set up Python
34+
uses: actions/setup-python@v5
35+
with:
36+
python-version: ${{ inputs.python }}
37+
38+
- name: Use zstd for faster cache restore (windows)
39+
if: ${{ startsWith(inputs.os, 'windows') }}
40+
shell: cmd
41+
run: echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"
42+
43+
- name: Cache dependencies
44+
uses: actions/cache@v4
45+
with:
46+
path: venv
47+
key: deps-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{
48+
hashFiles('setup.py') }}
49+
50+
- name: Lint doc
51+
run: |
52+
${{ inputs.activate_command }}
53+
make clean check-syntax-errors lint-doc
54+
55+
- name: Lint styles
56+
run: |
57+
${{ inputs.activate_command }}
58+
make clean check-syntax-errors check-style

.github/workflows/_test.yaml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Test package
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
os:
7+
required: true
8+
type: string
9+
10+
numpy:
11+
required: true
12+
type: string
13+
14+
python:
15+
required: true
16+
type: string
17+
18+
activate_command:
19+
required: true
20+
type: string
21+
22+
jobs:
23+
test:
24+
runs-on: ${{ inputs.os }}
25+
name: test-core-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
TERM: xterm-256color # To colorize output of make tasks.
29+
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
34+
- name: Set up Python
35+
uses: actions/setup-python@v5
36+
with:
37+
python-version: ${{ inputs.python }}
38+
39+
- name: Use zstd for faster cache restore (windows)
40+
if: ${{ startsWith(inputs.os, 'windows') }}
41+
shell: cmd
42+
run: echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"
43+
44+
- name: Cache dependencies
45+
uses: actions/cache@v4
46+
with:
47+
path: venv
48+
key: deps-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{
49+
hashFiles('setup.py') }}
50+
51+
- name: Cache build
52+
uses: actions/cache@v4
53+
with:
54+
path: venv/**/[Oo]pen[Ff]isca*
55+
key: build-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{
56+
hashFiles('setup.py') }}-${{ github.sha }}
57+
58+
- name: Run Openfisca Core tests
59+
run: |
60+
${{ inputs.activate_command }}
61+
make test-core
62+
python -m coveralls --service=github
63+
64+
- name: Run Country Template tests
65+
if: ${{ startsWith(inputs.os, 'ubuntu') }}
66+
run: |
67+
${{ inputs.activate_command }}
68+
make test-country
69+
70+
- name: Run Extension Template tests
71+
if: ${{ startsWith(inputs.os, 'ubuntu') }}
72+
run: |
73+
${{ inputs.activate_command }}
74+
make test-extension

0 commit comments

Comments
 (0)