WIP: Bump Stackage to LTS-19.33 #507
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SPDX-FileCopyrightText: 2020 Kowainik | |
# SPDX-FileCopyrightText: 2022 Serokell <https://serokell.io/> | |
# | |
# SPDX-License-Identifier: MPL-2.0 | |
# Sources: | |
# • https://github.com/kowainik/validation-selective/blob/5b46cd4810bbaa09b704062ebbfa2bb47137425d/.github/workflows/ci.yml | |
# • https://kodimensional.dev/github-actions | |
# • https://github.com/serokell/tztime/blob/336f585c2c7125a8ba58ffbf3dbea4f36a7c40e7/.github/workflows/ci.yml | |
name: CI | |
on: | |
pull_request: | |
push: | |
branches: master | |
jobs: | |
validate: | |
runs-on: [self-hosted, nix] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: reuse | |
run: nix build -L .#checks.x86_64-linux.reuse-lint | |
# Run step even if the previous one has failed | |
if: success() || failure() | |
- name: hlint | |
run: nix build -L .#checks.x86_64-linux.hlint | |
if: success() || failure() | |
- name: shellcheck | |
run: nix build -L .#checks.x86_64-linux.shellcheck | |
if: success() || failure() | |
- name: stylish-haskell | |
run: nix build -L .#checks.x86_64-linux.stylish-haskell | |
if: success() || failure() | |
- name: check-trailing-whitespace | |
run: nix build -L .#checks.x86_64-linux.trailing-whitespace | |
if: success() || failure() | |
xrefcheck-build-and-test-windows: | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
stack: ["2.7.5"] | |
ghc: ["9.0.2"] | |
include: | |
- ghc: "9.0.2" | |
stackyaml: stack.yaml | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'true' | |
- uses: haskell/actions/[email protected] | |
id: setup-haskell-stack | |
name: Setup Haskell Stack | |
with: | |
ghc-version: ${{ matrix.ghc }} | |
stack-version: ${{ matrix.stack }} | |
- uses: actions/cache@v3 | |
name: Cache stack root | |
with: | |
path: ~/AppData/Roaming/stack | |
key: ${{ runner.os }}-${{ matrix.ghc }}-stack | |
- uses: actions/cache@v3 | |
name: Cache AppData/Local/Programs/stack | |
with: | |
path: ~/AppData/Local/Programs/stack | |
key: ${{ runner.os }}-${{ matrix.ghc }}-appdata-stack | |
# When editing this action, make sure it can run without using cached folders. | |
# Yes, it tries to install mingw-w64-x86_64-pcre twice | |
- name: install pacman dependencies | |
run: | | |
stack --system-ghc exec -- pacman -S --needed --noconfirm pkgconf; | |
stack --system-ghc exec -- pacman -S --needed --noconfirm msys2-keyring; | |
stack --system-ghc exec -- pacman --noconfirm -Syuu; | |
stack --system-ghc exec -- pacman -S --needed --noconfirm mingw-w64-x86_64-pcre; | |
stack --system-ghc exec -- pacman --noconfirm -Syuu; | |
stack --system-ghc exec -- pacman -S --needed --noconfirm mingw-w64-x86_64-pcre; | |
stack --system-ghc exec -- pacman -S --needed --noconfirm pcre-devel; | |
- name: Build | |
run: | | |
stack build --system-ghc --stack-yaml ${{ matrix.stackyaml }} --test --bench --no-run-tests --no-run-benchmarks --ghc-options '-Werror' | |
- name: stack test xrefcheck:xrefcheck-tests | |
run: | | |
stack test --system-ghc --stack-yaml ${{ matrix.stackyaml }} xrefcheck:xrefcheck-tests | |
- name: install xrefcheck to use with golden tests | |
run: | | |
stack --system-ghc --stack-yaml ${{ matrix.stackyaml }} install; | |
- uses: mig4/setup-bats@v1 | |
name: Setup bats | |
- name: Golden tests | |
run: | | |
export PATH=$PATH:/c/Users/runneradmin/AppData/Roaming/local/bin; | |
bats ./tests/golden/** | |
shell: bash | |
xrefcheck-build-and-test-nix: | |
runs-on: [self-hosted, nix] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: build | |
run: nix build -L .#xrefcheck | |
- name: test | |
run: nix build -L .#checks.x86_64-linux.test | |
- name: Golden tests (bats) | |
run: nix shell .#bats .#diffutils .#xrefcheck -c bash -c "cd tests/golden/ && bats ./**" | |
- name: windows cross-compilation | |
run: | | |
nix build -L .#xrefcheck-windows | |
echo "WINDOWS_BINARY_PATH=$(readlink -f result)" >> $GITHUB_ENV | |
- name: Upload windows executable | |
uses: actions/upload-artifact@v4 | |
with: | |
name: xrefcheck-windows | |
path: ${{ env.WINDOWS_BINARY_PATH }}/bin/* | |
- name: docker-image | |
run: nix build -L .#docker-image | |
- name: static binary | |
run: | | |
nix build -L .#xrefcheck-static | |
echo "STATIC_BINARY_PATH=$(readlink -f result)" >> $GITHUB_ENV | |
- name: Upload static binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: xrefcheck-static | |
path: ${{ env.STATIC_BINARY_PATH }}/bin/xrefcheck | |
- name: Xrefcheck itself | |
run: nix run . -L |