From 7496e871111352cee0f820a2f7ef05c4fce4b6c7 Mon Sep 17 00:00:00 2001 From: Federico Perini Date: Mon, 10 Mar 2025 10:39:36 +0100 Subject: [PATCH 1/3] more macos versions --- .github/workflows/tests.yml | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index dd1f092..4d5ffa3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,9 +9,19 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-13] + include: + # Intel builds + - os: macos-12 + arch: x86_64 + - os: macos-13 + arch: x86_64 + - os: macos-14 + arch: x86_64 + # ARM builds + - os: macos-14-arm64 + arch: arm64 runs-on: ${{ matrix.os }} - timeout-minutes: 30 + timeout-minutes: 60 # Increased timeout for ARM builds steps: - name: Set up Homebrew id: set-up-homebrew @@ -22,9 +32,9 @@ jobs: uses: actions/cache@v4 with: path: ${{ steps.set-up-homebrew.outputs.gems-path }} - key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }} + key: ${{ runner.os }}-${{ matrix.arch }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }} restore-keys: | - ${{ runner.os }}-rubygems- + ${{ runner.os }}-${{ matrix.arch }}-rubygems- - name: Install Homebrew Bundler RubyGems if: steps.cache.outputs.cache-hit != 'true' @@ -38,10 +48,12 @@ jobs: - run: brew test-bot --only-formulae if: github.event_name == 'pull_request' + env: + HOMEBREW_ARCH: ${{ matrix.arch }} - name: Upload bottles as artifact if: always() && github.event_name == 'pull_request' uses: actions/upload-artifact@v4 with: - name: bottles + name: bottles-${{ matrix.os }}-${{ matrix.arch }} path: '*.bottle.*' From f3e88cd6b1bce9a3c53763e2b7a7d65ed91fee65 Mon Sep 17 00:00:00 2001 From: Federico Perini Date: Mon, 10 Mar 2025 10:46:49 +0100 Subject: [PATCH 2/3] Update fpm-version-update.yml --- .github/workflows/fpm-version-update.yml | 92 +++++++++++++++++++++++- 1 file changed, 90 insertions(+), 2 deletions(-) diff --git a/.github/workflows/fpm-version-update.yml b/.github/workflows/fpm-version-update.yml index 89e2d1b..11843a3 100644 --- a/.github/workflows/fpm-version-update.yml +++ b/.github/workflows/fpm-version-update.yml @@ -8,6 +8,9 @@ on: jobs: update-fpm: runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write steps: - name: Checkout repository @@ -48,18 +51,103 @@ jobs: echo "SHA256=${SHA256}" >> "$GITHUB_ENV" echo "New SHA256: ${SHA256}" + - name: Create branch for update + if: env.UPDATE_NEEDED == 'true' + run: | + BRANCH_NAME="auto-update-fpm-${LATEST_VERSION}" + git checkout -b "${BRANCH_NAME}" + echo "BRANCH_NAME=${BRANCH_NAME}" >> "$GITHUB_ENV" + - name: Update formula if: env.UPDATE_NEEDED == 'true' run: | sed -i "s|url \".*\"|url \"https://github.com/fortran-lang/fpm/releases/download/${LATEST_VERSION_V}/fpm-${LATEST_VERSION}.zip\"|" Formula/fpm.rb sed -i "s|sha256 \".*\"|sha256 \"${SHA256}\"|" Formula/fpm.rb - - name: Commit and push changes + - name: Commit changes if: env.UPDATE_NEEDED == 'true' run: | git config --global user.name "GitHub Actions" git config --global user.email "actions@github.com" git add Formula/fpm.rb git commit -m "Update fpm to ${LATEST_VERSION}" - git push + - name: Push changes to branch + if: env.UPDATE_NEEDED == 'true' + run: | + git push origin "${BRANCH_NAME}" + + - name: Create Pull Request + if: env.UPDATE_NEEDED == 'true' + id: create-pr + uses: peter-evans/create-pull-request@v5 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: "Update fpm to ${{ env.LATEST_VERSION }}" + title: "Update fpm to ${{ env.LATEST_VERSION }}" + body: | + This PR automatically updates the fpm formula to version ${{ env.LATEST_VERSION }}. + + **Changes:** + - Updated URL to ${{ env.LATEST_VERSION_V }} release + - Updated SHA256 to match the new release + + This PR was created automatically by GitHub Actions. + branch: ${{ env.BRANCH_NAME }} + base: main + labels: | + automated-pr + version-bump + + # Wait for test-bot CI to complete + - name: Wait for test-bot to complete + if: env.UPDATE_NEEDED == 'true' && steps.create-pr.outputs.pull-request-number + run: | + # Wait for CI to start and finish (maximum 30 minutes) + echo "Waiting for test-bot workflow to complete..." + PR_NUMBER=${{ steps.create-pr.outputs.pull-request-number }} + timeout=1800 # 30 minutes in seconds + interval=60 # Check every minute + elapsed=0 + + while [ $elapsed -lt $timeout ]; do + # Check if test-bot workflow has completed + STATUS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + "https://api.github.com/repos/${{ github.repository }}/actions/runs?status=completed&event=pull_request&head_sha=$(git rev-parse HEAD)") + + COMPLETED=$(echo "$STATUS" | jq -r '.workflow_runs[] | select(.name == "brew test-bot") | .status') + + if [ "$COMPLETED" = "completed" ]; then + CONCLUSION=$(echo "$STATUS" | jq -r '.workflow_runs[] | select(.name == "brew test-bot") | .conclusion') + if [ "$CONCLUSION" = "success" ]; then + echo "test-bot workflow completed successfully!" + break + elif [ "$CONCLUSION" = "failure" ]; then + echo "test-bot workflow failed!" + exit 1 + fi + fi + + sleep $interval + elapsed=$((elapsed + interval)) + echo "Still waiting... ($elapsed seconds elapsed)" + done + + if [ $elapsed -ge $timeout ]; then + echo "Timeout waiting for test-bot workflow to complete" + exit 1 + fi + + # Add label to trigger pr-pull workflow + - name: Add pr-pull label + if: env.UPDATE_NEEDED == 'true' && steps.create-pr.outputs.pull-request-number + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: ${{ steps.create-pr.outputs.pull-request-number }}, + labels: ['pr-pull'] + }) From 7b5dd131c495a946b9f679dff730c622ae5ffb49 Mon Sep 17 00:00:00 2001 From: Federico Perini Date: Mon, 10 Mar 2025 10:47:21 +0100 Subject: [PATCH 3/3] remove unavailable runners --- .github/workflows/tests.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4d5ffa3..570bdf8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,15 +11,10 @@ jobs: matrix: include: # Intel builds - - os: macos-12 - arch: x86_64 - os: macos-13 arch: x86_64 - os: macos-14 arch: x86_64 - # ARM builds - - os: macos-14-arm64 - arch: arm64 runs-on: ${{ matrix.os }} timeout-minutes: 60 # Increased timeout for ARM builds steps: