From 0d8d2bd65120caf0fb562cef7a1c6ae18126ffd9 Mon Sep 17 00:00:00 2001 From: Chris Evich Date: Wed, 9 Aug 2023 13:30:43 -0400 Subject: [PATCH] Migrate cross-compile task to github-actions As of Sept. 1st 2023 Cirrus-CI will start charging for hosted compute time. At the time of this commit, according to the containers-org billing page, github provides 200 "free" minutes per month of MacOS time. However, the same page shows 0 minutes used across-the-board, so perhaps they're not counting minutes at all. Signed-off-by: Chris Evich --- .cirrus.yml | 25 ---------- .github/workflows/test_macos_build.yml | 64 ++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/test_macos_build.yml diff --git a/.cirrus.yml b/.cirrus.yml index 3a101d4ecb..6b66108fff 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -132,29 +132,6 @@ vendor_task: - './hack/tree_status.sh' -# Confirm cross-compile ALL architectures on a Mac OS-X VM. -cross_build_task: - name: "Cross Compile" - alias: cross_build - only_if: >- - $CIRRUS_CHANGE_TITLE !=~ '.*CI:DOCS.*' && - $CIRRUS_CRON != 'multiarch' - - osx_instance: - image: ghcr.io/cirruslabs/macos-ventura-base:latest - - script: - - brew update - - brew install go - - brew install go-md2man - - brew install gpgme - - go version - - make cross CGO_ENABLED=0 - - binary_artifacts: - path: ./bin/* - - unit_task: name: 'Unit tests w/ $STORAGE_DRIVER' alias: unit @@ -165,7 +142,6 @@ unit_task: depends_on: &smoke_vendor_cross - smoke - vendor - - cross_build timeout_in: 1h @@ -381,7 +357,6 @@ success_task: - unit - conformance - vendor - - cross_build - integration - in_podman - image_build diff --git a/.github/workflows/test_macos_build.yml b/.github/workflows/test_macos_build.yml new file mode 100644 index 0000000000..754cc659d7 --- /dev/null +++ b/.github/workflows/test_macos_build.yml @@ -0,0 +1,64 @@ +--- + +name: Test MacOS Build + +on: [push, pull_request] + +jobs: + # Workflows only record minimal details about the event which triggered them. + trigger_event_debug: + name: Archive workflow trigger event details + runs-on: ubuntu-latest + steps: + - name: Archive workflow trigger event details + uses: actions/upload-artifact@v3 + with: + name: workflow_trigger_event + path: ${{ github.event_path }} + process_pr_description: + name: Process PR Description + runs-on: ubuntu-latest + outputs: + ci_docs: ${{ steps.ci_docs_check.outputs.present }} + steps: + - name: "Check for '[CI:DOCS]'" + id: ci_docs_check + env: + # DANGER: Command-injection risk, bounce value through env. var. + PR_DESC: "${{ github.event.pull_request.title }}" + run: | + if [[ "$PR_DESC" =~ CI:DOCS ]]; then + # GHA provides no indication of output values, assist human debuggers. + echo "::warning::Skipping job due to [CI:DOCS] in PR description" + echo "present=true" >> "$GITHUB_OUTPUT" + else + echo "present=false" >> "$GITHUB_OUTPUT" + fi + test_macos_build: + name: Test MacOS Build + runs-on: macos-latest + needs: process_pr_description + if: ${{ needs.process_pr_description.outputs.ci_docs == 'false' }} + steps: + # Side-effect: Checkout action alters the execution environment. + - name: Checkout repository + uses: actions/checkout@v3 + # Workflows do not save any record of their environment. Assist future + # human debuggers by logging all values. DANGER: Some values may be + # sensitive. The github-runner will mask them _only_ on output, not any + # files/artifacts they may wind up in. + - name: Debug workflow trigger and environment + run: printenv | sort + - name: Test MacOS Build + run: | + brew update + brew install --overwrite go + brew install go-md2man + brew install gpgme + go version + make cross CGO_ENABLED=0 + - name: Archive compiled binaries + uses: actions/upload-artifact@v3 + with: + name: binary + path: "./bin/*"