From 1cddc60006a3aa12d20a0ec9ed42a5849c76e106 Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 20 May 2024 15:17:05 -0500 Subject: [PATCH] [no ci] attempt #1 to fix tests.yml (#10) --- .github/workflows/tests.yml | 142 +++++++++++++++++++- .github/workflows/tests.yml.FIXME.001 | 186 ++++++++++++++++++++++++++ 2 files changed, 324 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/tests.yml.FIXME.001 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 644adee..b855585 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,11 +1,16 @@ +--- 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 @@ -16,37 +21,166 @@ env: jobs: test-bot: strategy: + # NOTE: ipatch, `fail-fast` disabled because subsequent runners can not run job if previous job failed fail-fast: false + # 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 matrix: - os: [ubuntu-22.04, macos-13] + # os: [ubuntu-latest, macos-latest] # NOTE: default + # NOTE: homebrew/homebrew-core uses private self hosted runners + os: + - ubuntu-22.04 + # NOTE: macos-*-large runner requires additional spending limits + # - macos-14-large + - macos-14 + # - macos-13-large + - macos-13 + # - macos-12-large + - macos-12 + # - self-hosted-catalinavm + # - self-hosted-bigsurvm + # - self-hosted-mojavevm runs-on: ${{ matrix.os }} + timeout-minutes: 1200 + steps: + - name: Get current date + id: get_current_date + run: echo "date=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_ENV + + - name: Print value of date from previous step + id: print_date + run: echo "${{ steps.get_current_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 + with: + path: | + last_run_status + key: | + ${{ github.run_id }}-${{ matrix.os }}-${{ steps.date.outputs.date }} + restore-keys: | + ${{ github.run_id }}-${{ matrix.os }}- + + - name: Set last run status + id: set_last_run_status + run: echo "The last run status is ${{ env.last_run_status }}" + - name: Set up Homebrew id: set-up-homebrew uses: Homebrew/actions/setup-homebrew@master - name: Cache Homebrew Bundler RubyGems + if: steps.last_run_status.outputs.last_run_status != 'success' + id: cache uses: actions/cache@v4 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: print env + id: print_env + run: env + + # NOTE: use a condition to add env var for mojave runner + # REF: https://docs.github.com/en/actions/learn-github-actions/environment-variables + - name: condition, check runner name + 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` + + # NOTE: possibly causing the build issues with ubuntu runner + # - name: Install Homebrew Bundler RubyGems + # if: steps.cache.outputs.cache-hit != 'true' && steps.last_run_status.outputs.last_run_status != 'success' + # run: brew install-bundler-gems + - run: brew test-bot --only-cleanup-before - run: brew test-bot --only-setup - run: brew test-bot --only-tap-syntax - - run: brew test-bot --only-formulae + # NOTE: ipatch, attempt to set homebrew-core repo to specific commit for catalina bottling + - name: check for catalina vm and set homebrew-core repo to specific commit + 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: build bottle using test-bot for current formula + id: build_bottle + # NOTE: ipatch, below env var required, see, https://github.com/orgs/Homebrew/discussions/4856 + env: + HOMEBREW_NO_INSTALL_FROM_API: 1 + run: | + # 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 \ + 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/ipatch/homebrew-us-05 + 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 + # uses: actions/checkout@v2 + uses: lhotari/action-upterm@v1 + if: ${{ failure() }} + 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 + id: upload_bottle_artifacts if: always() && github.event_name == 'pull_request' - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v3.1.3 with: - name: bottles_${{ matrix.os }} + name: bottles path: '*.bottle.*' + + - name: Save run status + id: save_run_status + if: steps.last_run_status.outputs.last_run_status != 'success' + run: echo "last_run_status=${{ steps.test_run.outcome }}" >> $GITHUB_ENV + diff --git a/.github/workflows/tests.yml.FIXME.001 b/.github/workflows/tests.yml.FIXME.001 new file mode 100644 index 0000000..b855585 --- /dev/null +++ b/.github/workflows/tests.yml.FIXME.001 @@ -0,0 +1,186 @@ +--- +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 + # 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 + matrix: + # os: [ubuntu-latest, macos-latest] # NOTE: default + # NOTE: homebrew/homebrew-core uses private self hosted runners + os: + - ubuntu-22.04 + # NOTE: macos-*-large runner requires additional spending limits + # - macos-14-large + - macos-14 + # - macos-13-large + - macos-13 + # - macos-12-large + - macos-12 + # - self-hosted-catalinavm + # - self-hosted-bigsurvm + # - self-hosted-mojavevm + + runs-on: ${{ matrix.os }} + + timeout-minutes: 1200 + + steps: + - name: Get current date + id: get_current_date + run: echo "date=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_ENV + + - name: Print value of date from previous step + id: print_date + run: echo "${{ steps.get_current_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 + with: + path: | + last_run_status + key: | + ${{ github.run_id }}-${{ matrix.os }}-${{ steps.date.outputs.date }} + restore-keys: | + ${{ github.run_id }}-${{ matrix.os }}- + + - name: Set last run status + id: set_last_run_status + run: echo "The last run status is ${{ env.last_run_status }}" + + - name: Set up Homebrew + id: set-up-homebrew + uses: Homebrew/actions/setup-homebrew@master + + - name: Cache Homebrew Bundler RubyGems + if: steps.last_run_status.outputs.last_run_status != 'success' + id: cache + uses: actions/cache@v4 + 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: print env + id: print_env + run: env + + # NOTE: use a condition to add env var for mojave runner + # REF: https://docs.github.com/en/actions/learn-github-actions/environment-variables + - name: condition, check runner name + 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` + + # NOTE: possibly causing the build issues with ubuntu runner + # - name: Install Homebrew Bundler RubyGems + # if: steps.cache.outputs.cache-hit != 'true' && steps.last_run_status.outputs.last_run_status != 'success' + # run: brew install-bundler-gems + + - run: brew test-bot --only-cleanup-before + + - run: brew test-bot --only-setup + + - run: brew test-bot --only-tap-syntax + + # NOTE: ipatch, attempt to set homebrew-core repo to specific commit for catalina bottling + - name: check for catalina vm and set homebrew-core repo to specific commit + 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: build bottle using test-bot for current formula + id: build_bottle + # NOTE: ipatch, below env var required, see, https://github.com/orgs/Homebrew/discussions/4856 + env: + HOMEBREW_NO_INSTALL_FROM_API: 1 + run: | + # 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 \ + 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/ipatch/homebrew-us-05 + 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 + # uses: actions/checkout@v2 + uses: lhotari/action-upterm@v1 + if: ${{ failure() }} + 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 + id: upload_bottle_artifacts + if: always() && github.event_name == 'pull_request' + uses: actions/upload-artifact@v3.1.3 + with: + name: bottles + path: '*.bottle.*' + + - name: Save run status + id: save_run_status + if: steps.last_run_status.outputs.last_run_status != 'success' + run: echo "last_run_status=${{ steps.test_run.outcome }}" >> $GITHUB_ENV +