|
1 |
| -name: Validate |
| 1 | +name: Validate Docker |
2 | 2 |
|
3 | 3 | on:
|
4 | 4 | pull_request:
|
5 | 5 | branches:
|
6 | 6 | - master
|
| 7 | + paths: |
| 8 | + - '**/Dockerfile' |
| 9 | + - '.github/workflows/**' |
7 | 10 |
|
8 | 11 | jobs:
|
9 | 12 | build-smoke-test:
|
|
47 | 50 | - uses: hadolint/[email protected]
|
48 | 51 | with:
|
49 | 52 | 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