From caba0500aa19835b0c5e517ed1908bad309b9477 Mon Sep 17 00:00:00 2001 From: Mauko Quiroga Date: Tue, 15 Oct 2024 14:49:26 +0200 Subject: [PATCH] ci: add test conda --- .conda/recipe.yaml | 5 +++++ .github/workflows/build.yml | 15 +++++++++------ .github/workflows/validate.yml | 28 ++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/.conda/recipe.yaml b/.conda/recipe.yaml index 126c822..83f8df6 100644 --- a/.conda/recipe.yaml +++ b/.conda/recipe.yaml @@ -14,6 +14,11 @@ source: build: noarch: python script: pip install . -v + files: + include: + - "**/*.py" + - "**/*.json" + - "**/*.yaml" requirements: host: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a0fa00c..7542a92 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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/rattler-build-action@v0.2.16 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 diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 56087b8..9c4f189 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -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 ]