ci: split building, aggregating and uploading in separate jobs #10
Workflow file for this run
This file contains hidden or 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
on: | |
push: | |
# Run full workflow on tags | |
tags: | |
- "pixi-build-cmake-v[0-9]+.[0-9]+.[0-9]+" | |
- "pixi-build-python-v[0-9]+.[0-9]+.[0-9]+" | |
- "pixi-build-rattler-build-v[0-9]+.[0-9]+.[0-9]+" | |
- "pixi-build-rust-v[0-9]+.[0-9]+.[0-9]+" | |
# Build all backends on main branch | |
branches: [main] | |
pull_request: | |
workflow_dispatch: | |
name: "Conda Packages" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref_name }} | |
cancel-in-progress: true | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
generate-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set_version.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- uses: prefix-dev/setup-pixi@19eac09b398e3d0c747adc7921926a6d802df4da # v0.8.8 | |
- name: Extract versions | |
id: set_version | |
run: | | |
# extract names and versions from cargo metadata | |
# and generate a matrix entries for the build job | |
MATRIX_JSON=$(pixi run generate-matrix) | |
echo "Generated matrix: $MATRIX_JSON" | |
echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT | |
build: | |
needs: generate-matrix | |
env: | |
REPO_NAME: "prefix-dev/pixi-build-backends" | |
strategy: | |
matrix: | |
bins: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }} | |
fail-fast: false | |
runs-on: ${{ matrix.bins.os }} | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- uses: prefix-dev/setup-pixi@19eac09b398e3d0c747adc7921926a6d802df4da # v0.8.8 | |
with: | |
environments: build | |
- name: Enable long paths (Windows) | |
if: ${{ matrix.bins.os == 'windows-latest' }} | |
run: | | |
git config --global core.longpaths true | |
shell: bash | |
- name: Set environment variable for recipe version | |
shell: bash | |
run: | | |
echo "${{ matrix.bins.env_name }}=${{ matrix.bins.version }}" >> $GITHUB_ENV | |
- name: Build ${{ matrix.bins.bin }} | |
shell: bash | |
env: | |
RATTLER_BUILD_ENABLE_GITHUB_INTEGRATION: "true" | |
RATTLER_BUILD_COLOR: "always" | |
run: | | |
pixi run build-recipe-ci $RUNNER_TEMP recipe/${{ matrix.bins.bin }}.yaml ${{ matrix.bins.target }} | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
with: | |
name: conda-packages-${{ matrix.bins.bin }}-${{ matrix.bins.target }} | |
path: ${{ runner.temp }}/**/*.conda | |
aggregate: | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
target: [linux-64, linux-aarch64, linux-ppc64le, win-64, osx-64, osx-arm64] | |
steps: | |
- name: Download conda package artifacts for ${{ matrix.target }} | |
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 | |
with: | |
pattern: conda-packages-*-${{ matrix.target }} | |
path: conda-artifacts-${{ matrix.target }} | |
merge-multiple: true | |
- name: Upload aggregated conda packages for ${{ matrix.target }} | |
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
with: | |
name: conda-packages-${{ matrix.target }} | |
path: conda-artifacts-${{ matrix.target }}/**/*.conda | |
upload: | |
needs: aggregate | |
runs-on: ubuntu-latest | |
if: ${{ startsWith(github.ref, 'refs/tags') && github.repository == 'prefix-dev/pixi-build-backends' }} | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- name: Download all conda packages | |
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 | |
with: | |
pattern: conda-packages-* | |
path: conda-packages | |
merge-multiple: true | |
- uses: prefix-dev/setup-pixi@ba3bb36eb2066252b2363392b7739741bb777659 # v0.8.1 | |
with: | |
environments: build | |
- name: Upload packages | |
shell: bash | |
run: | | |
for file in conda-packages/*.conda; do | |
echo "Uploading ${file}" | |
pixi run -e build rattler-build upload prefix -c pixi-build-backends "$file" | |
done |