diff --git a/.conda/recipe.yaml b/.conda/recipe.yaml index 126c822..77cbd5c 100644 --- a/.conda/recipe.yaml +++ b/.conda/recipe.yaml @@ -14,6 +14,14 @@ source: build: noarch: python script: pip install . -v + files: + include: + - "**/*.py" + - "**/*.json" + - "**/*.yaml" + python: + entry_points: + - openfisca = openfisca_core.scripts.openfisca_command:main 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..4409ddf 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -55,6 +55,33 @@ 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 + 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 ]