Bump actions/cache from 3 to 4 #57
Workflow file for this run
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: | |
push: | |
branches: | |
- main | |
tags: | |
- "*" | |
paths: | |
- ".github/workflows/**" | |
- "servant-rate-limit/src/**" | |
- "servant-rate-limit/test/**" | |
- "servant-rate-limit/package.yaml" | |
- "wai-rate-limit/src/**" | |
- "wai-rate-limit/package.yaml" | |
- "wai-rate-limit-redis/src/**" | |
- "wai-rate-limit-redis/test/**" | |
- "wai-rate-limit-redis/package.yaml" | |
- "docker-compose.yaml" | |
- "stack*.yaml" | |
pull_request: | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
resolver: | |
- "stack-lts-16.1" | |
- "stack-lts-18" | |
- "stack-lts-19" | |
servant-server-flag: # on by default | |
- "" | |
- "--flag servant-rate-limit:-server" | |
servant-client-flag: # on by default | |
- "" | |
- "--flag servant-rate-limit:-client" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: haskell/actions/setup@v2 | |
id: install-haskell | |
with: | |
stack-no-global: true | |
enable-stack: true | |
stack-setup-ghc: true | |
stack-version: "latest" | |
- name: Write flags to file (for hashing) | |
run: | | |
echo ${{ matrix.servant-server-flag }} >> .cabal-flags | |
echo ${{ matrix.servant-client-flag }} >> .cabal-flags | |
cat .cabal-flags | |
- name: Cache .stack | |
id: cache-stack | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.install-haskell.outputs.stack-root }} | |
key: ${{ runner.os }}-${{ matrix.resolver }}-${{ hashFiles(format('{0}.yaml', matrix.resolver)) }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('.cabal-flags') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.resolver }}-${{ hashFiles(format('{0}.yaml', matrix.resolver)) }}-${{ hashFiles('**/*.cabal') }}- | |
${{ runner.os }}-${{ matrix.resolver }}-${{ hashFiles(format('{0}.yaml', matrix.resolver)) }}- | |
${{ runner.os }}-${{ matrix.resolver }}- | |
- name: Install dependencies | |
run: | | |
stack --stack-yaml=${{ matrix.resolver }}.yaml --no-terminal build \ | |
${{ matrix.servant-server-flag }} \ | |
${{ matrix.servant-client-flag }} \ | |
--only-dependencies --fast | |
- name: Build | |
id: build | |
run: | | |
stack --stack-yaml=${{ matrix.resolver }}.yaml --no-terminal build \ | |
${{ matrix.servant-server-flag }} \ | |
${{ matrix.servant-client-flag }} \ | |
--fast --test --no-run-tests | |
- name: Test | |
id: test | |
run: | | |
docker-compose up -d | |
stack --stack-yaml=${{ matrix.resolver }}.yaml --no-terminal test \ | |
${{ matrix.servant-server-flag }} \ | |
${{ matrix.servant-client-flag }} \ | |
--fast | |
docker-compose down |