Merge pull request #111 from SamirTalwar/dependabot/github_actions/do… #417
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: Verify | |
on: | |
pull_request: | |
push: | |
jobs: | |
build-unix: | |
name: Build | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-20.04 | |
- macos-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Check out | |
uses: actions/checkout@v3 | |
- name: Get GHC version | |
id: ghc-version | |
run: echo "ghc-version=$(cat ghc.version)" >> "$GITHUB_OUTPUT" | |
- name: Set up Haskell | |
id: haskell-setup | |
uses: haskell/actions/setup@v2 | |
with: | |
ghc-version: ${{ steps.ghc-version.outputs.ghc-version }} | |
enable-stack: true | |
stack-no-global: true | |
stack-setup-ghc: true | |
- name: Cache the Stack directory | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.haskell-setup.outputs.stack-root }} | |
key: v1-${{ matrix.os }}-stack-${{ hashFiles('stack.yaml', 'package.yaml') }} | |
- name: Install dependencies | |
run: stack --no-terminal install --only-dependencies --test --no-run-tests | |
- name: Build | |
run: stack --no-terminal install --test --no-run-tests --local-bin-path=./out/build/release | |
- name: Upload Smoke | |
uses: actions/upload-artifact@v4 | |
with: | |
name: smoke-${{ matrix.os }} | |
path: out/build/release/smoke | |
- name: Run unit tests | |
run: stack --no-terminal test | |
spec-unix: | |
name: Spec | |
needs: build-unix | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-20.04 | |
- macos-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Check out | |
uses: actions/checkout@v3 | |
- name: Download Smoke | |
uses: actions/download-artifact@v4 | |
with: | |
name: smoke-${{ matrix.os }} | |
- name: Make Smoke executable | |
run: chmod +x smoke | |
- name: Spec | |
run: ./smoke --command=./smoke spec | |
build-test-nix: | |
name: Build and Test with Nix | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Check out | |
uses: actions/checkout@v3 | |
- name: Install Nix | |
uses: cachix/install-nix-action@v20 | |
- name: Set up the Nix cache | |
uses: cachix/cachix-action@v12 | |
with: | |
name: smoke | |
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" | |
- name: Build and Test | |
run: nix build --out-link ./out/build/nix | |
- name: Spec | |
run: ./out/build/nix/bin/smoke --command=./out/build/nix/bin/smoke spec | |
build-windows: | |
name: Build (windows-latest) | |
runs-on: windows-latest | |
steps: | |
- name: Check out | |
uses: actions/checkout@v3 | |
- name: Cache Stack | |
uses: actions/cache@v3 | |
with: | |
path: C:\Users\runneradmin\AppData\Local\Programs\stack | |
key: v1-windows-latest-stack-${{ hashFiles('stack.yaml') }} | |
- name: Get GHC version | |
id: ghc-version | |
run: echo "ghc-version=$(Get-Content ghc.version)" >> "$Env:GITHUB_OUTPUT" | |
- name: Set up Haskell | |
id: haskell-setup | |
uses: haskell/actions/setup@v2 | |
with: | |
ghc-version: ${{ steps.ghc-version.outputs.ghc-version }} | |
enable-stack: true | |
stack-no-global: true | |
stack-setup-ghc: true | |
- name: Cache the Stack root | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.haskell-setup.outputs.stack-root }} | |
key: v1-windows-latest-stack-root-${{ hashFiles('stack.yaml', 'package.yaml') }} | |
- name: Update MSYS2 | |
run: | | |
stack --no-terminal exec -- pacman --noconfirm -Sy msys2-keyring | |
stack --no-terminal exec -- pacman --noconfirm -Syuu | |
- name: Build | |
run: 'stack --no-terminal install --test --no-run-tests --local-bin-path=.\out\build\release' | |
- name: Upload Smoke | |
uses: actions/upload-artifact@v4 | |
with: | |
name: smoke-windows-latest | |
path: 'out\build\release\smoke.exe' | |
- name: Run unit tests | |
run: "stack --no-terminal test" | |
spec-windows: | |
name: Spec (windows-latest) | |
needs: build-windows | |
runs-on: windows-latest | |
steps: | |
- name: Check out | |
uses: actions/checkout@v3 | |
- name: Download Smoke | |
uses: actions/download-artifact@v4 | |
with: | |
name: smoke-windows-latest | |
- name: Spec | |
run: '.\smoke.exe --command=.\smoke.exe spec' | |
lint: | |
name: Lint | |
needs: build-unix | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Check out | |
uses: actions/checkout@v3 | |
- name: Install Nix | |
uses: cachix/install-nix-action@v20 | |
- name: Set up the Nix cache | |
uses: cachix/cachix-action@v12 | |
with: | |
name: samirtalwar | |
- name: Lint | |
run: nix develop .#lint --command make lint |