Skip to content

Commit 1389d1d

Browse files
authored
Merge pull request #83 from MiraGeoscience/DEVOPS-678
DEVOPS-678: use new Artifactory virtual channels in rattler recipe
2 parents a6b201a + 228e7a7 commit 1389d1d

11 files changed

Lines changed: 55 additions & 209 deletions

.github/workflows/reusable-jira-issue_to_jira.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ on:
2020
required: true
2121
type: string
2222
components:
23-
description: 'JIRA components (eg. [{"name": "geoh5py"}])'
23+
description: 'JIRA components (e.g. [{"name": "geoh5py"}])'
2424
required: false
2525
type: string
2626

.github/workflows/reusable-pre_commit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
required: false
99
type: string
1010
os:
11-
description: 'Matrix of OS to run against (eg. ["ubuntu-latest", "macos-latest"])'
11+
description: 'List of OS to run against (e.g. ["ubuntu-latest", "macos-latest"])'
1212
required: false
1313
type: string
1414
default: "['ubuntu-latest']"

.github/workflows/reusable-python-build_poetry_package.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
required: true
99
type: string
1010
python-version:
11-
description: 'Python version to use (eg: 3.10)'
11+
description: 'Python version to use (e.g. 3.10)'
1212
required: true
1313
type: string
1414
lfs:
@@ -20,13 +20,12 @@ on:
2020
description: 'Version tag of the package to build'
2121
required: true
2222
type: string
23-
2423
virtual-repo-names:
25-
description: 'Matrix of virtual repository names to publish on (eg. ["public-dev-pypi"])'
24+
description: 'List of repository names to publish on (e.g. ["public-dev-pypi"])'
2625
required: true
2726
type: string
2827
os:
29-
description: 'OS to build against (eg. "ubuntu-latest")'
28+
description: 'OS to build against (e.g. "ubuntu-latest")'
3029
required: true
3130
type: string
3231
timeout-minutes:

.github/workflows/reusable-python-build_setuptools_package.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
required: true
99
type: string
1010
python-version:
11-
description: 'Python version to use (eg: 3.10)'
11+
description: 'Python version to use (e.g. 3.10)'
1212
required: true
1313
type: string
1414
lfs:
@@ -20,13 +20,12 @@ on:
2020
description: 'Version tag of the package to build'
2121
required: true
2222
type: string
23-
2423
virtual-repo-names:
25-
description: 'Matrix of virtual repository names to publish on (eg. ["public-dev-pypi"])'
24+
description: 'List of repository names to publish on (e.g. ["public-dev-pypi"])'
2625
required: true
2726
type: string
2827
os:
29-
description: 'OS to build against (eg. "ubuntu-latest")'
28+
description: 'OS to build against (e.g. "ubuntu-latest")'
3029
required: true
3130
type: string
3231
timeout-minutes:

.github/workflows/reusable-python-publish_conda_package.yml

Lines changed: 0 additions & 162 deletions
This file was deleted.

.github/workflows/reusable-python-publish_pypi_package.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_call:
55
inputs:
66
package-manager:
7-
description: 'Name of the package manager (eg. "poetry")'
7+
description: 'Name of the package manager (e.g. "poetry")'
88
required: true
99
type: string
1010
default: 'poetry'
@@ -13,7 +13,7 @@ on:
1313
required: true
1414
type: string
1515
python-version:
16-
description: 'Python version to use (eg: 3.10)'
16+
description: 'Python version to use (e.g. 3.10)'
1717
required: true
1818
type: string
1919
lfs:
@@ -26,11 +26,11 @@ on:
2626
required: true
2727
type: string
2828
virtual-repo-names:
29-
description: 'Matrix of virtual repository names to publish on (eg. ["public-pypi-dev"])'
29+
description: 'List of virtual repository names to publish on (e.g. ["public-pypi-dev"])'
3030
required: true
3131
type: string
3232
os:
33-
description: 'OS to build against (eg. "ubuntu-latest")'
33+
description: 'OS to build against (e.g. "ubuntu-latest")'
3434
required: false
3535
type: string
3636
default: 'ubuntu-latest'

.github/workflows/reusable-python-publish_rattler_package.yml

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,28 @@ on:
88
required: true
99
type: string
1010
python-version:
11-
description: 'Python version to use (eg: 3.10)'
11+
description: 'Python version to use (e.g. 3.10)'
1212
required: true
1313
type: string
1414
lfs:
1515
description: 'Boolean to indicate if Github LFS is needed'
1616
required: false
1717
type: boolean
1818
default: true
19+
conda-channels:
20+
description: 'List of conda channels to pull from (e.g. ["conda-forge", "pytorch"])'
21+
required: true
22+
type: string
1923
source-repo-names:
20-
description: 'Matrix of repository names to publish on (eg. ["public-conda-dev-local", "conda-forge-dev-remote"])'
24+
description: 'List of repository names to pull from (e.g. ["geology-conda-dev", "geophysics-conda-dev"])'
2125
required: true
2226
type: string
2327
publish-repo-names:
24-
description: 'Matrix of virtual repository names to publish on (eg. ["public-conda-dev"])'
28+
description: 'List of repository names to publish on (e.g. ["public-conda-dev"])'
2529
required: true
2630
type: string
2731
os:
28-
description: 'OS to build against (eg. "ubuntu-latest")'
32+
description: 'OS to build against (e.g. "ubuntu-latest")'
2933
required: false
3034
type: string
3135
default: 'ubuntu-latest'
@@ -47,6 +51,11 @@ defaults:
4751
run:
4852
shell: 'bash -l {0}'
4953

54+
env:
55+
# cover for both conda and mamba
56+
CONDA_CHANNEL_ALIAS: https://repo.prefix.dev
57+
MAMBA_CHANNEL_ALIAS: https://repo.prefix.dev
58+
5059
jobs:
5160
build_rattler_package:
5261
name: Build package with rattler
@@ -67,31 +76,29 @@ jobs:
6776
echo "Rattler recipe not found"
6877
exit 1
6978
fi
70-
- name: Auths with JFrog channels
79+
- name: Configure channels and Auth
80+
id: config-channels
7181
run: |
72-
BUILDS_ARGS=""
82+
BUILD_ARGS=""
7383
RATTLER_AUTH_FILE=${{ runner.temp }}/credentials.json
7484
75-
repository_list=$(echo '${{ inputs.source-repo-names }}' | jq -r '.[]')
76-
repository_count=$(echo '${{ inputs.source-repo-names }}' | jq '. | length')
77-
78-
# Check if there is more than one element
79-
if [ "$repository_count" -ge 1 ]; then
85+
repository_list=$(echo '${{ inputs.source-repo-names }}' | jq -r '.[]' | xargs)
86+
if [ -n "$repository_list" ]; then
8087
echo '{"${{ secrets.JFROG_ARTIFACTORY_URL }}": {"BasicHTTP": {"username": "github", "password":"${{ secrets.JFROG_ARTIFACTORY_TOKEN }}"} } }' > "$RATTLER_AUTH_FILE"
81-
else
82-
BUILDS_ARGS=" --channel conda-forge"
8388
fi
89+
echo "RATTLER_AUTH_FILE=${RATTLER_AUTH_FILE}" >> "$GITHUB_ENV"
8490
8591
# Loop through the repository names and add them to the command
8692
for repo_name in ${repository_list}; do
87-
BUILDS_ARGS+=" --channel https://${{ secrets.JFROG_ARTIFACTORY_URL }}/artifactory/api/conda/${repo_name}"
93+
BUILD_ARGS+=" --channel https://${{ secrets.JFROG_ARTIFACTORY_URL }}/artifactory/api/conda/${repo_name}"
8894
done
8995
90-
BUILDS_ARGS+=" --output-dir ${{ runner.temp }}/output"
91-
BUILDS_ARGS+=" --channel-priority disabled"
96+
channel_list=$(echo '${{ inputs.conda-channels }}' | jq -r '.[]' | xargs)
97+
for channel_name in ${channel_list}; do
98+
BUILD_ARGS+=" --channel ${channel_name}"
99+
done
92100
93-
echo "RATTLER_AUTH_FILE=${RATTLER_AUTH_FILE}" >> "$GITHUB_ENV"
94-
echo "BUILDS_ARGS=$BUILDS_ARGS" >> "$GITHUB_ENV"
101+
echo "BUILD_ARGS=$BUILD_ARGS" >> "$GITHUB_OUTPUT"
95102
- name: Check RATTLER_AUTH_FILE content
96103
run: |
97104
echo "RATTLER_AUTH_FILE=${{ env.RATTLER_AUTH_FILE }}"
@@ -104,7 +111,10 @@ jobs:
104111
uses: prefix-dev/rattler-build-action@v0.2.32
105112
with:
106113
rattler-build-version: v0.34.1
107-
build-args: ${{ env.BUILDS_ARGS }}
114+
build-args: >-
115+
--output-dir ${{ runner.temp }}/output
116+
--channel-priority strict
117+
${{ steps.config-channels.outputs.BUILD_ARGS }}
108118
recipe-path: ${{ github.workspace}}/recipe.yaml
109119
env:
110120
RATTLER_AUTH_FILE: ${{ runner.temp }}/credentials.json
@@ -123,7 +133,7 @@ jobs:
123133
needs: build_rattler_package
124134
strategy:
125135
matrix:
126-
virtual-repo-name: ${{ fromJson(inputs.publish-repo-names) }}
136+
publish-repo-name: ${{ fromJson(inputs.publish-repo-names) }}
127137
steps:
128138
- name: Download build artifact
129139
uses: actions/download-artifact@v4
@@ -134,7 +144,7 @@ jobs:
134144
uses: MiraGeoscience/CI-tools/.github/actions/reusable-python-publish_to_artifactory@main
135145
with:
136146
build-dir-path: 'build-dir/noarch'
137-
artifactory-dir-path: ${{ matrix.virtual-repo-name}}/noarch
147+
artifactory-dir-path: ${{ matrix.publish-repo-name}}/noarch
138148
JFROG_ARTIFACTORY_URL: ${{ secrets.JFROG_ARTIFACTORY_URL }}
139149
JFROG_ARTIFACTORY_TOKEN: ${{ secrets.JFROG_ARTIFACTORY_TOKEN }}
140150
add_release_asset:

0 commit comments

Comments
 (0)