Skip to content

Commit

Permalink
Reapply "Add Mac arm64 executable (#1426)" (#1429)
Browse files Browse the repository at this point in the history
This reverts commit 36e62bb.
  • Loading branch information
csasarak committed May 13, 2024
1 parent 36e62bb commit bdbf560
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 21 deletions.
43 changes: 27 additions & 16 deletions .github/workflows/build-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@ jobs:

strategy:
matrix:
os: ['windows-latest', 'ubuntu-latest', 'macos-12']
os: ['windows-latest', 'ubuntu-latest', 'macos-12', 'macos-latest']
include:
- os: ubuntu-latest
os-name: Linux
container: fossa/haskell-static-alpine:ghc-9.4.8
project-file: cabal.project.ci.linux
ghc: '9.4.8'

# macos-latest pointed at macos-12 this before it was changed to ARM.
- os: macos-12
os-name: macOS
os-name: macOS-intel
project-file: cabal.project.ci.macos
ghc: '9.4.8'

Expand All @@ -37,6 +38,11 @@ jobs:
project-file: cabal.project.ci.windows
ghc: '9.4.8'

- os: macos-latest
os-name: macOS-arm64
project-file: cabal.project.ci.macos
ghc: '9.4.8'

steps:

- uses: actions/checkout@v4
Expand Down Expand Up @@ -134,22 +140,22 @@ jobs:
name: Cache cabal store
with:
path: ${{ steps.setup-haskell.outputs.cabal-store || '~/.local/state/cabal' }}
key: ${{ runner.os }}-${{ matrix.ghc }}-cabal-cache-${{ steps.compute-cache-key.outputs.cabal-cache-key }}
key: ${{ matrix.os-name }}-${{ matrix.ghc }}-cabal-cache-${{ steps.compute-cache-key.outputs.cabal-cache-key }}
restore-keys: |
${{ runner.os }}-${{ matrix.ghc }}-cabal-cache-
${{ runner.os }}-${{ matrix.ghc }}-
${{ runner.os }}-
${{ matrix.os-name }}-${{ matrix.ghc }}-cabal-cache-
${{ matrix.os-name }}-${{ matrix.ghc }}-
${{ matrix.os-name }}-
- uses: actions/cache@v4
name: Cache dist-newstyle
with:
path: ${{ github.workspace }}/dist-newstyle
key: ${{ runner.os }}-${{ env.GHC_VERSION }}-dist-newstyle-${{ github.sha }}
key: ${{ matrix.os-name }}-${{ env.GHC_VERSION }}-dist-newstyle-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ env.GHC_VERSION }}-dist-newstyle-${{ env.parent_commit }}
${{ runner.os }}-${{ env.GHC_VERSION }}-dist-newstyle-
${{ runner.os }}-${{ env.GHC_VERSION }}-
${{ runner.os }}-
${{ matrix.os-name }}-${{ env.GHC_VERSION }}-dist-newstyle-${{ env.parent_commit }}
${{ matrix.os-name }}-${{ env.GHC_VERSION }}-dist-newstyle-
${{ matrix.os-name }}-${{ env.GHC_VERSION }}-
${{ matrix.os-name }}-
- name: Update vendored binaries
run: |
Expand Down Expand Up @@ -260,7 +266,7 @@ jobs:
- uses: actions/upload-artifact@v4
with:
name: ${{ runner.os }}-binaries
name: ${{ matrix.os-name }}-binaries
path: release

create-release:
Expand Down Expand Up @@ -367,10 +373,14 @@ jobs:
gzip "$LINUX_DIAGNOSE_TAR_PATH"
gzip "$LINUX_MILLHONE_TAR_PATH"
chmod +x macOS-binaries/*
zip -j release/fossa_${{ steps.get-version.outputs.VERSION }}_darwin_amd64.zip macOS-binaries/fossa
zip -j release/diagnose_${{ steps.get-version.outputs.VERSION }}_darwin_amd64.zip macOS-binaries/diagnose
zip -j release/millhone_${{ steps.get-version.outputs.VERSION }}_darwin_amd64.zip macOS-binaries/millhone
chmod +x macOS-intel-binaries/*
zip -j release/fossa_${{ steps.get-version.outputs.VERSION }}_darwin_amd64.zip macOS-intel-binaries/fossa
zip -j release/diagnose_${{ steps.get-version.outputs.VERSION }}_darwin_amd64.zip macOS-intel-binaries/diagnose
zip -j release/millhone_${{ steps.get-version.outputs.VERSION }}_darwin_amd64.zip macOS-intel-binaries/millhone
chmod +x macOS-arm64-binaries/*
zip -j release/fossa_${{ steps.get-version.outputs.VERSION }}_darwin_arm64.zip macOS-intel-binaries/fossa
zip -j release/diagnose_${{ steps.get-version.outputs.VERSION }}_darwin_arm64.zip macOS-intel-binaries/diagnose
zip -j release/millhone_${{ steps.get-version.outputs.VERSION }}_darwin_arm64.zip macOS-intel-binaries/millhone
chmod +x Windows-binaries/*
zip -j release/fossa_${{ steps.get-version.outputs.VERSION }}_windows_amd64.zip Windows-binaries/fossa.exe
Expand All @@ -384,6 +394,7 @@ jobs:
sha256sum --binary "fossa_${{ steps.get-version.outputs.VERSION }}_linux_amd64.zip" > "fossa_${{ steps.get-version.outputs.VERSION }}_linux_amd64.zip.sha256"
sha256sum --binary "fossa_${{ steps.get-version.outputs.VERSION }}_linux_amd64.tar.gz" > "fossa_${{ steps.get-version.outputs.VERSION }}_linux_amd64.tar.gz.sha256"
sha256sum --binary "fossa_${{ steps.get-version.outputs.VERSION }}_darwin_amd64.zip" > "fossa_${{ steps.get-version.outputs.VERSION }}_darwin_amd64.zip.sha256"
sha256sum --binary "fossa_${{ steps.get-version.outputs.VERSION }}_darwin_arm64.zip" > "fossa_${{ steps.get-version.outputs.VERSION }}_darwin_arm64.zip.sha256"
sha256sum --binary "fossa_${{ steps.get-version.outputs.VERSION }}_windows_amd64.zip" > "fossa_${{ steps.get-version.outputs.VERSION }}_windows_amd64.zip.sha256"
echo "Sanity-checking the checksums."
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/install-script-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,28 @@ jobs:
fossa --version
brew uninstall fossa
# These are run separately from the Matrix above because:
# 1. There is no Mac ARM fossa v1.
# 2. Earlier versions of cli v3 did not have ARM releases.
test-macos-arm:
runs-on: "macos-latest"
steps:
- uses: actions/checkout@v4
- name: install latest script can install a specific version
shell: bash
run: |
# 3.9.19 is the first version with native Mac ARM builds.
./install-latest.sh -b . v3.9.19
./fossa --version | grep -q "3.9.19"
rm fossa
- name: install latest script performs installation
shell: bash
run: |
./install-latest.sh -b .
./fossa --version
rm fossa
test-windows:
runs-on: "windows-latest"
steps:
Expand Down
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# FOSSA CLI Changelog

## v3.9.19
- Release a Mac arm64 binary. ([#1426](https://github.com/fossas/fossa-cli/pull/1426))

## v3.9.18
- Resolves an issue where `vendored-dependencies` were rescanned locally, but not in the FOSSA service,
when `forceRescans` was set to `true` ([#1423](https://github.com/fossas/fossa-cli/pull/1423)).
Expand Down
7 changes: 4 additions & 3 deletions install-latest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,10 @@ get_binary_name() {
name=${PROJECT_NAME}_${VERSION}_${OS}_${ARCH}
case ${PLATFORM} in
darwin/arm64)
log_info "Platform ${PLATFORM} (m1 silicon) detected, using compatible darwin/amd64 binary instead."
name=${PROJECT_NAME}_${VERSION}_${OS}_amd64
;;
if version_less_than "$VERSION" "3.9.19"; then
log_info "Platform ${PLATFORM} (m1 silicon) detected and requested version < 3.9.19, using compatible darwin/amd64 binary instead."
name=${PROJECT_NAME}_${VERSION}_${OS}_amd64
fi ;;
esac
echo "$name"
}
Expand Down
6 changes: 4 additions & 2 deletions vendor_download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,17 @@ THEMIS_ASSET_POSTFIX=""
LERNIE_ASSET_POSTFIX=""
case "$(uname -s)" in
Darwin)
ASSET_POSTFIX="darwin"
THEMIS_ASSET_POSTFIX="darwin-amd64"
case "$(uname -m)" in
arm64)
ASSET_POSTFIX="darwin-arm64"
LERNIE_ASSET_POSTFIX="aarch64-macos"
THEMIS_ASSET_POSTFIX="darwin-arm64"
;;

*)
ASSET_POSTFIX="darwin-amd64"
LERNIE_ASSET_POSTFIX="x86_64-macos"
THEMIS_ASSET_POSTFIX="darwin-amd64"
;;
esac
;;
Expand Down

0 comments on commit bdbf560

Please sign in to comment.