Skip to content

Commit 1bacc50

Browse files
committed
Add ARM64 emulated CI check
1 parent 6335281 commit 1bacc50

File tree

1 file changed

+58
-1
lines changed

1 file changed

+58
-1
lines changed

.github/workflows/ci.yml

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
name: Validate
1+
name: Validate Docker
22

33
on:
44
pull_request:
55
branches:
66
- master
7+
paths:
8+
- '**/Dockerfile'
9+
- '.github/workflows/**'
710

811
jobs:
912
build-smoke-test:
@@ -47,3 +50,57 @@ jobs:
4750
- uses: hadolint/[email protected]
4851
with:
4952
recursive: true
53+
54+
emulated-architecture-tests:
55+
permissions:
56+
contents: read
57+
packages: write
58+
timeout-minutes: 60
59+
runs-on: ubuntu-latest
60+
name: ${{ matrix.arch }}-${{ matrix.ghc }}-${{ matrix.deb }}
61+
strategy:
62+
fail-fast: false
63+
matrix:
64+
ghc: ['8.10.7', '9.0.2', '9.2.1']
65+
deb: ['buster']
66+
arch: ['aarch64']
67+
include:
68+
- ghc: '8.10.7'
69+
ghc_minor: '8.10'
70+
- ghc: '9.0.2'
71+
ghc_minor: '9.0'
72+
- ghc: '9.2.1'
73+
ghc_minor: '9.2'
74+
- arch: aarch64
75+
docker_platform: arm64
76+
steps:
77+
- uses: actions/checkout@v2
78+
- name: docker build [ ${{ matrix.arch }} ${{ matrix.ghc }}]
79+
uses: uraimo/run-on-arch-action@e9117b926d001f8683802c315b5a134f8c5da3d3
80+
with:
81+
arch: ${{ matrix.arch }}
82+
distro: ${{ matrix.deb }}
83+
githubToken: ${{ github.token }}
84+
dockerRunArgs:
85+
--volume /var/run/docker.sock:/var/run/docker.sock
86+
install: |
87+
apt-get update
88+
apt-get install -y curl
89+
curl -fsSL https://get.docker.com | sh
90+
run: |
91+
docker build --pull \
92+
--platform "linux/${{ matrix.docker_platform }}" \
93+
-t haskell:${{ matrix.ghc }}-${{ matrix.deb }} \
94+
${{ matrix.ghc_minor }}/${{ matrix.deb }}
95+
echo 'testing..'
96+
docker run \
97+
--platform "linux/${{ matrix.docker_platform }}" \
98+
-t haskell:${{ matrix.ghc }}-${{ matrix.deb }} \
99+
bash -c "cabal update && cabal install --lib hashable"
100+
docker run \
101+
--platform "linux/${{ matrix.docker_platform }}" \
102+
-t haskell:${{ matrix.ghc }}-${{ matrix.deb }} \
103+
bash -c "echo | ghci"
104+
105+
# Running the official tests does not work as we need to hardcode the plaform due to the emulated nature.
106+
# This solution is fairly hacky, but gets us most of benefit of the official tests.

0 commit comments

Comments
 (0)