Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add test matrix #1234

Merged
merged 11 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
directory: /
schedule:
interval: monthly
labels:
Expand Down
4 changes: 0 additions & 4 deletions .github/publish-git-tag.sh

This file was deleted.

108 changes: 108 additions & 0 deletions .github/workflows/_before.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: Setup package

on:
workflow_call:
inputs:
os:
required: true
type: string

numpy:
required: true
type: string

python:
required: true
type: string

activate_command:
required: true
type: string

jobs:
deps:
runs-on: ${{ inputs.os }}
name: deps-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}
env:
# To colorize output of make tasks.
TERM: xterm-256color

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python }}

- name: Use zstd for faster cache restore (windows)
if: ${{ startsWith(inputs.os, 'windows') }}
shell: cmd
run: echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"

- name: Cache dependencies
id: restore-deps
uses: actions/cache@v4
with:
path: venv
key: deps-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{
hashFiles('setup.py') }}
restore-keys: deps-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python
}}-

- name: Install dependencies
run: |
python -m venv venv
${{ inputs.activate_command }}
make install-deps install-dist

build:
runs-on: ${{ inputs.os }}
needs: [deps]
name: build-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}
env:
TERM: xterm-256color

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python }}

- name: Use zstd for faster cache restore (windows)
if: ${{ startsWith(inputs.os, 'windows') }}
shell: cmd
run: echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"

- name: Cache dependencies
uses: actions/cache@v4
with:
path: venv
key: deps-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{
hashFiles('setup.py') }}

- name: Cache build
uses: actions/cache@v4
with:
path: venv/**/[Oo]pen[Ff]isca*
key: build-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{
hashFiles('setup.py') }}-${{ github.sha }}
restore-keys: |
build-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{ hashFiles('setup.py') }}-
build-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-

- name: Cache release
uses: actions/cache@v4
with:
path: dist
key: release-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{
hashFiles('setup.py') }}-${{ github.sha }}

- name: Build package
run: |
${{ inputs.activate_command }}
make install-test clean build
58 changes: 58 additions & 0 deletions .github/workflows/_lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Lint package

on:
workflow_call:
inputs:
os:
required: true
type: string

numpy:
required: true
type: string

python:
required: true
type: string

activate_command:
required: true
type: string

jobs:
lint:
runs-on: ${{ inputs.os }}
name: lint-doc-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}
env:
TERM: xterm-256color # To colorize output of make tasks.

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python }}

- name: Use zstd for faster cache restore (windows)
if: ${{ startsWith(inputs.os, 'windows') }}
shell: cmd
run: echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"

- name: Cache dependencies
uses: actions/cache@v4
with:
path: venv
key: deps-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{
hashFiles('setup.py') }}

- name: Lint doc
run: |
${{ inputs.activate_command }}
make clean check-syntax-errors lint-doc

- name: Lint styles
run: |
${{ inputs.activate_command }}
make clean check-syntax-errors check-style
74 changes: 74 additions & 0 deletions .github/workflows/_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Test package

on:
workflow_call:
inputs:
os:
required: true
type: string

numpy:
required: true
type: string

python:
required: true
type: string

activate_command:
required: true
type: string

jobs:
test:
runs-on: ${{ inputs.os }}
name: test-core-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TERM: xterm-256color # To colorize output of make tasks.

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python }}

- name: Use zstd for faster cache restore (windows)
if: ${{ startsWith(inputs.os, 'windows') }}
shell: cmd
run: echo C:\Program Files\Git\usr\bin>>"%GITHUB_PATH%"

- name: Cache dependencies
uses: actions/cache@v4
with:
path: venv
key: deps-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{
hashFiles('setup.py') }}

- name: Cache build
uses: actions/cache@v4
with:
path: venv/**/[Oo]pen[Ff]isca*
key: build-${{ inputs.os }}-np${{ inputs.numpy }}-py${{ inputs.python }}-${{
hashFiles('setup.py') }}-${{ github.sha }}

- name: Run Openfisca Core tests
run: |
${{ inputs.activate_command }}
make test-core
python -m coveralls --service=github

- name: Run Country Template tests
if: ${{ startsWith(inputs.os, 'ubuntu') }}
run: |
${{ inputs.activate_command }}
make test-country

- name: Run Extension Template tests
if: ${{ startsWith(inputs.os, 'ubuntu') }}
run: |
${{ inputs.activate_command }}
make test-extension
Loading
Loading