|
| 1 | +# SPDX-FileCopyrightText: 2020 Kowainik |
| 2 | +# SPDX-FileCopyrightText: 2022 Serokell <https://serokell.io/> |
| 3 | +# |
| 4 | +# SPDX-License-Identifier: MPL-2.0 |
| 5 | + |
| 6 | +# Sources: |
| 7 | +# • https://github.com/kowainik/validation-selective/blob/5b46cd4810bbaa09b704062ebbfa2bb47137425d/.github/workflows/ci.yml |
| 8 | +# • https://kodimensional.dev/github-actions |
| 9 | +# • https://github.com/serokell/tztime/blob/336f585c2c7125a8ba58ffbf3dbea4f36a7c40e7/.github/workflows/ci.yml |
| 10 | + |
| 11 | +name: CI |
| 12 | + |
| 13 | +on: [push] |
| 14 | + |
| 15 | +jobs: |
| 16 | + xrefcheck-build-and-test: |
| 17 | + runs-on: windows-latest |
| 18 | + strategy: |
| 19 | + matrix: |
| 20 | + stack: ["2.7.5"] |
| 21 | + ghc: ["9.0.2"] |
| 22 | + include: |
| 23 | + - ghc: "9.0.2" |
| 24 | + stackyaml: stack.yaml |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v3 |
| 27 | + with: |
| 28 | + submodules: 'true' |
| 29 | + |
| 30 | + - uses: haskell/actions/[email protected] |
| 31 | + id: setup-haskell-stack |
| 32 | + name: Setup Haskell Stack |
| 33 | + with: |
| 34 | + ghc-version: ${{ matrix.ghc }} |
| 35 | + stack-version: ${{ matrix.stack }} |
| 36 | + |
| 37 | + - uses: actions/cache@v3 |
| 38 | + name: Cache stack root |
| 39 | + with: |
| 40 | + path: ~/AppData/Roaming/stack |
| 41 | + key: ${{ runner.os }}-${{ matrix.ghc }}-stack |
| 42 | + |
| 43 | + - uses: actions/cache@v3 |
| 44 | + name: Cache AppData/Local/Programs/stack |
| 45 | + with: |
| 46 | + path: ~/AppData/Local/Programs/stack |
| 47 | + key: ${{ runner.os }}-${{ matrix.ghc }}-appdata-stack |
| 48 | + |
| 49 | + |
| 50 | +# When editing this action, make sure it can run without using cached folders. |
| 51 | +# Yes, it tries to install mingw-w64-x86_64-pcre twice |
| 52 | + - name: install pacman dependencies |
| 53 | + run: | |
| 54 | + stack --system-ghc exec -- pacman -S --needed --noconfirm pkgconf; |
| 55 | + stack --system-ghc exec -- pacman -S --needed --noconfirm msys2-keyring; |
| 56 | + stack --system-ghc exec -- pacman --noconfirm -Syuu; |
| 57 | + stack --system-ghc exec -- pacman -S --needed --noconfirm mingw-w64-x86_64-pcre; |
| 58 | + stack --system-ghc exec -- pacman --noconfirm -Syuu; |
| 59 | + stack --system-ghc exec -- pacman -S --needed --noconfirm mingw-w64-x86_64-pcre; |
| 60 | + stack --system-ghc exec -- pacman -S --needed --noconfirm pcre-devel; |
| 61 | +
|
| 62 | + - name: Build |
| 63 | + run: | |
| 64 | + stack build --system-ghc --stack-yaml ${{ matrix.stackyaml }} --test --bench --no-run-tests --no-run-benchmarks --ghc-options '-Werror' |
| 65 | +
|
| 66 | + - name: stack test xrefcheck:xrefcheck-tests |
| 67 | + run: | |
| 68 | + stack test --system-ghc --stack-yaml ${{ matrix.stackyaml }} xrefcheck:xrefcheck-tests |
| 69 | +
|
| 70 | + - name: install xrefcheck to use with golden tests |
| 71 | + run: | |
| 72 | + stack --system-ghc --stack-yaml ${{ matrix.stackyaml }} install; |
| 73 | +
|
| 74 | + - uses: mig4/setup-bats@v1 |
| 75 | + name: Setup bats |
| 76 | + |
| 77 | + - name: Golden tests |
| 78 | + run: | |
| 79 | + export PATH=$PATH:/c/Users/runneradmin/AppData/Roaming/local/bin; |
| 80 | + bats ./tests/golden/** |
| 81 | + shell: bash |
0 commit comments