Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify the CI and caching #58

Merged
merged 3 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 12 additions & 44 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,57 +3,31 @@ name: build
jobs:
runhaskell:
name: Run Haskell
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os:
- ubuntu
snapshot:
- 'lts-22.13'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: haskell-actions/setup@main
name: Setup Haskell Stack
id: setuphaskell
with:
enable-stack: true
stack-no-global: true

- uses: actions/cache/restore@v3
- uses: actions/cache@v4
name: Cache stack files
with:
path: ${{ steps.setuphaskell.outputs.stack-root }}
key: ${{ runner.os }}-${{ matrix.snapshot }}-stack2
- uses: actions/checkout@v4

- name: Setup stack.yaml
shell: bash
run: |
set -x
mv -vf "stack-ci.yaml" ./stack.yaml || true
mv -vf "stack-${{ matrix.snapshot }}.yaml" ./stack.yaml || true
mv -vf "stack-${{ matrix.snapshot }}-${{ matrix.os }}.yaml" ./stack.yaml || true
path: ~/.stack
key: ${{ runner.os }}-stack-global-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }}
restore-keys: |
${{ runner.os }}-stack-global-

- name: Build and test
shell: bash
run: |
set -x
grep . stack.yaml
if grep SKIP stack.yaml; then
echo Skipped because that snapshot is broken
exit 0
fi
stack setup --resolver=${{ matrix.snapshot }}
echo "stack_root: ${{ steps.setuphaskell.outputs.stack-root }}"
set -euo pipefail
stack --version
stack --resolver=${{ matrix.snapshot }} ghc -- --version

# we first build everything without running the tests (with unlimited parallelism)
stack build --resolver=${{ matrix.snapshot }} --ghc-options=-Werror --test --bench --no-run-tests

# once that's done we run the tests in a single threaded fashion to avoid
# https://github.com/commercialhaskell/stack/issues/5024#issuecomment-845001389
stack build --resolver=${{ matrix.snapshot }} --ghc-options=-Werror --test --bench -j 1
stack setup
stack ghc -- --version
stack test

- run: ./build_hsfiles.sh > pdepreludat.hsfiles

Expand All @@ -66,9 +40,3 @@ jobs:
title: "Draft"
files: |
pdepreludat.hsfiles

- uses: actions/cache/save@v3
if: always()
with:
path: ${{ steps.setuphaskell.outputs.stack-root }}
key: ${{ runner.os }}-${{ matrix.snapshot }}-stack2
30 changes: 0 additions & 30 deletions the-template/.circleci/config.yml

This file was deleted.

65 changes: 12 additions & 53 deletions the-template/.github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,70 +4,29 @@ name: build
jobs:
runhaskell:
name: Run Haskell
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os:
- ubuntu
snapshot:
- 'lts-22.13'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: haskell-actions/setup@main
name: Setup Haskell Stack
id: setuphaskell
with:
enable-stack: true
stack-no-global: true
stack-version: '2.13.1'

- uses: actions/cache/restore@v3
- uses: actions/cache@v4
name: Cache stack files
with:
path: ${{ steps.setuphaskell.outputs.stack-root }}
key: ${{ runner.os }}-${{ matrix.snapshot }}-stack2

- uses: actions/checkout@v4

- name: Setup stack.yaml
shell: bash
run: |
set -x
mv -vf "stack-ci.yaml" ./stack.yaml || true
mv -vf "stack-${{ matrix.snapshot }}.yaml" ./stack.yaml || true
mv -vf "stack-${{ matrix.snapshot }}-${{ matrix.os }}.yaml" ./stack.yaml || true
path: ~/.stack
key: ${{ runner.os }}-stack-global-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }}
restore-keys: |
${{ runner.os }}-stack-global-

- name: Build and test
shell: bash
run: |
set -x
grep . stack.yaml
if grep SKIP stack.yaml; then
echo Skipped because that snapshot is broken
exit 0
fi
stack setup --resolver=${{ matrix.snapshot }}
echo "stack_root: ${{ steps.setuphaskell.outputs.stack-root }}"
set -euo pipefail
stack --version
stack --resolver=${{ matrix.snapshot }} ghc -- --version

# we run the tests in a single threaded fashion to avoid
# https://github.com/commercialhaskell/stack/issues/5024#issuecomment-845001389
stack build --resolver=${{ matrix.snapshot }} --ghc-options=-Werror --test --bench -j 1

- run: ./build_hsfiles.sh > pdepreludat.hsfiles
- uses: "marvinpinto/action-automatic-releases@latest"
if: github.ref == 'refs/heads/master'
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "draft"
prerelease: true
title: "Draft"
files: |
pdepreludat.hsfiles
- uses: actions/cache/save@v3
if: always()
with:
path: ${{ steps.setuphaskell.outputs.stack-root }}
key: ${{ runner.os }}-${{ matrix.snapshot }}-stack2
stack setup
stack ghc -- --version
stack test
# <%={{ }}=%>
Loading