diff --git a/.github/workflows/rattler-build.yml b/.github/workflows/rattler-build.yml new file mode 100644 index 0000000000000..e435a7eee2314 --- /dev/null +++ b/.github/workflows/rattler-build.yml @@ -0,0 +1,75 @@ +on: + pull_request: + branches: main + paths: + - recipes/*/recipe.yaml + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + name: Build (${{ matrix.target }}) + runs-on: ${{ matrix.host }} + strategy: + matrix: + include: + - { target: win-64, host: windows-latest } + - { target: linux-64, host: ubuntu-latest } + - { target: osx-64, host: macos-latest } + + steps: + - name: Generate rattler-build URL + shell: bash + id: url + run: | + arch=$(uname -m) + if [ "$arch" = "arm64" ]; then + arch="aarch64" + fi + platform=${{ runner.os == 'macOS' && 'apple-darwin' || '' }}${{ runner.os == 'Linux' && 'unknown-linux-musl' || '' }}${{ runner.os == 'Windows' && 'pc-windows-msvc' || '' }} + url="https://github.com/prefix-dev/rattler-build/releases/latest/download/rattler-build-$arch-$platform${{ runner.os == 'Windows' && '.exe' || '' }}" + echo "url=$url" >> $GITHUB_OUTPUT + - name: Install rattler-build (Unix) + shell: bash + if: ${{ runner.os != 'Windows' }} + run: | + mkdir -p ${{ runner.temp }}/rattler-build + curl -Ls \ + ${{ steps.url.outputs.url }} \ + -o ${{ runner.temp }}/rattler-build/rattler-build + chmod +x ${{ runner.temp }}/rattler-build/rattler-build + echo ${{ runner.temp }}/rattler-build >> $GITHUB_PATH + - name: Install rattler-build (Windows) + shell: powershell + if: ${{ runner.os == 'Windows' }} + run: | + New-Item -ItemType Directory -Path "${{ runner.temp }}\rattler-build" -Force + Invoke-WebRequest -Uri "${{ steps.url.outputs.url }}" -OutFile "${{ runner.temp }}\rattler-build\rattler-build.exe" + Add-Content -Path $env:GITHUB_PATH -Value "${{ runner.temp }}\rattler-build" + - name: Build conda package (non-Windows) + shell: bash + if: ${{ runner.os != 'Windows' }} + run: | + rattler-build build --recipe-dir recipes + env: + RATTLER_BUILD_ENABLE_GITHUB_INTEGRATION: 'true' + RATTLER_BUILD_COLOR: 'always' + - name: Build conda package (Windows) + shell: powershell + if: ${{ runner.os == 'Windows' }} + run: | + rattler-build build --recipe-dir recipes + env: + RATTLER_BUILD_ENABLE_GITHUB_INTEGRATION: 'true' + RATTLER_BUILD_COLOR: 'always' + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + # if: ${{ inputs.upload-artifact == 'true' }} + with: + name: ${{ matrix.target }} + path: | + output/**/*.tar.bz2 + output/**/*.conda +