hotfix sha1 in nightly conda packages as unsupported for now #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: common-build-publish-sofa-package | ||
on: | ||
workflow_call: | ||
inputs: | ||
package-name: | ||
required: true | ||
type: string | ||
runner: | ||
required: true | ||
type: string | ||
platform: | ||
required: true | ||
type: string | ||
python: | ||
required: false | ||
type: string | ||
is-nightly: | ||
required: false | ||
type: boolean | ||
version: | ||
required: false | ||
type: string | ||
git-ref: | ||
required: false | ||
type: string | ||
anaconda-channel: | ||
required: true | ||
type: string | ||
secrets: | ||
anaconda-token: | ||
required: true | ||
jobs: | ||
build-publish-sofa: | ||
name: "Build and publish ${{ inputs.package-name }} - ${{ inputs.platform }} (py${{ inputs.python }} ) conda packages on ${{ inputs.runner }}" | ||
runs-on: ${{ inputs.runner }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
# We force to use a conda env located close to filesystem root on Windows to bypass a compilation bug with SOFA | ||
# due to too long filename, even if LongPath registry key is enabled | ||
- name: Install miniconda [Windows] | ||
if: contains(inputs.runner, 'windows') | ||
uses: conda-incubator/setup-miniconda@v3 | ||
with: | ||
activate-environment: c:\so | ||
auto-update-conda: true | ||
miniforge-version: latest | ||
- name: Install miniconda [Linux & macOS] | ||
if: contains(inputs.runner, 'windows') == false | ||
uses: conda-incubator/setup-miniconda@v3 | ||
with: | ||
activate-environment: sofa-conda-ci | ||
auto-update-conda: true | ||
miniforge-version: latest | ||
- name: Install conda environment | ||
shell: bash -l {0} | ||
run: | | ||
conda install anaconda-client rattler-build=0.31.1 -c conda-forge | ||
conda config --set anaconda_upload no | ||
- name: Show conda config | ||
shell: bash -l {0} | ||
run: | | ||
conda info | ||
conda list | ||
conda config --show-sources | ||
conda config --show | ||
printenv | sort | ||
- name: Configuring recipe for build type | ||
shell: bash -l {0} | ||
run: | | ||
export SOFA_PACKAGE_VERSION="${{ inputs.version }}" | ||
export SOFA_PACKAGE_GIT_REF="${{ inputs.git-ref }}" | ||
if [ ${{ inputs.is-nightly }} = "true" ]; then | ||
# XXX Env var GIT_BUILD_STR not implemented yet in rattler-build. Can be replaced with | ||
# git_hash=$(git rev-parse --short "$GITHUB_SHA") | ||
# if this action workflow is moved on corresponding sofa software repository | ||
# Until then, we just suffix with nightly and the package hash | ||
# export SOFA_PACKAGE_BUILD_STRING="string: nightly_${{ '\${{' }} env.get(\"GIT_BUILD_STR\") ${{ '}}' }}" | ||
export SOFA_PACKAGE_BUILD_STRING="string: nightly_${{ '\${{' }} hash ${{ '}}' }}" | ||
echo $SOFA_PACKAGE_BUILD_STRING | ||
fi | ||
cd conda/recipes | ||
envsubst < ${{ inputs.package-name }}/recipe.yaml.in > ${{ inputs.package-name }}/recipe.yaml | ||
echo "Configured recipe.yaml:" | ||
cat ${{ inputs.package-name }}/recipe.yaml | ||
# Same remark here about too long filename bug on windows, we have to force the output directory accordingly on windows | ||
- name: Build & publish sofa conda package | ||
shell: bash -l {0} | ||
run: | | ||
conda info | ||
cd conda/recipes | ||
if [[ ${{ inputs.runner }} == "windows"* ]]; then | ||
PKG_DIR=c:/so/bld | ||
else | ||
PKG_DIR=../../../rattler-bld | ||
fi | ||
if [ ! -z "${{ inputs.python }}" ]; then | ||
rattler-build build --recipe ${{ inputs.package-name }}/recipe.yaml --variant-config ../configs/${{ inputs.platform }}.yaml ../configs/python-${{ inputs.python }}.yaml --output-dir $PKG_DIR --experimental -c conda-forge -c ${{ inputs.anaconda-channel }} | ||
else | ||
rattler-build build --recipe ${{ inputs.package-name }}/recipe.yaml --variant-config ../configs/${{ inputs.platform }}.yaml --output-dir $PKG_DIR --experimental -c conda-forge -c ${{ inputs.anaconda-channel }} | ||
fi | ||
anaconda -t ${{ secrets.anaconda-token }} upload -u ${{ inputs.anaconda-channel }} -l main $PKG_DIR/**/*${{ inputs.package-name }}*.conda --force |