Skip to content

Commit

Permalink
ci: add test conda
Browse files Browse the repository at this point in the history
  • Loading branch information
bonjourmauko committed Oct 15, 2024
1 parent 51f22e7 commit caba050
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .conda/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ source:
build:
noarch: python
script: pip install . -v
files:
include:
- "**/*.py"
- "**/*.json"
- "**/*.yaml"

requirements:
host:
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,18 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Cache build
uses: actions/cache@v4
with:
path: /tmp/conda-bld
key: build-conda-${{ hashFiles('.conda/recipe.yaml') }}-${{ github.sha }}
restore-keys: |
build-conda-${{ hashFiles('.conda/recipe.yaml') }}
build-conda-
- name: Build conda package
uses: prefix-dev/[email protected]
with:
build-args: --channel openfisca --channel conda-forge --output-dir /tmp/conda-bld
recipe-path: .conda/recipe.yaml
upload-artifact: false

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: openfisca_country_template
path: /tmp/conda-bld/**/*.conda
28 changes: 28 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,34 @@ jobs:

- run: make test

test-conda:
runs-on: ubuntu-22.04
needs: [ build ]
steps:
- uses: actions/checkout@v4

- name: Setup conda
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: openfisca
miniforge-version: latest
python-version: 3.9.12
use-mamba: true

- name: Restore build
uses: actions/cache@v4
with:
path: /tmp/conda-bld
key: build-conda-${{ hashFiles('.conda/recipe.yaml') }}-${{ github.sha }}

- name: Install package
shell: bash -l {0}
run: mamba install --channel file:///tmp/conda-bld --channel openfisca openfisca-country-template

- name: Test conda package
shell: bash -l {0}
run: openfisca test openfisca-country-template/tests

test-api:
runs-on: ubuntu-22.04
needs: [ build ]
Expand Down

0 comments on commit caba050

Please sign in to comment.