freecad@0.21.2_py310: checkin patch for opengl-glu #675
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: brew test-bot | |
on: | |
push: | |
branches: | |
- main | |
- master | |
pull_request: | |
workflow_dispatch: # NOTE: nova with homebrew gha | |
env: | |
HOMEBREW_NO_ANALYTICS: 1 | |
HOMEBREW_NO_AUTO_UPDATE: 1 | |
HOMEBREW_NO_INSTALL_CLEANUP: 1 | |
HOMEBREW_NO_INSTALL_FROM_API: 1 | |
HOMEBREW_DEVELOPER: 1 | |
jobs: | |
test-bot: | |
strategy: | |
# NOTE: ipatch, `fail-fast` disabled because subsequent runners can not run job if previous job failed | |
fail-fast: false | |
matrix: | |
# os: [ubuntu-latest, macos-latest] # NOTE: default | |
# NOTE: homebrew/homebrew-core uses private self hosted runners | |
# https://github.com/actions/runner-images | |
os: | |
# NOTE: macos-*-large runner requires additional spending limits | |
# - macos-14-large | |
- macos-15 | |
- macos-14 | |
# - macos-13-large | |
# NOTE: macos-13 is the last free intel runner provided by github | |
- macos-13 | |
# - macos-12-large | |
# upstream homebrew-core has deprecated macos-12 and github will retire images on 12/3/24 | |
# - macos-12 | |
- ubuntu-22.04 | |
# - self-hosted-catalinavm | |
# - self-hosted-bigsurvm | |
# - self-hosted-mojavevm | |
- self-hosted-ubuntu-22.04 | |
# NOTE: ipatch, all three self hosted runners (vms) are hosted on same computer | |
# ...so limit job to one runner at a time. | |
# REF: | |
# https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#defining-the-maximum-number | |
# max-parallel: 1 | |
max-parallel: 5 | |
runs-on: ${{ matrix.os }} | |
permissions: read-all | |
# permissions: | |
# actions: write | |
# contents: write | |
# packages: write | |
# pull-requests: write | |
timeout-minutes: 1200 | |
steps: | |
- name: Test GitHub Token, ie. HOMEBREW_GITHUB_API_TOKEN | |
continue-on-error: true | |
run: | | |
RESPONSE=$(curl -s -L \ | |
-H "Authorization: Bearer ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}" \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/freecad/homebrew-freecad/actions/runners) | |
# echo "API response: $RESPONSE" | |
if echo "$RESPONSE" | grep -q '"message": "Bad credentials"'; then | |
echo "Error: Bad credentials - the GitHub token may be invalid or lacks permissions." | |
exit 1 | |
fi | |
echo "Success: GitHub token is valid." | |
- name: Get current date | |
id: get-current-date | |
run: echo "date=$(date +'%Y-%m-%dT%H:%M:%S')" >> "$GITHUB_ENV" | |
- name: Set date output | |
id: set-date | |
run: echo "date=$(date +'%Y-%m-%dT%H:%M:%S')" >> "$GITHUB_OUTPUT" | |
- name: Print value of date from previous step | |
id: print-date | |
run: echo "${{ steps.set-date.outputs.date }}" | |
- name: Set default run status | |
id: set-default-run-status | |
run: echo "last-run-status=default" >> "$GITHUB_ENV" | |
- name: Restore last run status | |
id: restore-last-run-status | |
uses: actions/cache@v4.0.2 | |
with: | |
path: | | |
last-run-status | |
key: | | |
${{ github.run_id }}-${{ matrix.os }}-${{ steps.set-date.outputs.date }} | |
restore-keys: | | |
${{ github.run_id }}-${{ matrix.os }}- | |
- name: Set last run status | |
id: set-last-run-status | |
run: echo "last-run-status=${{ env.last-run-status }}" >> "GITHUB_OUTPUT" | |
- name: Set up Homebrew | |
id: set-up-homebrew | |
uses: Homebrew/actions/setup-homebrew@master | |
- name: Cache Homebrew Bundler RubyGems | |
if: steps.set-last-run-status.outputs.last-run-status != 'success' | |
id: cache | |
uses: actions/cache@v4.0.2 | |
with: | |
path: ${{ steps.set-up-homebrew.outputs.gems-path }} | |
key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }} | |
restore-keys: ${{ runner.os }}-rubygems- | |
- name: Fetch GitHub runners and check if self-hosted | |
continue-on-error: true | |
id: fetch-runners-then-check-for-self-hosted | |
run: | | |
RESPONSE=$(curl -s -L \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/freecad/homebrew-freecad/actions/runners) | |
# debug output of response | |
echo "API response: $RESPONSE" | |
# Check if any runner is self-hosted | |
RUNNER_NAME=$(echo "$RESPONSE" | jq -r '.runners[] | select(.labels[]?.name == "self-hosted") | .name') | |
if [ -n "$RUNNER_NAME" ]; then | |
echo "GITHUB_ACTIONS_HOMEBREW_SELF_HOSTED=1" >> "$GITHUB_ENV" | |
echo "Self-hosted runner found: $RUNNER_NAME" | |
else | |
echo "No self-hosted runner found" | |
fi | |
- name: manually update GITHUB_ENV based on RUNNER_NAME | |
id: update-github_env-based-on-runner_name | |
run: | | |
if [ "$RUNNER_NAME" = "self-hosted-ubuntu-22.04" ]; then | |
echo "GITHUB_ACTIONS_HOMEBREW_SELF_HOSTED=1" >> "$GITHUB_ENV" | |
echo "HOMEBREW_GITHUB_ACTIONS=1" >> "$GITHUB_ENV" | |
export GITHUB_ACTIONS_HOMEBREW_SELF_HOSTED=1 | |
export HOMEBREW_GITHUB_ACTIONS=1 | |
echo "Self-hosted runner found: $RUNNER_NAME" | |
else | |
echo "No self-hosted runner found" | |
fi | |
# # Step to add Homebrew paths to GITHUB_ENV if using act locally | |
# - name: Set Homebrew environment variables for act | |
# if: runner.os == 'Linux' && env.ACT == 'true' | |
# run: | | |
# #!/bin/bash | |
# echo "Adding Homebrew paths to GITHUB_ENV" | |
# { | |
# echo "PATH=/home/linuxbrew/.linuxbrew/sbin:/home/linuxbrew/.linuxbrew/bin:${PATH}" | |
# echo "HOMEBREW_PREFIX=/home/linuxbrew/.linuxbrew" | |
# echo "HOMEBREW_NO_ANALYTICS=1" | |
# } >> "$GITHUB_ENV" | |
- name: print message about adding homebrew paths to GITHUB_ENV | |
if: runner.os == 'Linux' && env.ACT == 'true' | |
run: | | |
echo "Adding Homebrew paths to GITHUB_ENV" | |
- name: add paths to GIHTUB_ENV | |
if: runner.os == 'Linux' && env.ACT == 'true' | |
run: | | |
echo "PATH=/home/linuxbrew/.linuxbrew/sbin:/home/linuxbrew/.linuxbrew/bin:${PATH}" >> "$GITHUB_ENV" | |
- name: disable homebrew analytics and store value in GITHUB_ENV | |
if: runner.os == 'Linux' && env.ACT == 'true' | |
run: | | |
echo "HOMEBREW_NO_ANALYTICS=1" >> "$GITHUB_ENV" | |
- name: print env | |
id: print-env | |
run: env | |
- name: run brew config | |
run: brew config | |
- name: check env | |
id: print-the-value-of-GITHUB_ACTIONS_HOMEBREW_SELF_HOSTED-env-var | |
run: | | |
echo "the value of GITHUB_ACTIONS_HOMEBREW_SELF_HOSTED is $GITHUB_ACTIONS_HOMEBREW_SELF_HOSTED" | |
- name: condition, check runner name | |
# NOTE: use a condition to add env var for mojave runner | |
# REF: https://docs.github.com/en/actions/learn-github-actions/environment-variables | |
if: runner.name == 'vmmojave' | |
run: echo "The operating system on the runner is, $RUNNER_OS."; echo HOMEBREW_DEVELOPER=1 >> "$GITHUB_ENV" | |
# NOTE: not possible to have two `run:` blocks within a `name` | |
- name: Install Homebrew Bundler RubyGems | |
if: steps.cache.outputs.cache-hit != 'true' && steps.set-last-run-status.outputs.last-run-status != 'success' | |
run: brew install-bundler-gems | |
- name: only run brew test-bot cleanup before on github hosted runners | |
if: ${{ !contains(matrix.os, 'self-hosted-ubuntu-22.04') }} | |
id: brew-test-bot-cleanup-before | |
run: | | |
brew test-bot --only-cleanup-before | |
- run: brew test-bot --only-setup | |
- run: brew test-bot --only-tap-syntax | |
- name: check for catalina vm and set homebrew-core repo to specific commit | |
# NOTE: ipatch, attempt to set homebrew-core repo to specific commit for catalina bottling | |
if: runner.name == 'vmcatalina' | |
run: | | |
cd "$(brew --repo homebrew/core)"; \ | |
git checkout ipatch-1015-cmake-bottle | |
- name: condition, update style exceptions for vmmojave | |
if: runner.name == 'vmmojave' | |
run: | | |
sed -i '' \ | |
-e '/go@1.9/d' \ | |
-e '/go@1.10/d' \ | |
-e '/go@1.11/d' \ | |
-e '/go@1.12/d' \ | |
"$(brew --repo homebrew/core)/style_exceptions/binary_bootstrap_formula_urls_allowlist.json" | |
- name: unset HOMEBREW_NO_INSTALL_FROM_API for linux runners ------------------- | |
# NOTE: ipatch, env var required, see, https://github.com/orgs/Homebrew/discussions/4856 | |
run: | | |
if [[ $RUNNER_OS == 'Linux' ]]; then | |
unset HOMEBREW_NO_INSTALL_FROM_API | |
fi | |
# - name: print event name ----------------------------------------DEBUG | |
# run: | | |
# echo "Event Name: ${{ github.event_name }}" | |
# echo "Event Content: ${{ toJson(github.event) }}" | |
- name: build bottle using test-bot for current formula | |
id: build-bottle | |
# Check if the runner name is vmmojave or vmcatalina and add the flag if true | |
# NOTE: ipatch, keep-old is not the droid you're looking for, | |
# see: https://github.com/orgs/Homebrew/discussions/4935 | |
# --keep-old \ | |
run: | | |
if [[ runner.name == 'vmmojave' || runner.name == 'vmcatalina' ]]; then | |
brew test-bot \ | |
--skip-online-checks \ | |
--only-formulae \ | |
--only-json-tab \ | |
--skip-recursive-dependents \ | |
--build-dependents-from-source \ | |
--root-url=https://ghcr.io/v2/freecad/homebrew-freecad | |
else | |
brew test-bot \ | |
--skip-online-checks \ | |
--only-formulae \ | |
--only-json-tab \ | |
--skip-recursive-dependents \ | |
--root-url=https://ghcr.io/v2/freecad/homebrew-freecad | |
fi | |
if: github.event_name == 'pull_request' | |
# - name: debug with tmate on failure | |
# if: ${{ failure() }} | |
# uses: mxschmitt/action-tmate@v3 | |
- name: debug with lhotari/action-upterm | |
id: debug-workflow-run | |
if: ${{ failure() && !env.ACT }} # skip during local actions testing using `act` | |
# NOTE: ipatch, issue with macos runners circa oct 2024 | |
# uses: lhotari/action-upterm@v1 | |
#------- | |
uses: owenthereal/action-upterm@v1 | |
with: | |
# limit ssh access to user who triggered the workflow | |
limit-access-to-actor: true | |
# shut down server after 10 minutes if no one connects | |
wait-timeout-minutes: 10 | |
- name: Upload bottles as artifact | |
# NOTE: ipatch, issue using upload-artifact@v4 | |
# see: https://github.com/actions/upload-artifact/issues/478 | |
id: upload-bottle-artifacts | |
if: always() && github.event_name == 'pull_request' | |
# uses: actions/upload-artifact@v4.3.3 | |
uses: actions/upload-artifact@v3.1.3 | |
with: | |
name: bottles | |
path: '*.bottle.*' | |
- name: Save run status | |
id: save-run-status | |
if: steps.set-last-run-status.outputs.last-run-status != 'success' | |
run: echo "last-run-status=${{ steps.build-bottle.outcome }}" >> "$GITHUB_ENV" | |