-
Notifications
You must be signed in to change notification settings - Fork 101
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
Fix conda upload #2374
Fix conda upload #2374
Changes from all commits
394a958
ed4b047
cfbf87a
ed93f12
b91d572
09147e4
5be45e8
a59a5ac
dc9ae44
2f645d1
426a3a1
dd809e2
b93e95f
c7edbb9
998e14c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,64 +44,53 @@ jobs: | |
key: release-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-${{ github.sha }}-${{ matrix.os }}-${{ matrix.openfisca-dependencies }} | ||
|
||
build-conda: | ||
runs-on: ubuntu-22.04 | ||
runs-on: windows-latest | ||
steps: | ||
- 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- | ||
path: ${{ runner.temp }}\conda-bld | ||
key: build-conda-${{ hashFiles('pyproject.toml') }}-${{ github.sha }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❤️ Pour la source unique qu'est pyproject.toml maniement pour l'information sur les dépendances. |
||
- name: set version | ||
run: | | ||
python3 .github/pyproject_version.py --replace True | ||
- name: Build conda package | ||
uses: prefix-dev/[email protected] | ||
with: | ||
build-args: --channel openfisca --channel conda-forge --output-dir /tmp/conda-bld | ||
build-args: --channel openfisca --channel conda-forge --output-dir ${{ runner.temp }}\conda-bld | ||
recipe-path: .conda/recipe.yaml | ||
upload-artifact: false | ||
- name: Upload Conda build | ||
sandcha marked this conversation as resolved.
Show resolved
Hide resolved
|
||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: conda-build-${{ env.PACKAGE_VERSION }}-${{ github.sha }} | ||
path: /tmp/conda-bld | ||
retention-days: 30 | ||
|
||
test-conda: | ||
runs-on: ubuntu-22.04 | ||
runs-on: windows-latest | ||
needs: [ build-conda ] | ||
steps: | ||
# Checkout needed to get github.sha | ||
- 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 }} | ||
|
||
path: ${{ runner.temp }}\conda-bld | ||
key: build-conda-${{ hashFiles('pyproject.toml') }}-${{ github.sha }} | ||
fail-on-cache-miss: true | ||
- name: Install package | ||
# `bash -l {0}` démarre un login shell avec les variables d'environnement | ||
# voir https://github.com/conda-incubator/setup-miniconda/issues/128 | ||
shell: bash -l {0} | ||
run: mamba install --channel file:///tmp/conda-bld --channel openfisca openfisca-france | ||
|
||
run: mamba install --channel file:///${RUNNER_TEMP//\\//}/conda-bld --channel openfisca openfisca-france | ||
- name: Test conda package | ||
shell: bash -l {0} | ||
run: openfisca test tests/formulas/irpp.yaml | ||
sandcha marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
|
||
lint-files: | ||
runs-on: ubuntu-20.04 | ||
strategy: | ||
|
@@ -223,35 +212,32 @@ jobs: | |
run: "${GITHUB_WORKSPACE}/.github/test-api.sh" | ||
|
||
test-on-windows: | ||
runs-on: "windows-latest" | ||
runs-on: windows-latest | ||
if: github.ref == 'refs/heads/master' # Only triggered for the `master` branch | ||
needs: [ build-conda ] | ||
needs: [ test-conda ] | ||
steps: | ||
# Checkout needed to get github.sha | ||
- uses: actions/checkout@v4 | ||
- uses: conda-incubator/setup-miniconda@v3 | ||
with: | ||
auto-update-conda: true | ||
python-version: "3.9.9" | ||
# Add conda-forge for OpenFisca-Core | ||
channels: openfisca,conda-forge | ||
activate-environment: true | ||
- uses: actions/checkout@v4 | ||
activate-environment: openfisca | ||
miniforge-version: latest | ||
python-version: 3.10.6 | ||
use-mamba: true | ||
sandcha marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- name: Restore build | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ runner.temp }}\conda-bld | ||
key: build-conda-${{ hashFiles('pyproject.toml') }}-${{ github.sha }} | ||
fail-on-cache-miss: true | ||
- name: Test max path length | ||
run: "python3 openfisca_france/scripts/check_path_length.py" | ||
- name: Get version | ||
run: | | ||
# chcp 65001 #set code page to utf-8 | ||
echo ("PACKAGE_VERSION=" + (python3 ./setup.py --version) ) >> $env:GITHUB_ENV | ||
echo "Version setup.py: ${{ env.PACKAGE_VERSION }}" | ||
- name: Download conda build | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: conda-build-${{ env.PACKAGE_VERSION }}-${{ github.sha }} | ||
path: conda-build-tmp | ||
- name: Install with conda | ||
run: | | ||
conda install -c ./conda-build-tmp/noarch/openfisca-france-dev-${{ env.PACKAGE_VERSION }}-py_0.tar.bz2 openfisca-france-dev | ||
- name: openfisca test | ||
run: openfisca test --country-package openfisca_france tests | ||
- name: Install package | ||
shell: bash -l {0} | ||
sandcha marked this conversation as resolved.
Show resolved
Hide resolved
|
||
run: mamba install --channel file:///${RUNNER_TEMP//\\//}/conda-bld --channel openfisca openfisca-france | ||
- name: Test conda package | ||
shell: bash -l {0} | ||
run: openfisca test tests/formulas/irpp.yaml | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pourquoi réduisons-nous à un seul test ? Dans le passé, les tests permettaient de relever les erreurs de chemins de paramètres trop longs sous Windows qui pouvaient survenir à n'importe quel endroit modifié par une PR. Considérons-nous que There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. C'est un problème de temps de CI : tout tester prend 1 heure. On pourrait aussi mettre des tests sous forme de matrice. Cependant vu que nous ne savons pas s'il y a des utilisateurs des paquets conda, il ne semble pas nécessaire de gêner les contributeurs avec des tests supplémentaires. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bilan, pour détecter les erreurs sur Windows de :
|
||
|
||
check-version-and-changelog: | ||
runs-on: ubuntu-20.04 | ||
|
@@ -323,32 +309,30 @@ jobs: | |
run: "${GITHUB_WORKSPACE}/.github/publish-git-tag.sh" | ||
|
||
publish-to-conda: | ||
runs-on: "ubuntu-20.04" | ||
runs-on: windows-latest | ||
needs: [ deploy, test-on-windows ] | ||
steps: | ||
- uses: conda-incubator/setup-miniconda@v3 | ||
- uses: actions/checkout@v4 | ||
- name: Restore build | ||
uses: actions/cache@v4 | ||
with: | ||
auto-update-conda: true | ||
python-version: "3.9.9" | ||
# Add conda-forge for OpenFisca-Core | ||
channels: conda-forge | ||
activate-environment: true | ||
- name: Get source code | ||
uses: actions/checkout@v4 | ||
- name: Get version | ||
run: echo "PACKAGE_VERSION=$(python3 ./pyproject.toml --version)" >> $GITHUB_ENV | ||
# Get the last commit hash on the PR (-2 : before the merge commit) | ||
- uses: actions/github-script@v6 | ||
id: last_pr_commit | ||
path: ${{ runner.temp }}\conda-bld | ||
key: build-conda-${{ hashFiles('pyproject.toml') }}-${{ github.sha }} | ||
fail-on-cache-miss: true | ||
- uses: conda-incubator/setup-miniconda@v3 | ||
with: | ||
script: | | ||
const commits = ${{ toJSON(github.event.commits) }} | ||
return commits.at(-2).id; | ||
result-encoding: string | ||
- name: Conda build and upload | ||
# This shell is made necessary by https://github.com/conda-incubator/setup-miniconda/issues/128 | ||
activate-environment: openfisca | ||
miniforge-version: latest | ||
python-version: 3.10.6 | ||
use-mamba: true | ||
- name: Install package | ||
shell: bash -l {0} | ||
run: mamba install --channel file:///${RUNNER_TEMP//\\//}/conda-bld --channel openfisca openfisca-france | ||
- name: Test conda package | ||
shell: bash -l {0} | ||
run: openfisca test tests/formulas/irpp.yaml | ||
- name: Conda upload already built package | ||
shell: bash -l {0} | ||
run: | | ||
conda install --yes conda-build anaconda-client | ||
conda config --set anaconda_upload yes | ||
conda build --channel conda-forge --channel openfisca --token ${{ secrets.ANACONDA_TOKEN }} --user openfisca .conda | ||
conda install --yes anaconda-client | ||
anaconda -t ${{ secrets.ANACONDA_TOKEN }} upload --user openfisca ${{ runner.temp }}\conda-bld\noarch\openfisca-france-* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.