-
Notifications
You must be signed in to change notification settings - Fork 1
111 lines (103 loc) · 4.09 KB
/
build_publish_package.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
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