Skip to content

Commit

Permalink
updates from testing
Browse files Browse the repository at this point in the history
  • Loading branch information
aliciaaevans committed Apr 4, 2024
1 parent 1b177cc commit a51acce
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 47 deletions.
47 changes: 47 additions & 0 deletions .github/check-for-additional-platforms.sh
Original file line number Diff line number Diff line change
@@ -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
32 changes: 12 additions & 20 deletions .github/workflows/PR-arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
43 changes: 16 additions & 27 deletions .github/workflows/master-arm.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Upload
name: Upload (osx-arm64)
on:
push:
branches:
- target-for-arm-osx
jobs:
- master

build-upload-osx-arm:
name: osx-arm64 Upload
jobs:
build_and_upload-osx-arm64:
name: build_and_upload-osx-arm64
if: github.repository == 'bioconda/bioconda-recipes'
runs-on: macOS-14 # M1
strategy:
Expand All @@ -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 }}
Expand All @@ -74,6 +65,4 @@ jobs:
--repo bioconda/bioconda-recipes \
--git-range ${GITHUB_SHA}~1 ${GITHUB_SHA} \
--fallback build \
--artifact-source github-actions \
--dry-run
# TODO: remove dry-run after testing
--artifact-source github-actions

0 comments on commit a51acce

Please sign in to comment.