CI #209
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
name: CI | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: [synchronize, opened, reopened] | |
push: | |
branches: [main] | |
tags: | |
- 'v*' | |
schedule: | |
# additionally run once per week (At 00:00 on Sunday) to maintain cache | |
- cron: '0 0 * * 0' | |
jobs: | |
stack: | |
name: ghc ${{ matrix.ghc }} / ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
stack: ["3.1.1"] | |
ghc: ["9.6.6"] | |
os: ["ubuntu-latest", "windows-2022"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Linux dependencies | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: | | |
sudo apt-get install nodejs zlib1g-dev libglew-dev librocksdb-dev | |
sudo apt-get install libxxf86vm-dev libxrandr-dev libxi-dev libxcursor-dev libxinerama-dev | |
- uses: haskell/actions/setup@v2.4 | |
name: Setup Haskell Stack | |
with: | |
ghc-version: ${{ matrix.ghc }} | |
stack-version: ${{ matrix.stack }} | |
- name: Install Windows dependencies | |
if: ${{ matrix.os == 'windows-2022' }} | |
run: | | |
stack exec --system-ghc -- pacman -Syyu --noconfirm | |
stack exec --system-ghc -- pacman -Syyu --noconfirm | |
stack exec --system-ghc -- pacman -S --noconfirm mingw-w64-x86_64-rocksdb | |
- uses: actions/cache@v4.0.2 | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
name: Cache ~/.stack | |
with: | |
path: ~/.stack | |
key: ${{ runner.os }}-${{ matrix.ghc }}-stack | |
- name: Install Haskell dependencies | |
run: | | |
stack build --system-ghc --test --bench --no-run-tests --no-run-benchmarks --only-dependencies | |
- name: Build | |
run: | | |
stack build --system-ghc --test --bench --no-run-tests --no-run-benchmarks | |
- name: Test | |
# Running the tests only on Linux should suffice | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: | | |
stack test --system-ghc | |
- name: Build release | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: | | |
stack exec --system-ghc -- bash tools/win_make_archive.sh | |
- name: Upload release | |
if: startsWith(github.ref, 'refs/tags/v') | |
id: upload-release-asset | |
uses: softprops/action-gh-release@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
files: ${{ matrix.os == 'ubuntu-latest' && 'lamdu-*-linux.tgz' || 'lamdu-*-win-setup.exe' }} | |
hlint: | |
name: hlint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run HLint | |
env: | |
HLINT_VERSION: "3.6.1" | |
run: | | |
curl -L https://github.com/ndmitchell/hlint/releases/download/v${HLINT_VERSION}/hlint-${HLINT_VERSION}-x86_64-linux.tar.gz --output hlint.tar.gz | |
tar -xvf hlint.tar.gz | |
./hlint-${HLINT_VERSION}/hlint src/ test/ |