Skip to content

Commit

Permalink
ci: add macOS-arm64 build
Browse files Browse the repository at this point in the history
This doesn't add a universal binary, but instead keeps x86-64 and arm
as distinct binaries.

Fixes #1737, Closes #2099
  • Loading branch information
arbourd authored and BurntSushi committed Jul 9, 2023
1 parent 71a3e8a commit 9dea4eb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
- nightly-mips
- nightly-arm
- macos
- macos-arm
- win-msvc
- win-gnu
include:
Expand Down Expand Up @@ -77,6 +78,10 @@ jobs:
- build: macos
os: macos-latest
rust: nightly
- build: macos-arm
os: macos-latest
rust: nightly
target: aarch64-apple-darwin
- build: win-msvc
os: windows-2022
rust: nightly
Expand All @@ -103,7 +108,7 @@ jobs:
toolchain: ${{ matrix.rust }}

- name: Use Cross
if: matrix.target != ''
if: matrix.target != '' && matrix.os != 'macos-latest'
run: |
cargo install cross
echo "CARGO=cross" >> $GITHUB_ENV
Expand Down
31 changes: 18 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
jobs:
create-release:
name: create-release
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
# env:
# Set to force version number, e.g., when no tag exists.
# RG_VERSION: TEST-0.0.0
Expand Down Expand Up @@ -61,30 +61,34 @@ jobs:
PCRE2_SYS_STATIC: 1
strategy:
matrix:
build: [linux, linux-arm, macos, win-msvc, win-gnu, win32-msvc]
build: [linux, linux-arm, macos, macos-arm, win-msvc, win-gnu, win32-msvc]
include:
- build: linux
os: ubuntu-22.04
os: ubuntu-latest
rust: nightly
target: x86_64-unknown-linux-musl
- build: linux-arm
os: ubuntu-22.04
os: ubuntu-latest
rust: nightly
target: arm-unknown-linux-gnueabihf
- build: macos
os: macos-12
os: macos-latest
rust: nightly
target: x86_64-apple-darwin
- build: macos-arm
os: macos-latest
rust: nightly
target: aarch64-apple-darwin
- build: win-msvc
os: windows-2022
os: windows-latest
rust: nightly
target: x86_64-pc-windows-msvc
- build: win-gnu
os: windows-2022
os: windows-latest
rust: nightly-x86_64-gnu
target: x86_64-pc-windows-gnu
- build: win32-msvc
os: windows-2022
os: windows-latest
rust: nightly
target: i686-pc-windows-msvc

Expand All @@ -93,12 +97,12 @@ jobs:
uses: actions/checkout@v3

- name: Install packages (Ubuntu)
if: matrix.os == 'ubuntu-22.04'
if: matrix.os == 'ubuntu-latest'
run: |
ci/ubuntu-install-packages
- name: Install packages (macOS)
if: matrix.os == 'macos-12'
if: matrix.os == 'macos-latest'
run: |
ci/macos-install-packages
Expand All @@ -110,6 +114,7 @@ jobs:

- name: Use Cross
shell: bash
if: matrix.os != 'macos'
run: |
cargo install cross
echo "CARGO=cross" >> $GITHUB_ENV
Expand All @@ -125,8 +130,8 @@ jobs:
- name: Build release binary
run: ${{ env.CARGO }} build --verbose --release --features pcre2 ${{ env.TARGET_FLAGS }}

- name: Strip release binary (linux and macos)
if: matrix.build == 'linux' || matrix.build == 'macos'
- name: Strip release binary (linux, macos and macos-arm)
if: matrix.build == 'linux' || matrix.os == 'macos'
run: strip "target/${{ matrix.target }}/release/rg"

- name: Strip release binary (arm)
Expand All @@ -150,7 +155,7 @@ jobs:
cp "$outdir"/{rg.bash,rg.fish,_rg.ps1} "$staging/complete/"
cp complete/_rg "$staging/complete/"
if [ "${{ matrix.os }}" = "windows-2022" ]; then
if [ "${{ matrix.os }}" = "windows-latest" ]; then
cp "target/${{ matrix.target }}/release/rg.exe" "$staging/"
7z a "$staging.zip" "$staging"
certutil -hashfile "$staging.zip" SHA256 > "$staging.zip.sha256"
Expand Down

0 comments on commit 9dea4eb

Please sign in to comment.