Merge pull request #31 from brandonchinn178/updates #19
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: | |
pull_request: | |
push: | |
branches: | |
- main | |
workflow_call: | |
jobs: | |
build_and_test: | |
strategy: | |
matrix: | |
include: | |
- | |
stack_yaml: stack.yaml | |
latest: true | |
- | |
stack_yaml: stack-ghc-8.10.yaml | |
name: build_and_test (${{ matrix.stack_yaml }}) | |
runs-on: ubuntu-latest | |
env: | |
STACK_YAML: ${{ matrix.stack_yaml }} | |
steps: | |
- | |
uses: actions/checkout@v3 | |
- | |
uses: actions/cache@v3 | |
with: | |
path: ~/.stack | |
key: ${{ runner.os }}-stack-cache-${{ hashFiles(matrix.stack_yaml, 'package.yaml') }} | |
- | |
name: Build + Test | |
run: stack test --haddock --no-haddock-deps --coverage | |
- | |
name: Check that files are unmodified | |
run: git diff --exit-code | |
- | |
if: ${{ matrix.latest }} | |
name: Convert coverage output | |
run: stack install hpc-lcov && hpc-lcov | |
- | |
if: ${{ matrix.latest }} | |
uses: codecov/codecov-action@v3 | |
with: | |
files: lcov.info | |
ghc_compat_test: | |
strategy: | |
matrix: | |
ghc_version: | |
- '8.10' | |
- '9.0' | |
- '9.2' | |
- '9.4' | |
- '9.6' | |
name: ghc_compat_test (${{ matrix.ghc_version }}) | |
runs-on: ubuntu-latest | |
steps: | |
- | |
uses: actions/checkout@v3 | |
- | |
id: setup | |
name: Set up GHC ${{ matrix.ghc_version }} | |
uses: haskell-actions/setup@v2.4.0 | |
with: | |
ghc-version: ${{ matrix.ghc_version }} | |
- | |
name: Configure the build | |
run: | | |
cabal configure --test-show-details=streaming | |
cabal build --dry-run | |
- | |
name: Get current month to clear cache | |
run: echo "CURR_MONTH=$(date +%B)" | tee -a "$GITHUB_ENV" | |
- | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.setup.outputs.cabal-store }} | |
key: ${{ runner.os }}-cabal-cache-${{ env.CURR_MONTH }}-${{ matrix.ghc_version }}-${{ hashFiles('**/plan.json') }} | |
restore-keys: | | |
${{ runner.os }}-cabal-cache-${{ env.CURR_MONTH }}-${{ matrix.ghc_version }}- | |
- | |
name: Build + Test | |
run: cabal test | |
lint: | |
runs-on: ubuntu-latest | |
env: | |
FOURMOLU_VERSION: '0.12.0.0' | |
HLINT_VERSION: '3.5' | |
steps: | |
- | |
uses: actions/checkout@v3 | |
- | |
name: Install fourmolu | |
run: | | |
curl -fsSL \ | |
"https://github.com/fourmolu/fourmolu/releases/download/v${FOURMOLU_VERSION}/fourmolu-${FOURMOLU_VERSION}-linux-x86_64" \ | |
-o /usr/local/bin/fourmolu | |
chmod +x /usr/local/bin/fourmolu | |
- | |
name: Run fourmolu | |
run: fourmolu -m check . | |
- | |
name: Install hlint | |
run: | | |
tmpdir=$(mktemp -d) | |
curl -fsSL \ | |
"https://github.com/ndmitchell/hlint/releases/download/v${HLINT_VERSION}/hlint-${HLINT_VERSION}-x86_64-linux.tar.gz" \ | |
-o "${tmpdir}/hlint.tar.gz" | |
tar xzf "${tmpdir}/hlint.tar.gz" -C "${tmpdir}" | |
mv "${tmpdir}/hlint-${HLINT_VERSION}/hlint" /usr/local/bin/hlint | |
chmod +x /usr/local/bin/hlint | |
rm -rf "${tmpdir}" | |
- | |
name: Run hlint | |
run: hlint . | |
check_sdist: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
uses: actions/checkout@v3 | |
- | |
uses: actions/cache@v3 | |
with: | |
path: ~/.stack | |
key: ${{ runner.os }}-check_sdist-${{ hashFiles('stack.yaml', 'package.yaml') }} | |
- | |
name: Strip unreleased section from CHANGELOG | |
run: sed -i -n '/^# Unreleased/d; /^#/,$p' CHANGELOG.md | |
- | |
name: Create sdist bundle | |
run: stack sdist --test-tarball --tar-dir . | |
- | |
uses: actions/upload-artifact@v3 | |
with: | |
name: th-test-utils-sdist | |
path: th-test-utils-*.tar.gz |