Skip to content

Build Commander Conda #803

Build Commander Conda

Build Commander Conda #803

name: Build Commander Conda
on:
push:
branches:
- '*'
tags:
- '*'
pull_request:
branches:
- '*'
schedule:
- cron: '43 3 * * *' # 3:43 AM UTC, late-night/early morning US mainland
env:
QEMU_STATIC_VERSION: "v3.1.0-3"
MINIFORGE_URL: "https://github.com/conda-forge/miniforge/releases/download/4.8.5-1"
MINIFORGE_FILE: "Miniforge3-4.8.5-1-MacOSX-x86_64.sh"
MINIFORGE_SHA256: "5054599ee6ea639209b831d859935da50229040d7993b1736358734d1e9c5edc"
jobs:
build:
name: py3-${{ matrix.arch }}-${{ matrix.os }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -elo pipefail {0}
strategy:
fail-fast: false
matrix:
os: [ubuntu-18.04]
arch: [x86_64, aarch64, ppc64le]
include:
- os: macos-latest
arch: x86_64
outputs:
checksum1: ${{ steps.cksums.outputs.out-0 }}
checksum2: ${{ steps.cksums.outputs.out-1 }}
checksum3: ${{ steps.cksums.outputs.out-2 }}
checksum4: ${{ steps.cksums.outputs.out-3 }}
checksum5: ${{ steps.cksums.outputs.out-4 }}
checksum6: ${{ steps.cksums.outputs.out-5 }}
env:
COMMANDERCONDA_NAME: CommanderConda3
ARCH: ${{ matrix.arch }}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
id: cache-qemu
if: runner.os == 'Linux'
with:
path: build/qemu
key: qemu-${{ matrix.arch }}-${{ hashFiles('qemu-sums.sha256') }}-${{ hashFiles('.github/workflows/BuildCommanderConda.yml') }}
- name: get qemu static
if: steps.cache-qemu.outputs.cache-hit != 'true' && runner.os == 'Linux'
run: |
mkdir -p build/qemu || true
cd build/qemu
echo "============= Download QEMU static binaries ============="
wget https://github.com/multiarch/qemu-user-static/releases/download/${QEMU_STATIC_VERSION}/qemu-${ARCH}-static
chmod +x qemu-${ARCH}-static
- name: verify qemu checksums
if: runner.os == 'Linux'
working-directory: build/qemu
run: grep qemu-${ARCH}-static ../../qemu-sums.sha256 | shasum -c
- uses: actions/cache@v1
id: cache-miniforge
if: runner.os == 'macOS'
with:
path: build/miniforge
key: miniforge-${{ env.MINIFORGE_SHA256 }}-${{ hashFiles('.github/workflows/BuildCommanderConda.yml') }}
- name: get miniforge
if: steps.cache-miniforge.outputs.cache-hit != 'true' && runner.os == 'macOS'
run: |
mkdir -p ./build/miniforge || true
cd ./build/miniforge
curl -L -O "${MINIFORGE_URL}/${MINIFORGE_FILE}"
- name: verify minforge checksum
if: runner.os == 'macOS'
working-directory: build/miniforge
run: |
echo "${MINIFORGE_SHA256} *${MINIFORGE_FILE}" | tee ${MINIFORGE_FILE}.sha256
shasum -c ./${MINIFORGE_FILE}.sha256
- name: Build and test CommanderConda
run: ./build_CommanderConda_${{ runner.os }}.sh
- name: Checksum Outputs
id: cksums
working-directory: build
run: |
ls -alh
if [[ ${{ runner.os }} == macOS ]]; then
OS_NAME='MacOSX'
else
OS_NAME='${{ runner.os }}'
fi
cp "${COMMANDERCONDA_NAME}"-*-"${OS_NAME}-${ARCH}.sh" "${COMMANDERCONDA_NAME}-${OS_NAME}-${ARCH}.sh"
shasum -a 256 "${COMMANDERCONDA_NAME}-${OS_NAME}-${ARCH}.sh" | sed '$a\' | tee "${COMMANDERCONDA_NAME}-${OS_NAME}-${ARCH}.sh.sha256"
ls -alh
echo "Setting sha256 checksum outputs"
echo "out-${{ strategy.job-index }}:"
awk '{printf "%s\\n", $0}' "${COMMANDERCONDA_NAME}"-*.sh.sha256
printf '\n'
echo "::set-output name=out-${{ strategy.job-index }}::$(awk '{printf "%s\\n", $0}' "${COMMANDERCONDA_NAME}"-*.sh.sha256)"
- uses: actions/upload-artifact@v2
if: always()
with:
path: build/CommanderConda*.sh*
deploy:
runs-on: ubuntu-18.04
needs: build
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/[email protected]
- name: Show artifacts
working-directory: artifact
run: ls -RGla
- name: Verify SHA256 Checksums
working-directory: artifact
run: |
for sum in *.sha256; do
shasum -w -c "${sum}"
done
rm *.sha256
- name: Check passed SHA256 checksums
working-directory: artifact
run: |
printf "${{ join(needs.build.outputs.*, '') }}" | sed '$a\' | tee sha256-checksums.txt
for f in *.sh ; do
echo "Checking passed SHA256 checksum for $f."
grep "$f" sha256-checksums.txt | shasum -w -c
done
- name: Show ref
run: |
git fetch --prune origin +refs/heads/*:refs/remotes/origin/*
git fetch origin +refs/tags/*:refs/tags/*
git fetch --all --tags
echo "GITHUB_REF: ${GITHUB_REF}"
- name: Get notes from tag
if: startsWith(github.ref, 'refs/tags/')
run: |
echo "GITHUB_REF: ${GITHUB_REF}"
git for-each-ref --format='%(contents)' "${GITHUB_REF}" | sed '/BEGIN PGP SIGNATURE/,/END PGP SIGNATURE/d' | tee release-notes.txt
printf '\n---\n' >> release-notes.txt
git for-each-ref --format='Tagged: %(taggername) on %(taggerdate:rfc2822)' "${GITHUB_REF}" | tee -a release-notes.txt
git rev-list -n 1 "${GITHUB_REF}" | tee -a release-notes.txt
printf 'Released by [@%s](https://github.com/%s)' "${GITHUB_ACTOR}" "${GITHUB_ACTOR}" >> release-notes.txt
cat release-notes.txt
- name: Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: 'artifact/*'
body_path: './release-notes.txt'