Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try Apple AArch64 again (backport #10363) #10399

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 72 additions & 22 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,33 +69,54 @@ env:

jobs:
validate:
name: Validate ${{ matrix.os }} ghc-${{ matrix.ghc }}
runs-on: ${{ matrix.os }}
name: Validate ${{ matrix.sys.os }} ghc-${{ matrix.ghc }}
runs-on: ${{ matrix.sys.os }}
outputs:
GHC_FOR_RELEASE: ${{ format('["{0}"]', env.GHC_FOR_RELEASE) }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-13, windows-latest]
sys:
- { os: windows-latest, shell: "C:/msys64/usr/bin/bash.exe -e {0}" }
- { os: ubuntu-22.04, shell: bash }
- { os: macos-latest, shell: bash }
# If you remove something from here, then add it to the old-ghcs job.
# Also a removed GHC from here means that we are actually dropping
# support, so the PR *must* have a changelog entry.
ghc: ['9.10.1', '9.8.2', '9.6.4', '9.4.8', '9.2.8', '9.0.2', '8.10.7', '8.8.4', '8.6.5']
exclude:
# Throws fatal "cabal-tests.exe: fd:8: hGetLine: end of file" exception
# even with --io-manager=native
- os: windows-latest
- sys:
{ os: windows-latest, shell: "C:/msys64/usr/bin/bash.exe -e {0}" }
ghc: "9.0.2"
# corrupts GHA cache or the fabric of reality itself, see https://github.com/haskell/cabal/issues/8356
- os: windows-latest
- sys:
{ os: windows-latest, shell: "C:/msys64/usr/bin/bash.exe -e {0}" }
ghc: '8.10.7'
# lot of segfaults caused by ghc bugs
- os: windows-latest
ghc: '8.8.4'
# it often randomly does "C:\Users\RUNNER~1\AppData\Local\Temp\ghcFEDE.c: DeleteFile "\\\\?\\C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\ghcFEDE.c": permission denied (Access is denied.)"
- os: windows-latest
ghc: '8.6.5'

- sys:
{ os: windows-latest, shell: "C:/msys64/usr/bin/bash.exe -e {0}" }
ghc: "8.8.4"
# ghc before 8.10.5 doesn't run on AArch64
# 9.0.2 suffers from https://gitlab.haskell.org/ghc/ghc/-/issues/20592
# 8.10.7 throws asm errors in hashable's cbits suggesting the runner doesn't
# support a CPU extension for hardware SHA; may be fixable with flags
- sys:
{ os: macos-latest, shell: bash }
ghc: "9.0.2"
- sys:
{ os: macos-latest, shell: bash }
ghc: "8.10.7"
- sys:
{ os: macos-latest, shell: bash }
ghc: "8.8.4"
- sys:
{ os: macos-latest, shell: bash }
ghc: "8.6.5"
defaults:
run:
shell: ${{ matrix.sys.shell }}
steps:

- name: Work around XDG directories existence (haskell-actions/setup#62)
Expand Down Expand Up @@ -172,6 +193,16 @@ jobs:
- name: Validate build
run: sh validate.sh $FLAGS -s build

- name: Canonicalize architecture
run: |
case ${{ runner.arch }} in
X86) arch=i386 ;;
X64) arch=x86_64 ;;
ARM64) arch=aarch64 ;;
*) echo "Unsupported architecture, please fix validate.yaml" 2>/dev/null; exit 1 ;;
esac
echo "CABAL_ARCH=$arch" >> "$GITHUB_ENV"

- name: Tar cabal head executable
if: matrix.ghc == env.GHC_FOR_RELEASE
run: |
Expand All @@ -190,7 +221,7 @@ jobs:
fi
DIR=$(dirname "$CABAL_EXEC")
FILE=$(basename "$CABAL_EXEC")
CABAL_EXEC_TAR="cabal-head-${{ runner.os }}-x86_64.tar.gz"
CABAL_EXEC_TAR="cabal-head-${{ runner.os }}-$CABAL_ARCH.tar.gz"
tar -czvf "$CABAL_EXEC_TAR" -C "$DIR" "$FILE"
echo "CABAL_EXEC_TAR=$CABAL_EXEC_TAR" >> "$GITHUB_ENV"

Expand All @@ -201,7 +232,7 @@ jobs:
if: matrix.ghc == env.GHC_FOR_RELEASE
uses: actions/upload-artifact@v4
with:
name: cabal-${{ runner.os }}-x86_64
name: cabal-${{ runner.os }}-${{ env.CABAL_ARCH }}
path: ${{ env.CABAL_EXEC_TAR }}

- name: Validate lib-tests
Expand Down Expand Up @@ -356,18 +387,36 @@ jobs:
# This one uses the cabal HEAD generated executable in the previous step
# to build itself again, as sanity check
dogfooding:
name: Dogfooding ${{ matrix.os }} ghc-${{ matrix.ghc }}
runs-on: ${{ matrix.os }}
name: Dogfooding ${{ matrix.sys.os }} ghc-${{ matrix.ghc }}
runs-on: ${{ matrix.sys.os }}
needs: validate
strategy:
matrix:
os: [ubuntu-22.04, macos-13, windows-latest]
sys:
- { os: windows-latest, shell: "C:/msys64/usr/bin/bash.exe -e {0}" }
- { os: ubuntu-22.04, shell: bash }
- { os: macos-latest, shell: bash }
# We only use one ghc version the used one for the next release (defined at top of the workflow)
# We need to build an array dynamically to inject the appropiate env var in a previous job,
# see https://docs.github.com/en/actions/learn-github-actions/expressions#fromjson
ghc: ${{ fromJSON (needs.validate.outputs.GHC_FOR_RELEASE) }}

defaults:
run:
shell: ${{ matrix.sys.shell }}

steps:
# TODO: make a reusable action for this
- name: Canonicalize architecture
run: |
case ${{ runner.arch }} in
X86) arch=i386 ;;
X64) arch=x86_64 ;;
ARM64) arch=aarch64 ;;
*) echo "Unsupported architecture" 2>/dev/null; exit 1 ;;
esac
echo "CABAL_ARCH=$arch" >> "$GITHUB_ENV"

- name: Work around XDG directories existence (haskell-actions/setup#62)
if: runner.os == 'macOS'
run: |
Expand All @@ -385,11 +434,11 @@ jobs:
- name: Download cabal executable from workflow artifacts
uses: actions/download-artifact@v4
with:
name: cabal-${{ runner.os }}-x86_64
name: cabal-${{ runner.os }}-${{ env.CABAL_ARCH }}
path: cabal-head

- name: Untar the cabal executable
run: tar -xzf "./cabal-head/cabal-head-${{ runner.os }}-x86_64.tar.gz" -C cabal-head
run: tar -xzf "./cabal-head/cabal-head-${{ runner.os }}-$CABAL_ARCH.tar.gz" -C cabal-head

- name: print-config using cabal HEAD
run: sh validate.sh ${{ env.COMMON_FLAGS }} --with-cabal ./cabal-head/cabal -s print-config
Expand All @@ -408,6 +457,7 @@ jobs:
needs: [validate, validate-old-ghcs, build-alpine, dogfooding]

steps:
# for now this is hardcoded. is there a better way?
- uses: actions/download-artifact@v4
with:
name: cabal-Windows-x86_64
Expand All @@ -422,7 +472,7 @@ jobs:

- uses: actions/download-artifact@v4
with:
name: cabal-macOS-x86_64
name: cabal-macOS-aarch64

- name: Create GitHub prerelease
uses: marvinpinto/action-automatic-releases@v1.2.1
Expand All @@ -435,7 +485,7 @@ jobs:
cabal-head-Windows-x86_64.tar.gz
cabal-head-Linux-x86_64.tar.gz
cabal-head-Linux-static-x86_64.tar.gz
cabal-head-macOS-x86_64.tar.gz
cabal-head-macOS-aarch64.tar.gz

prerelease-lts:
name: Create a GitHub LTS prerelease with the binary artifacts
Expand Down Expand Up @@ -468,7 +518,7 @@ jobs:
mv cabal-{,lts-}head-Windows-x86_64.tar.gz
mv cabal-{,lts-}head-Linux-x86_64.tar.gz
mv cabal-{,lts-}head-Linux-static-x86_64.tar.gz
mv cabal-{,lts-}head-macOS-x86_64.tar.gz
mv cabal-{,lts-}head-macOS-aarch64.tar.gz

- name: Create GitHub prerelease
uses: marvinpinto/action-automatic-releases@v1.2.1
Expand All @@ -481,7 +531,7 @@ jobs:
cabal-lts-head-Windows-x86_64.tar.gz
cabal-lts-head-Linux-x86_64.tar.gz
cabal-lts-head-Linux-static-x86_64.tar.gz
cabal-lts-head-macOS-x86_64.tar.gz
cabal-lts-head-macOS-aarch64.tar.gz

# We use this job as a summary of the workflow
# It will fail if any of the previous jobs does
Expand Down
20 changes: 19 additions & 1 deletion validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -308,15 +308,33 @@ JOBS="-j$JOBS"
# assume compiler is GHC
RUNHASKELL=$(echo "$HC" | sed -E 's/ghc(-[0-9.]*)$/runghc\1/')

ARCH=$(uname -m)

case "$ARCH" in
arm64)
ARCH=aarch64
;;
x86_64)
ARCH=x86_64
;;
*)
echo "Warning: Unknown architecture '$ARCH'"
;;
esac

case "$(uname)" in
MINGW64*)
ARCH="x86_64-windows"
;;
Linux )
ARCH="x86_64-linux"
;;
Darwin)
ARCH="$ARCH-osx"
;;
*)
ARCH="x86_64-osx"
echo "Warning: Unknown operating system '$OS'"
ARCH="$ARCH-$OS"
;;
esac

Expand Down
Loading