-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
206 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/bash | ||
set -xueo pipefail | ||
|
||
mkdir -p hadocs | ||
|
||
# Cache dependencies | ||
cabal v2-build clash-cores -O0 --enable-documentation --only-dependencies | ||
|
||
cabal v2-haddock clash-cores -O0 --enable-documentation \ | ||
| tee haddock_log | ||
|
||
set +e | ||
|
||
# Temporarily disabled, as there are hundreds of TH-generated instances without | ||
# documentation. | ||
#if grep -q "Missing documentation" haddock_log; then | ||
# echo -e "\e[1m\e[31mMissing documentation! Scroll up for full log.\e[0m" | ||
# grep --color=always -n -C 5 "Missing documentation" haddock_log | ||
# exit 1 | ||
#fi | ||
|
||
out_of_scope_warn="If you qualify the identifier, haddock can try to link it anyway" | ||
if grep -q "${out_of_scope_warn}" haddock_log; then | ||
echo -e "\e[1m\e[31mIdentifier out of scope in ${pkg}! Scroll up for full log.\e[0m" | ||
grep --color=always -n -C 5 "${out_of_scope_warn}" haddock_log | ||
exit 1 | ||
fi | ||
|
||
link_dest_warn="could not find link destinations for:" | ||
if grep -q "${link_dest_warn}" haddock_log; then | ||
echo -e "\e[1m\e[31mCould not find link destination in ${pkg}! Scroll up for full log.\e[0m" | ||
grep --color=always -n -C 5 "${link_dest_warn}" haddock_log | ||
exit 1 | ||
fi | ||
|
||
ambiguous_warn="You may be able to disambiguate the identifier by" | ||
if grep -q "${ambiguous_warn}" haddock_log; then | ||
echo -e "\e[1m\e[31mAmbiguous identifier found in ${pkg}! Scroll up for full log.\e[0m" | ||
grep --color=always -n -C 5 "${ambiguous_warn}" haddock_log | ||
exit 1 | ||
fi | ||
|
||
# Copy documention to hadocs/ | ||
ln -s "$(dirname "$(tail -n1 haddock_log)")" hadocs/${pkg} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
package clash-cores | ||
ghc-options: -Werror |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
set -xeou pipefail | ||
|
||
cabal v2-build all -fci | ||
cabal v2-run unittests -fci --enable-tests | ||
cabal v2-run doctests -fci --enable-tests | ||
cabal v2-sdist |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
set -xou pipefail | ||
|
||
grep \ | ||
-E ' $' -n -r . \ | ||
--include=*.{hs,hs-boot,sh,cabal,md,yml} \ | ||
--exclude-dir=dist-newstyle --exclude-dir=deps | ||
if [[ $? == 0 ]]; then | ||
echo "EOL whitespace detected. See ^" | ||
exit 1; | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
name: CI | ||
|
||
# Trigger the workflow on all pull requests and pushes/merges to main branch | ||
on: | ||
pull_request: | ||
push: | ||
branches: [main] | ||
|
||
concurrency: | ||
group: ${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
setup-nix: | ||
name: Setup Nix | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Install Nix | ||
uses: cachix/install-nix-action@22 | ||
with: | ||
nix-path: nixpkgs=channel:nixos-unstable | ||
|
||
- name: Cache nix | ||
uses: DeterminateSystems/magic-nix-cache-action@v2 | ||
|
||
- name: Build the nix environment | ||
run: nix-build | ||
|
||
cabal: | ||
name: Cabal tests - ghc ${{ matrix.ghc }} / clash ${{ matrix.clash }} | ||
runs-on: ${{ matrix.os }} | ||
needs: setup-nix | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
clash: | ||
- "1.8.1" | ||
cabal: | ||
- "3.10" | ||
ghc: | ||
- "9.6.4" | ||
|
||
env: | ||
clash_version: ${{ matrix.clash }} | ||
NIXPKGS_ALLOW_BROKEN: 1 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Haskell | ||
uses: haskell-actions/setup@v2 | ||
id: setup-haskell-cabal | ||
with: | ||
ghc-version: ${{ matrix.ghc }} | ||
cabal-version: ${{ matrix.cabal }} | ||
|
||
- name: Use CI specific settings | ||
run: | | ||
cp .ci/cabal.project.local . | ||
- name: Setup CI | ||
run: | | ||
nix-shell --run cabal v2-freeze | ||
mv cabal.project.freeze frozen | ||
- name: Cache dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }} | ||
key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ matrix.clash }}-${{ hashFiles('frozen') }} | ||
restore-keys: | | ||
${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ matrix.clash }}-${{ hashFiles('frozen') }} | ||
${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ matrix.clash }}- | ||
${{ runner.os }}-ghc-${{ matrix.ghc }}- | ||
- name: Unit Tests | ||
run: | | ||
nix-shell --run .ci/test_cabal.sh | ||
- name: Testsuite (VHDL) | ||
run: | | ||
nix-shell --run cabal v2-run clash-testsuite -- --hide-successes -p .VHDL --no-vivado | ||
- name: Testsuite (Verilog) | ||
run: | | ||
nix-shell --run cabal v2-run clash-testsuite -- --hide-successes -p .Verilog --no-vivado | ||
- name: Testsuite (SystemVerilog) | ||
run: | | ||
nix-shell --run cabal v2-run clash-testsuite -- --hide-successes -p .SystemVerilog --no-modelsim --no-vivado | ||
documentation: | ||
name: Haddock Documentation - ghc ${{ matrix.ghc }} / clash ${{ matrix.clash }} | ||
needs: setup-nix | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
clash: | ||
- "1.8.1" | ||
cabal: | ||
- "3.10" | ||
ghc: | ||
- "9.6.4" | ||
|
||
env: | ||
clash_version: ${{ matrix.clash }} | ||
NIXPKGS_ALLOW_BROKEN: 1 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Haskell | ||
uses: haskell-actions/setup@v2 | ||
id: setup-haskell-cabal | ||
with: | ||
ghc-version: ${{ matrix.ghc }} | ||
cabal-version: ${{ matrix.cabal }} | ||
|
||
- name: Use CI specific settings | ||
run: | | ||
cp .ci/cabal.project.local . | ||
- name: Build | ||
run: | | ||
nix-shell --run .ci/build_docs.sh | ||
linting: | ||
name: Source code linting | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Whitespace | ||
run: | | ||
.ci/test_whitespace.sh | ||
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