CI: Build and test both x86-64 and AArch64 macOS

Fixes #1061.
This commit is contained in:
Ryan Scott 2024-02-12 10:19:32 -05:00
parent 1615d48799
commit 4067c3afec
3 changed files with 41 additions and 15 deletions

4
.github/ci.sh vendored
View File

@ -121,14 +121,14 @@ sign() {
zip_dist() {
: "${VERSION?VERSION is required as an environment variable}"
name="${name:-"cryptol-$VERSION-$OS_TAG-x86_64"}"
name="${name:-"cryptol-$VERSION-$OS_TAG-$ARCH_TAG"}"
cp -r dist "$name"
tar -cvzf "$name".tar.gz "$name"
}
zip_dist_with_solvers() {
: "${VERSION?VERSION is required as an environment variable}"
name="${name:-"cryptol-$VERSION-$OS_TAG-x86_64"}"
name="${name:-"cryptol-$VERSION-$OS_TAG-$ARCH_TAG"}"
sname="${name}-with-solvers"
cp "$(which abc)" dist/bin/
cp "$(which cvc4)" dist/bin/

View File

@ -64,17 +64,10 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-12, windows-2019]
os: [ubuntu-22.04]
ghc-version: ["9.2.8", "9.4.7", "9.6.2"]
cabal: [ '3.10.1.0' ]
run-tests: [true]
exclude:
- os: windows-2019
ghc-version: 9.4.7
run-tests: true
- os: windows-2019
ghc-version: 9.6.2
run-tests: true
include:
# We include one job from an older Ubuntu LTS release to increase our
# coverage of possible Linux configurations. Since we already run the
@ -82,6 +75,19 @@ jobs:
- os: ubuntu-20.04
ghc-version: 9.2.8
run-tests: false
# Windows and macOS CI runners are more expensive than Linux runners,
# so we only build one particular GHC version to test them on. We
# include both an x86-64 macOS runner (macos-12) as well as an AArch64
# macOS runner (macos-14).
- os: windows-2019
ghc-version: 9.2.8
run-tests: true
- os: macos-12
ghc-version: 9.2.8
run-tests: true
- os: macos-14
ghc-version: 9.2.8
run-tests: true
outputs:
test-lib-json: ${{ steps.test-lib.outputs.targets-json }}
env:
@ -181,19 +187,21 @@ jobs:
- shell: bash
run: |
NAME="${{ needs.config.outputs.name }}-${{ matrix.os }}-x86_64"
NAME="${{ needs.config.outputs.name }}-${{ matrix.os }}-${{ runner.arch }}"
echo "NAME=$NAME" >> $GITHUB_ENV
.github/ci.sh zip_dist $NAME
env:
OS_TAG: ${{ matrix.os }}
ARCH_TAG: ${{ runner.arch }}
- shell: bash
run: |
NAME="${{ needs.config.outputs.name }}-${{ matrix.os }}-x86_64"
NAME="${{ needs.config.outputs.name }}-${{ matrix.os }}-${{ runner.arch }}"
echo "NAME=$NAME" >> $GITHUB_ENV
.github/ci.sh zip_dist_with_solvers $NAME
env:
OS_TAG: ${{ matrix.os }}
ARCH_TAG: ${{ runner.arch }}
- if: github.event.pull_request.head.repo.fork == false
shell: bash
@ -256,7 +264,7 @@ jobs:
matrix:
suite: [test-lib]
target: ${{ fromJson(needs.build.outputs.test-lib-json) }}
os: [ubuntu-22.04, macos-12, windows-2019]
os: [ubuntu-22.04, macos-14, windows-2019]
continue-on-error: [false]
include:
- suite: rpc
@ -280,6 +288,24 @@ jobs:
with:
ghc-version: '9.2.8'
# Homebrew installs packages in different directories depending on which
# macOS architecture you are using:
#
# * /usr/local (X64)
# * /opt/homebrew (ARM64)
#
# Clang automatically searches in /usr/local without any additional setup,
# but it doesn't know about /opt/homebrew. As such, we have to teach Clang
# to do so by setting the appropriate environment variables.
#
# This step is important for the FFI unit tests, which rely on a
# Homebrew-provided version of gmp.
- name: Teach Clang about Homebrew paths (macOS ARM64)
run: |
echo "CPATH=/opt/homebrew/include" >> $GITHUB_ENV
echo "LIBRARY_PATH=/opt/homebrew/lib" >> $GITHUB_ENV
if: matrix.suite == 'test-lib' && runner.os == 'macOS' && runner.arch == 'ARM64'
- name: Install dependencies (Windows)
uses: msys2/setup-msys2@v2
with:

View File

@ -17,9 +17,9 @@ module Cryptol.Backend.Arch where
-- experiments show that it's somewhere under 2^37 at least on 64-bit
-- Mac OS X.
maxBigIntWidth :: Integer
#if i386_HOST_ARCH
#if defined(i386_HOST_ARCH)
maxBigIntWidth = 2^(32 :: Integer) - 0x1
#elif x86_64_HOST_ARCH
#elif defined(x86_64_HOST_ARCH) || defined(aarch64_HOST_ARCH)
maxBigIntWidth = 2^(37 :: Integer) - 0x100
#else
-- Because GHC doesn't seem to define a CPP macro that will portably