diff --git a/.github/check-for-additional-platforms.sh b/.github/check-for-additional-platforms.sh new file mode 100755 index 0000000000000..26bf85a38e7a8 --- /dev/null +++ b/.github/check-for-additional-platforms.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +# Check to see if any changed recipes have specified the key +# extra:additional-platforms, and if so, if they match the platform of the +# currently-running machine. + +# arguments +git_range=$1 +job_name=$2 + +# Download ARM version of yq +yq_platform=$(uname) +yq_arch=$(uname -m) +[[ $yq_arch = "aarch64" ]] && yq_arch="arm64" +mkdir -p ${HOME}/bin +wget https://github.com/mikefarah/yq/releases/latest/download/yq_${yq_platform}_${yq_arch} -O ${HOME}/bin/yq +chmod +x ${HOME}/bin/yq + +# Find recipes changed from this merge +files=`git diff --name-only --diff-filter AMR ${git_range} | grep -E 'meta.yaml$' ` +build=0 + +for file in $files; do + echo $file + # To create a properly-formatted yaml that yq can parse, comment out jinja2 + # variable setting with {% %} and remove variable use with {{ }}. + additional_platforms=$(cat $file \ + | sed -E 's/(.*)\{%(.*)%\}(.*)/# \1\2\3/g' \ + | tr -d '{{' | tr -d '}}' \ + | ${HOME}/bin/yq '.extra.additional-platforms[]') + # Check if any additional platforms match this job + for additional_platform in $additional_platforms; do + if [ "${GITHUB_JOB}" = "${job_name}-${additional_platform}" ] + then + echo "Found at least one recipe for ${job_name}-${additional_platform}" + build=1 + break + fi + done +done + +# If no changed recipes apply to this platform, skip remaining steps +if [[ build -lt 1 ]] +then + echo "No recipes using this platform, skipping rest of job." + echo "skip_build=true" >> $GITHUB_OUTPUT +fi diff --git a/.github/workflows/PR-arm.yml b/.github/workflows/PR-arm.yml index a277e0f128399..3895d041819f8 100644 --- a/.github/workflows/PR-arm.yml +++ b/.github/workflows/PR-arm.yml @@ -6,8 +6,8 @@ concurrency: group: build-${{ github.event.pull_request.number || github.head_ref }} cancel-in-progress: true jobs: - build-osx-arm: - name: osx-arm64 Tests + build_and_test-osx-arm64: + name: build_and_test-osx-arm64 runs-on: macOS-14 # M1 strategy: fail-fast: true @@ -17,39 +17,29 @@ jobs: with: fetch-depth: 0 - # TODO: bail if there's no osx-arm64 recipes - # - run: - # name: Check for Additional Platforms - # command: ./.circleci/check-for-additional-platforms.sh "origin/master...HEAD" "build_and_test" + # bail if there's no osx-arm64 recipes + - name: Check for Additional Platforms + id: additional_platforms + run: ./.github/check-for-additional-platforms.sh "origin/master...HEAD" "build_and_test" - name: set path run: echo "/opt/mambaforge/bin" >> $GITHUB_PATH - name: Fetch conda install script + if: steps.additional_platforms.outputs.skip_build != 'true' run: | wget https://raw.githubusercontent.com/bioconda/bioconda-common/master/{install-and-set-up-conda,configure-conda,common}.sh - - name: Restore cache - id: cache - uses: actions/cache@v4 - with: - path: /opt/mambaforge - key: ${{ runner.os }}--master--${{ hashFiles('install-and-set-up-conda.sh', 'common.sh', 'configure-conda.sh') }} - - name: Set up bioconda-utils - if: steps.cache.outputs.cache-hit != 'true' + if: steps.additional_platforms.outputs.skip_build != 'true' run: bash install-and-set-up-conda.sh - # This script can be used to reconfigure conda to use the right channel setup. - # This has to be done after the cache is restored, because - # the channel setup is not cached as it resides in the home directory. - # We could use a system-wide (and therefore cached) channel setup, - # but mamba does not support that at the time of implementation - # (it ignores settings made with --system). - name: Configure conda + if: steps.additional_platforms.outputs.skip_build != 'true' run: bash configure-conda.sh - name: Build and Test + if: steps.additional_platforms.outputs.skip_build != 'true' env: # Mimic circleci OSTYPE: "darwin" @@ -78,6 +68,7 @@ jobs: --git-range origin/"$GITHUB_BASE_REF" HEAD - name: Prepare artifacts + if: steps.additional_platforms.outputs.skip_build != 'true' run: | ( rm -rf /tmp/artifacts @@ -90,6 +81,7 @@ jobs: ) || true - name: Archive packages + if: steps.additional_platforms.outputs.skip_build != 'true' uses: actions/upload-artifact@v4 with: name: osx-arm64-packages diff --git a/.github/workflows/master-arm.yml b/.github/workflows/master-arm.yml index 2b3a284371e1a..651423753b1a1 100644 --- a/.github/workflows/master-arm.yml +++ b/.github/workflows/master-arm.yml @@ -5,8 +5,8 @@ on: - target-for-arm-osx jobs: - build-upload-osx-arm: - name: osx-arm64 Upload + build_and_upload-osx-arm64: + name: build_and_upload-osx-arm64 if: github.repository == 'bioconda/bioconda-recipes' runs-on: macOS-14 # M1 strategy: @@ -17,39 +17,30 @@ jobs: with: fetch-depth: 0 - # TODO: bail if there's no osx-arm64 recipes - # - run: - # name: Check for Additional Platforms - # command: ./.circleci/check-for-additional-platforms.sh "${CIRCLE_SHA1}~1 ${CIRCLE_SHA1}" "build_and_upload" + # bail if there's no osx-arm64 recipes + - name: Check for Additional Platforms + id: additional_platforms + run: ./.github/check-for-additional-platforms.sh "${GITHUB_SHA}~1 ${GITHUB_SHA}" "build_and_upload" - name: set path - run: echo "/opt/mambaforge/bin" >> $GITHUB_PATH + run: | + echo "/opt/mambaforge/bin" >> $GITHUB_PATH - name: Fetch conda install script + if: steps.additional_platforms.outputs.skip_build != 'true' run: | wget https://raw.githubusercontent.com/bioconda/bioconda-common/master/{install-and-set-up-conda,configure-conda,common}.sh - - name: Restore cache - id: cache - uses: actions/cache@v4 - with: - path: /opt/mambaforge - key: ${{ runner.os }}--master--${{ hashFiles('install-and-set-up-conda.sh', 'common.sh', 'configure-conda.sh') }} - - name: Set up bioconda-utils - if: steps.cache.outputs.cache-hit != 'true' + if: steps.additional_platforms.outputs.skip_build != 'true' run: bash install-and-set-up-conda.sh - # This script can be used to reconfigure conda to use the right channel setup. - # This has to be done after the cache is restored, because - # the channel setup is not cached as it resides in the home directory. - # We could use a system-wide (and therefore cached) channel setup, - # but mamba does not support that at the time of implementation - # (it ignores settings made with --system). - name: Configure conda + if: steps.additional_platforms.outputs.skip_build != 'true' run: bash configure-conda.sh - name: Build and Upload + if: steps.additional_platforms.outputs.skip_build != 'true' env: QUAY_LOGIN: ${{ secrets.QUAY_LOGIN }} QUAY_OAUTH_TOKEN: ${{ secrets.QUAY_OAUTH_TOKEN }} @@ -74,6 +65,4 @@ jobs: --repo bioconda/bioconda-recipes \ --git-range ${GITHUB_SHA}~1 ${GITHUB_SHA} \ --fallback build \ - --artifact-source github-actions \ - --dryrun - # TODO: remove dry-run after testing + --artifact-source github-actions diff --git a/recipes/test/meta.yaml b/recipes/test/meta.yaml index 10859ac688e9c..539598de85f58 100644 --- a/recipes/test/meta.yaml +++ b/recipes/test/meta.yaml @@ -5,7 +5,7 @@ package: name: test - version: 0.2 + version: 0.4 source: url: https://github.com/lh3/seqtk/archive/v1.4.tar.gz