-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Shamelessly stolen from https://github.com/DigitalBrains1/prettyprinter-interp Co-authored-by: Peter Lebbing <[email protected]>
- Loading branch information
1 parent
2b80994
commit 0e5d248
Showing
22 changed files
with
366 additions
and
43 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,32 @@ | ||
#!/usr/bin/env python3 | ||
""" | ||
Makes sure: | ||
* All jobs are listed in the 'all' job | ||
* Only existing tests are listed | ||
""" | ||
|
||
import sys | ||
import yaml | ||
|
||
CI_PATH = '.github/workflows/ci.yaml' | ||
ALL_TEST = 'all' | ||
|
||
|
||
def main(): | ||
ci_yaml_fp = open(CI_PATH, 'r') | ||
ci_yaml_parsed = yaml.load(ci_yaml_fp, Loader=yaml.FullLoader) | ||
|
||
all_jobs = set(ci_yaml_parsed['jobs'].keys()) - {ALL_TEST} | ||
all_needs = set(ci_yaml_parsed['jobs'][ALL_TEST]['needs']) | ||
|
||
if all_jobs - all_needs: | ||
sys.exit(f'Not all jobs mentioned in {ALL_TEST}.needs: ' | ||
f'{all_jobs - all_needs}') | ||
|
||
if all_needs - all_jobs: | ||
sys.exit(f'Non-existing jobs found in {ALL_TEST}.needs: ' | ||
f'{all_needs - all_jobs}') | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
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 docopt | ||
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,8 @@ | ||
package docopt | ||
ghc-options: -Werror | ||
|
||
prefer-oldest: True | ||
|
||
constraints: | ||
aeson >= 1.4.4.0, | ||
contravariant >= 1.5.2 |
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,37 @@ | ||
package docopt | ||
ghc-options: -Werror | ||
|
||
repository head.hackage.ghc.haskell.org | ||
url: https://ghc.gitlab.haskell.org/head.hackage/ | ||
secure: True | ||
key-threshold: 3 | ||
root-keys: | ||
7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d | ||
26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329 | ||
f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89 | ||
|
||
active-repositories: hackage.haskell.org, head.hackage.ghc.haskell.org | ||
|
||
-- HEAD.hackage standard allow-newer packages | ||
allow-newer: | ||
Cabal, | ||
base, | ||
binary, | ||
bytestring, | ||
deepseq, | ||
ghc, | ||
ghc-bignum, | ||
ghc-prim, | ||
integer-gmp, | ||
template-haskell, | ||
text, | ||
time | ||
|
||
-- Boot packages | ||
constraints: | ||
base installed, | ||
ghc installed, | ||
ghc-bignum installed, | ||
ghc-prim installed, | ||
integer-gmp installed, | ||
template-haskell installed |
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,3 @@ | ||
resolver: lts-9.21 | ||
ghc-options: | ||
"$locals": -Wall -Wcompat -Wno-name-shadowing |
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,3 @@ | ||
resolver: lts-18.28 | ||
ghc-options: | ||
"$locals": -Wall -Wcompat -Wno-name-shadowing |
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,3 @@ | ||
resolver: lts-11.22 | ||
ghc-options: | ||
"$locals": -Wall -Wcompat -Wno-name-shadowing |
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,3 @@ | ||
resolver: lts-12.26 | ||
ghc-options: | ||
"$locals": -Wall -Wcompat -Wno-name-shadowing |
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,3 @@ | ||
resolver: lts-14.27 | ||
ghc-options: | ||
"$locals": -Wall -Wcompat -Wno-name-shadowing |
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,3 @@ | ||
resolver: lts-16.31 | ||
ghc-options: | ||
"$locals": -Wall -Wcompat -Wno-name-shadowing |
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,3 @@ | ||
resolver: lts-19.33 | ||
ghc-options: | ||
"$locals": -Wall -Wcompat -Wno-name-shadowing |
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,3 @@ | ||
resolver: lts-20.26 | ||
ghc-options: | ||
"$locals": -Wall -Wcompat -Wno-name-shadowing |
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,3 @@ | ||
resolver: lts-21.14 | ||
ghc-options: | ||
"$locals": -Wall -Wcompat -Wno-name-shadowing |
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,3 @@ | ||
resolver: lts-22.11 | ||
ghc-options: | ||
"$locals": -Wall -Wcompat -Wno-name-shadowing |
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,3 @@ | ||
resolver: nightly-2024-02-24 | ||
ghc-options: | ||
"$locals": -Wall -Wcompat -Wno-name-shadowing |
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,210 @@ | ||
name: CI | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
concurrency: | ||
group: ${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
# Stack | ||
stack: | ||
name: Stack / GHC ${{ matrix.ghc }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
ghc: ["8.0", "8.2", "8.4", "8.6", "8.8", "8.10", "9.0", "9.2", "9.4", "9.6", "9.8"] | ||
fail-fast: false | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
show-progress: false | ||
|
||
- name: Setup Haskell | ||
uses: haskell-actions/setup@v2 | ||
id: setup-haskell | ||
with: | ||
enable-stack: true | ||
stack-no-global: true | ||
|
||
- name: General Setup | ||
run: | | ||
cp .ci/stack-${{ matrix.ghc }}.yaml stack.yaml | ||
# Print out some information for debugging purposes | ||
ghc --version | ||
stack --version | ||
cat stack.yaml | ||
- name: Restore cached dependencies | ||
uses: actions/cache/restore@v3 | ||
id: cache | ||
with: | ||
path: ${{ steps.setup-haskell.outputs.stack-root }}/snapshots | ||
key: | ||
${{ runner.os }}-stack-${{ matrix.ghc }}-${{ | ||
hashFiles('prettyprinter-interp.cabal', 'stack.yaml') }} | ||
restore-keys: ${{ runner.os }}-stack-${{ matrix.ghc }}- | ||
|
||
- 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@v3 | ||
# 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.outputs.stack-root }}/snapshots | ||
key: ${{ steps.cache.outputs.cache-primary-key }} | ||
|
||
- name: Build | ||
# Note: the --pedantic switch adds -Wall -Werror to the options passed | ||
# to GHC. Options specified in stack.yaml (like -Wcompat) are still | ||
# passed; it is cumulative. Future versions of Stack might add behavior | ||
# to --pedantic. | ||
run : stack build --pedantic | ||
|
||
- name: Test | ||
run : stack test | ||
|
||
# Cabal | ||
cabal: | ||
name: Cabal / GHC ${{ matrix.ghc }} ${{ matrix.project-variant }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
ghc: | ||
- "8.0.2" | ||
- "8.2.2" | ||
- "8.4.4" | ||
- "8.6.5" | ||
- "8.8.4" | ||
- "8.10.7" | ||
- "9.0.2" | ||
- "9.0.2" | ||
- "9.2.8" | ||
- "9.4.7" | ||
- "9.6.3" | ||
project-variant: [""] | ||
include: | ||
- ghc: 8.0.2 | ||
project-variant: -lower | ||
- ghc: 9.8.1 | ||
project-variant: -upper | ||
|
||
fail-fast: false | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
show-progress: false | ||
|
||
- name: Setup Haskell | ||
uses: haskell-actions/setup@v2 | ||
id: setup-haskell | ||
with: | ||
ghc-version: ${{ matrix.ghc }} | ||
cabal-update: false | ||
|
||
- name: General Setup | ||
run: | | ||
cp .ci/cabal.project.local${{ matrix.project-variant}} \ | ||
cabal.project.local | ||
# Print out some information for debugging purposes | ||
ghc --version | ||
cabal --version | ||
cat cabal.project.local | ||
- name: Setup CI | ||
# This generates dist-newstyle/cache/plan.json with hashes for all | ||
# dependencies, for cache invalidation. | ||
run: | | ||
cabal v2-update | ||
cabal v2-build all --enable-tests --dry-run | ||
- name: Restore cached dependencies | ||
uses: actions/cache/restore@v3 | ||
id: cache | ||
env: | ||
key: | ||
${{ runner.os }}-ghc-${{ matrix.ghc }}-cabal-${{ | ||
steps.setup-haskell.outputs.cabal-version }}${{ | ||
matrix.project-variant }} | ||
with: | ||
path: ${{ steps.setup-haskell.outputs.cabal-store }} | ||
key: | ||
${{ env.key }}-${{ hashFiles('cabal.project.local', | ||
'dist-newstyle/cache/plan.json') }} | ||
restore-keys: ${{ env.key }}- | ||
|
||
- 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.outputs.cabal-store }} | ||
key: ${{ steps.cache.outputs.cache-primary-key }} | ||
|
||
- name: Build | ||
run: cabal v2-build all --enable-tests | ||
|
||
- name: Test | ||
run: cabal v2-test --enable-tests --test-show-details=direct | ||
|
||
# Mechanism copied from https://github.com/clash-lang/clash-compiler/ | ||
all: | ||
name: All jobs finished | ||
if: ${{ !cancelled() }} | ||
needs: | ||
- stack | ||
- cabal | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
show-progress: false | ||
|
||
- name: Check dependencies for failures | ||
run: | | ||
# Test all dependencies for success/failure | ||
set -x | ||
# True if at least one dependency succeeded | ||
success="${{ contains(needs.*.result, 'success') }}" | ||
# True if at least one dependency failed | ||
fail="${{ contains(needs.*.result, 'failure') }}" | ||
set +x | ||
# Test whether success/fail variables contain sane values | ||
if [[ "${success}" != "true" && "${success}" != "false" ]]; then exit 1; fi | ||
if [[ "${fail}" != "true" && "${fail}" != "false" ]]; then exit 1; fi | ||
# We want to fail if one or more dependencies fail. For safety, we introduce | ||
# a second check: if no dependencies succeeded something weird is going on. | ||
if [[ "${fail}" == "true" || "${success}" == "false" ]]; then | ||
echo "One or more dependency failed, or no dependency succeeded." | ||
exit 1 | ||
fi | ||
# Currently, ubuntu-latest already has it installed, but keep it around in | ||
# case they ever change that | ||
# | ||
# - name: Install dependencies | ||
# run: | | ||
# sudo apt-get update | ||
# sudo apt-get -y install python3-yaml | ||
|
||
- name: Check that the 'all' job depends on all other jobs | ||
run: .ci/all_check.py |
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
dist | ||
.cabal-sandbox | ||
cabal.sandbox.config | ||
dist-newstyle | ||
|
||
# Haskell compiled files | ||
*.hi | ||
|
Oops, something went wrong.