Skip to content

Commit 4813798

Browse files
authored
Merge branch 'main' into bump-lfortran-0.46
2 parents d6fae98 + d69ab91 commit 4813798

File tree

5 files changed

+128
-18
lines changed

5 files changed

+128
-18
lines changed
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Auto-update fpm Formula
2+
3+
on:
4+
workflow_dispatch: # Allows manual trigger
5+
6+
jobs:
7+
update-fpm:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
actions: write
11+
contents: write
12+
pull-requests: write
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Fetch latest fpm release
19+
id: get-latest-release
20+
run: |
21+
VERSION_WITH_V="$(curl -s https://api.github.com/repos/fortran-lang/fpm/releases/latest | jq -r '.tag_name')"
22+
VERSION_WITHOUT_V="${VERSION_WITH_V#v}" # Remove leading 'v'
23+
echo "LATEST_VERSION=${VERSION_WITHOUT_V}" >> "$GITHUB_ENV"
24+
echo "LATEST_VERSION_V=${VERSION_WITH_V}" >> "$GITHUB_ENV"
25+
echo "Latest version: ${VERSION_WITH_V} (stripped: ${VERSION_WITHOUT_V})"
26+
27+
- name: Extract current formula version
28+
id: get-current-version
29+
run: |
30+
CURRENT_VERSION="$(grep -oP 'url "https://github.com/fortran-lang/fpm/releases/download/v\K[0-9.]+' Formula/fpm.rb | head -n 1)"
31+
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> "$GITHUB_ENV"
32+
echo "Current version: ${CURRENT_VERSION}"
33+
34+
- name: Compare versions
35+
id: check-update
36+
run: |
37+
if [ "${{ env.LATEST_VERSION }}" != "${{ env.CURRENT_VERSION }}" ] || [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
38+
echo "New version available or manually triggered!"
39+
echo "UPDATE_NEEDED=true" >> "$GITHUB_ENV"
40+
else
41+
echo "UPDATE_NEEDED=false" >> "$GITHUB_ENV"
42+
echo "No update needed."
43+
fi
44+
45+
- name: Get new SHA256 hash
46+
if: env.UPDATE_NEEDED == 'true'
47+
id: get-sha256
48+
run: |
49+
SHA_URL="https://github.com/fortran-lang/fpm/releases/download/${{ env.LATEST_VERSION_V }}/fpm-${{ env.LATEST_VERSION }}.zip.sha256"
50+
SHA256="$(curl -sL "${SHA_URL}" | awk '{print $1}')"
51+
echo "SHA256=${SHA256}" >> "$GITHUB_ENV"
52+
echo "New SHA256: ${SHA256}"
53+
54+
- name: Create branch for update
55+
if: env.UPDATE_NEEDED == 'true'
56+
run: |
57+
BRANCH_NAME="auto-update-fpm-${{ env.LATEST_VERSION }}-$(date +%s)" # Add timestamp to branch name for uniqueness
58+
echo "BRANCH_NAME=${BRANCH_NAME}" >> "$GITHUB_ENV"
59+
60+
- name: Update formula
61+
if: env.UPDATE_NEEDED == 'true'
62+
run: |
63+
RUN_ID="${{ github.run_id }}-${{ github.run_number }}"
64+
sed -i "1s/^/# Formula last updated on $(date -u +"%Y-%m-%dT%H:%M:%SZ") (Run: ${RUN_ID})\n/" Formula/fpm.rb
65+
sed -i "s|url \".*\"|url \"https://github.com/fortran-lang/fpm/releases/download/${{ env.LATEST_VERSION_V }}/fpm-${{ env.LATEST_VERSION }}.zip\"|" Formula/fpm.rb
66+
sed -i "s|sha256 \".*\"|sha256 \"${{ env.SHA256 }}\"|" Formula/fpm.rb
67+
68+
- name: Debug - Show changes
69+
if: env.UPDATE_NEEDED == 'true'
70+
run: |
71+
git diff Formula/fpm.rb || echo "No changes detected in Formula/fpm.rb"
72+
73+
- name: Create Pull Request
74+
if: env.UPDATE_NEEDED == 'true'
75+
id: create-pr
76+
uses: peter-evans/create-pull-request@v7
77+
with:
78+
token: ${{ secrets.GITHUB_TOKEN }}
79+
commit-message: "Update fpm to ${{ env.LATEST_VERSION }} with timestamp"
80+
title: "Update fpm to ${{ env.LATEST_VERSION }}"
81+
body: |
82+
This PR automatically updates the fpm formula to version ${{ env.LATEST_VERSION }}.
83+
84+
**Changes:**
85+
- Updated URL to ${{ env.LATEST_VERSION_V }} release
86+
- Updated SHA256 to match the new release
87+
- Added timestamp to force PR: $(date -u +"%Y-%m-%dT%H:%M:%SZ")
88+
89+
This PR was created automatically by GitHub Actions.
90+
branch: ${{ env.BRANCH_NAME }}
91+
base: main
92+
labels: |
93+
automated-pr
94+
version-bump
95+

.github/workflows/publish.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ on:
33
pull_request_target:
44
types:
55
- labeled
6+
67
jobs:
78
pr-pull:
89
if: contains(github.event.pull_request.labels.*.name, 'pr-pull')
910
runs-on: ubuntu-latest
11+
1012
steps:
1113
- name: Set up Homebrew
1214
uses: Homebrew/actions/setup-homebrew@master
@@ -19,16 +21,17 @@ jobs:
1921
HOMEBREW_GITHUB_API_TOKEN: ${{ github.token }}
2022
HOMEBREW_NO_INSTALL_FROM_API: 1
2123
PULL_REQUEST: ${{ github.event.pull_request.number }}
22-
run: brew pr-pull --debug --tap=$GITHUB_REPOSITORY $PULL_REQUEST
24+
run: brew pr-pull --debug --tap="${GITHUB_REPOSITORY}" "${PULL_REQUEST}"
2325

2426
- name: Push commits
2527
uses: Homebrew/actions/git-try-push@master
2628
with:
2729
token: ${{ github.token }}
28-
branch: main
30+
branch: "main"
2931

3032
- name: Delete branch
3133
if: github.event.pull_request.head.repo.fork == false
3234
env:
3335
BRANCH: ${{ github.event.pull_request.head.ref }}
34-
run: git push --delete origin $BRANCH
36+
run: git push --delete origin "${BRANCH}"
37+

.github/workflows/tests.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,33 @@ on:
44
branches:
55
- main
66
pull_request:
7+
78
jobs:
89
test-bot:
910
strategy:
1011
fail-fast: false
1112
matrix:
12-
os: [macos-12, macos-13]
13+
include:
14+
# Intel builds
15+
- os: macos-13
16+
arch: x86_64
17+
- os: macos-14
18+
arch: x86_64
1319
runs-on: ${{ matrix.os }}
14-
timeout-minutes: 30
20+
timeout-minutes: 60 # Increased timeout for ARM builds
1521
steps:
1622
- name: Set up Homebrew
1723
id: set-up-homebrew
1824
uses: Homebrew/actions/setup-homebrew@master
1925

2026
- name: Cache Homebrew Bundler RubyGems
2127
id: cache
22-
uses: actions/cache@v1
28+
uses: actions/cache@v4
2329
with:
2430
path: ${{ steps.set-up-homebrew.outputs.gems-path }}
25-
key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}
26-
restore-keys: ${{ runner.os }}-rubygems-
31+
key: ${{ runner.os }}-${{ matrix.arch }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}
32+
restore-keys: |
33+
${{ runner.os }}-${{ matrix.arch }}-rubygems-
2734
2835
- name: Install Homebrew Bundler RubyGems
2936
if: steps.cache.outputs.cache-hit != 'true'
@@ -36,11 +43,13 @@ jobs:
3643
- run: brew test-bot --only-tap-syntax
3744

3845
- run: brew test-bot --only-formulae
39-
if: github.event_name == 'pull_request'
46+
if: github.event_name == 'pull_request'
47+
env:
48+
HOMEBREW_ARCH: ${{ matrix.arch }}
4049

4150
- name: Upload bottles as artifact
42-
if: always() && github.event_name == 'pull_request'
43-
uses: actions/upload-artifact@main
51+
if: always() && (github.event_name == 'pull_request')
52+
uses: actions/upload-artifact@v4
4453
with:
45-
name: bottles
54+
name: bottles_${{ matrix.os }}_${{ matrix.arch }}
4655
path: '*.bottle.*'

Formula/fpm.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1+
# Formula last updated on 2025-03-10 for version 0.11.0
2+
13
class Fpm < Formula
24
desc "Fortran Package Manager (fpm)"
35
homepage "https://fpm.fortran-lang.org"
4-
url "https://github.com/fortran-lang/fpm/releases/download/v0.9.0/fpm-0.9.0.zip"
5-
sha256 "484debabd7d22186ac41f865ddf63475c279a61a51aaff5636ed615860b5b8d7"
6+
url "https://github.com/fortran-lang/fpm/releases/download/v0.11.0/fpm-0.11.0.zip"
7+
sha256 "f6c998c9afd39eb42c7e80a306cfbed5faa77eaa42eb4f75b93864c338db1795"
68
license "MIT"
79

810
bottle do
9-
root_url "https://github.com/fortran-lang/homebrew-fortran/releases/download/fpm-0.9.0"
10-
sha256 cellar: :any, ventura: "2a7b23338d5b3fedad1b09d5b77714e7a54ac9966039516f0f38d7446c212ffd"
11-
sha256 cellar: :any, monterey: "902d30ac0a3227e78d98d609fb847cc2e1bad4f772f5c18cdd62b06e1fa49242"
11+
root_url "https://github.com/fortran-lang/homebrew-fortran/releases/download/fpm-0.11.0"
12+
rebuild 1
13+
sha256 cellar: :any, arm64_sonoma: "d5795b3b84fc2cb7eff32f48a64af03f439cd4bc562727ae2cfdde161b819f5e"
14+
sha256 cellar: :any, ventura: "6046a6004ff42f03f67dff1af39f80be7e0deb679f797c787a1883e28ac10778"
1215
end
1316

1417
depends_on "curl" => :build

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This repository provides package build instructions for tools and libraries arou
55
For example you can install *fpm* by tapping this repository
66

77
```
8-
brew tap fortran-lang/homebrew-fortran
8+
`brew tap fortran-lang/homebrew-fortran`
99
brew install fpm
1010
```
1111

0 commit comments

Comments
 (0)