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

Small improvements to CI #132

Merged
merged 5 commits into from
Feb 7, 2025
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
5 changes: 4 additions & 1 deletion .ci/apply_settings.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#!/bin/bash

set -uo pipefail

if [[ "$check_haddock" != @(True|False) ]]; then
echo "check_haddock: Expected True or False, got \"$check_haddock\"" >&2
exit 1
fi
sed <.ci/cabal.project.local.in >cabal.project.local "
s/__CHECK_HADDOCK__/$check_haddock/"
s/__CHECK_HADDOCK__/$check_haddock/
s/__CLASH_VERSION__/$clash_version/"
Comment on lines +10 to +11
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had no idea you could chain commands like this. Cool.

5 changes: 1 addition & 4 deletions .ci/build_docs.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#!/bin/bash
set -xeou pipefail

cabal v2-haddock \
--constraint=clash-prelude==$clash_version \
clash-protocols \
|& tee haddock_log
cabal v2-haddock all |& tee haddock_log

set +e

Expand Down
7 changes: 7 additions & 0 deletions .ci/cabal.project.local.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
package *
documentation: __CHECK_HADDOCK__

package clash-protocols-base
documentation: False
ghc-options: -Werror

package clash-protocols
documentation: False
ghc-options: -Werror

constraints:
clash-prelude == __CLASH_VERSION__
6 changes: 3 additions & 3 deletions .ci/test_cabal.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
set -xeou pipefail

cabal v2-run unittests --constraint=clash-prelude==$clash_version -fci --enable-tests
cabal v2-run doctests --constraint=clash-prelude==$clash_version -fci --enable-tests
cabal v2-sdist clash-protocols
cabal v2-run unittests --enable-tests
cabal v2-run doctests --enable-tests
cabal v2-sdist all
67 changes: 51 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: CI

# Trigger the workflow on all pull requests and pushes/merges to master branch
# Trigger the workflow on all pull requests and pushes/merges to main branch
on:
pull_request:
push:
branches: [master]
branches: [main]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soooo.... why did the pushes to main not trigger a CI run? :-S



concurrency:
Expand All @@ -22,13 +22,19 @@ jobs:
- name: Setup Stack / GHC
uses: haskell-actions/setup@v2
with:
ghc-version: '9.4.8'
cabal-version: '3.10.2.1'
ghc-version: '9.8.4'
cabal-version: '3.14.1.1'
enable-stack: true
stack-version: 'latest'

- name: Cache dependencies
uses: actions/cache@v4
# Ask Stack to use system GHC instead of installing its own copy
- name: Use system GHC
run: |
stack config set system-ghc --global true

- name: Restore cached dependencies
uses: actions/cache/restore@v4
id: cache
with:
path: ~/.stack
key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ github.ref }}-${{ github.sha }}
Expand All @@ -37,10 +43,19 @@ jobs:
${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ github.ref }}-
${{ runner.os }}-ghc-${{ matrix.ghc }}-

# Ask Stack to use system GHC instead of installing its own copy
- name: Use system GHC
run: |
stack config set system-ghc --global true
- name: Install dependencies
run: stack build --test --only-dependencies

# Cache dependencies already at this point, so that we do not have to
# rebuild them should the subsequent steps fail
- name: Save cached dependencies
uses: actions/cache/save@v4
# Trying to save over an existing cache gives distracting
# "Warning: Cache save failed." since they are immutable
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
with:
path: ~/.stack
key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ github.ref }}-${{ github.sha }}

- name: Test with Stack
run: |
Expand All @@ -56,7 +71,7 @@ jobs:
clash:
- "1.8.2"
cabal:
- "3.10"
- "3.14.1.1"
ghc:
- "9.0.2"
- "9.2.8"
Expand All @@ -65,11 +80,11 @@ jobs:
- "9.10.1"
include:
- check_haddock: "False"
- ghc: "9.6.4"
- ghc: "9.6.6"
check_haddock: "True"
os: "ubuntu-latest"
clash: "1.8.2"
cabal: "3.10"
cabal: "3.14.1.1"

env:
check_haddock: ${{ matrix.check_haddock }}
Expand All @@ -95,8 +110,14 @@ jobs:
cabal v2-freeze
mv cabal.project.freeze frozen

- name: Cache dependencies
uses: actions/cache@v4
- name: Restore cached dependencies
uses: actions/cache/restore@v4
id: cache
env:
key:
${{ runner.os }}-ghc-${{ matrix.ghc }}-cabal-${{
steps.setup-haskell.outputs.cabal-version }}${{
matrix.project-variant }}
with:
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ matrix.clash }}-${{ hashFiles('frozen') }}
Expand All @@ -105,9 +126,23 @@ jobs:
${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ matrix.clash }}-
${{ runner.os }}-ghc-${{ matrix.ghc }}-

- name: Install dependencies
run: cabal v2-build all --enable-tests --only-dependencies

# Cache dependencies already at this point, so that we do not have to
# rebuild them should the subsequent steps fail
- name: Save cached dependencies
uses: actions/cache/save@v4
# Trying to save over an existing cache gives distracting
# "Warning: Cache save failed." since they are immutable
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
with:
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ matrix.clash }}-${{ hashFiles('frozen') }}

- name: Build
run: |
cabal build all --constraint=clash-prelude==$clash_version -fci
cabal v2-build all --enable-tests

- name: Test
run: |
Expand Down
8 changes: 0 additions & 8 deletions clash-protocols-base/clash-protocols-base.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ license-file: LICENSE
author: Martijn Bastiaan, QBayLogic B.V.
maintainer: Martijn Bastiaan <[email protected]>

flag ci
Description: Running on CI? Used to set fail-on-warning flag.
Manual: True
Default: False

flag large-tuples
description:
Generate instances for classes such as `Units` and `TaggedBundle` for tuples
Expand Down Expand Up @@ -75,9 +70,6 @@ common common-options
-- a no-specialize pragma to every function with a blackbox.
-fno-worker-wrapper

if flag(ci)
ghc-options: -Werror

default-language: Haskell2010
build-depends:
base >= 4.15.0.0,
Expand Down
8 changes: 0 additions & 8 deletions clash-protocols/clash-protocols.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ data-files:
src/Protocols/Hedgehog.hs
src/Protocols/Hedgehog/*.hs

flag ci
Description: Running on CI? Used to set fail-on-warning flag.
Manual: True
Default: False

flag large-tuples
description:
Generate instances for classes such as `Units` and `TaggedBundle` for tuples
Expand Down Expand Up @@ -86,9 +81,6 @@ common common-options
-- a no-specialize pragma to every function with a blackbox.
-fno-worker-wrapper

if flag(ci)
ghc-options: -Werror

default-language: Haskell2010
build-depends:
base >= 4.15.0.0,
Expand Down
8 changes: 5 additions & 3 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolver: lts-21.25 # ghc-9.4.8
resolver: lts-23.6 # ghc-9.8.4

packages:
- clash-protocols-base
Expand All @@ -7,5 +7,7 @@ packages:
extra-deps:
- git: https://github.com/cchalmers/circuit-notation.git
commit: 564769c52aa05b90f81bbc898b7af7087d96613d
- clash-prelude-1.8.1
- clash-prelude-hedgehog-1.8.1
- clash-prelude-1.8.2
- clash-prelude-hedgehog-1.8.2
- hedgehog-1.4@sha256:9860ab34ab3951d9515c71b777d8c9c47610aae7339933e17d26ad9a4afa5618,4754
- tasty-1.4.3@sha256:5b53fded93109f6704b599c3498eb73c5b0ed1a975f1912dd98b4b19c61f8bc9,2653
Loading