-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CI and template project for compiler
Mostly based on Lamagraph/intermediate-lang-distiller
- Loading branch information
Showing
22 changed files
with
553 additions
and
2 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,9 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: github-actions | ||
directory: / | ||
labels: | ||
- dependabot | ||
- actions | ||
schedule: | ||
interval: "weekly" |
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,77 @@ | ||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
pedantic-build: | ||
name: Pedantic build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Clone project | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Haskell with Stack | ||
uses: haskell-actions/setup@v2 | ||
with: | ||
enable-stack: true | ||
stack-version: "latest" | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.stack | ||
key: pedantic-${{ hashFiles('stack.yaml') }} | ||
restore-keys: | | ||
pedantic- | ||
- name: Install dependencies | ||
run: | | ||
stack update | ||
stack build --only-dependencies | ||
- name: Pedantic build | ||
run: | | ||
stack build --pedantic | ||
build-and-test: | ||
name: Build and Test on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macOS-latest, windows-latest] | ||
|
||
steps: | ||
- name: Clone project | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Haskell with Stack | ||
uses: haskell-actions/setup@v2 | ||
with: | ||
enable-stack: true | ||
stack-version: "latest" | ||
|
||
- name: Cache dependencies on Unix-like OS | ||
if: startsWith(runner.os, 'Linux') || startsWith(runner.os, 'macOS') | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.stack | ||
key: ${{ runner.os }}-${{ hashFiles('stack.yaml') }} | ||
|
||
- name: Cache dependencies on Windows | ||
if: startsWith(runner.os, 'Windows') | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~\AppData\Roaming\stack | ||
~\AppData\Local\Programs\stack | ||
key: ${{ runner.os }}-${{ hashFiles('stack.yaml') }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
stack update | ||
stack build --only-dependencies --test --bench --no-run-tests --no-run-benchmarks | ||
- name: Build | ||
run: stack build --test --bench --no-run-tests --no-run-benchmarks | ||
|
||
- name: Run tests | ||
run: stack test |
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,29 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
# PRs can only use caches from their target branch. We therefore need to | ||
# make sure we run on 'master' too. | ||
- main | ||
pull_request: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
pre-commit: | ||
uses: ./.github/workflows/pre-commit.yaml | ||
|
||
fourmolu: | ||
needs: pre-commit | ||
uses: ./.github/workflows/fourmolu.yaml | ||
|
||
hlint: | ||
needs: fourmolu | ||
uses: ./.github/workflows/hlint.yaml | ||
|
||
build-and-test: | ||
needs: hlint | ||
uses: ./.github/workflows/build-and-test.yaml |
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,15 @@ | ||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
hlint: | ||
name: Fourmolu | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Clone project | ||
uses: actions/checkout@v4 | ||
|
||
- name: Run fourmolu | ||
uses: haskell-actions/run-fourmolu@v10 | ||
with: | ||
version: "latest" |
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,19 @@ | ||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
hlint: | ||
name: Hlint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Clone project | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up HLint | ||
uses: haskell-actions/hlint-setup@v2 | ||
|
||
- name: Run HLint | ||
uses: haskell-actions/hlint-run@v2 | ||
with: | ||
path: . | ||
fail-on: warning |
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,18 @@ | ||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
pre-commit: | ||
name: Pre-commit | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Clone project | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install pre-commit | ||
run: | | ||
pip install pre-commit | ||
- name: Run pre-commit | ||
run: | | ||
pre-commit run --all-files |
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
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,13 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: fix-byte-order-marker | ||
- id: mixed-line-ending | ||
# - repo: https://github.com/pre-commit/mirrors-prettier | ||
# rev: v4.0.0-alpha.8 | ||
# hooks: | ||
# - id: prettier |
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,6 @@ | ||
{ | ||
"recommendations": [ | ||
"redhat.vscode-yaml", | ||
"haskell.haskell", | ||
] | ||
} |
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,16 @@ | ||
{ | ||
"editor.formatOnSave": true, | ||
"files.insertFinalNewline": true, | ||
"files.trimFinalNewlines": true, | ||
"files.trimTrailingWhitespace": true, | ||
"editor.renderWhitespace": "all", | ||
"[haskell]": { | ||
"editor.tabSize": 4 | ||
}, | ||
"haskell.manageHLS": "GHCup", | ||
"haskell.formattingProvider": "fourmolu", | ||
"yaml.format.enable": true, | ||
"[yaml]": { | ||
"editor.defaultFormatter": "redhat.vscode-yaml" | ||
}, | ||
} |
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 |
---|---|---|
@@ -1,2 +1,30 @@ | ||
# interaction-nets-in-fpga | ||
Interaction nets based processor in Clash | ||
# Interaction nets based processor in Clash | ||
|
||
## Required tools | ||
|
||
### Pre-commit | ||
|
||
We use [pre-commit](https://pre-commit.com/) for general tidy up of files. | ||
To install pre-commit run: | ||
|
||
```shell | ||
pip install pre-commit # or install using your distro package manager | ||
pre-commit install | ||
``` | ||
|
||
To run pre-commit on all files run | ||
|
||
```shell | ||
pre-commit run --all-files | ||
``` | ||
|
||
### Fourmolu | ||
|
||
We use [Fourmolu](https://fourmolu.github.io/) as a formatter for Haskell source files with our custom config. | ||
**Fourmolu must be explicitly enabled in VS Code!** | ||
|
||
## Editor | ||
|
||
Our editor of choice is [VS Code](https://code.visualstudio.com/) with following extensions: | ||
|
||
- [Haskell](https://marketplace.visualstudio.com/items?itemName=haskell.haskell) |
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,50 @@ | ||
# Number of spaces per indentation step | ||
indentation: 4 | ||
|
||
# Max line length for automatic line breaking | ||
column-limit: 120 | ||
|
||
# Styling of arrows in type signatures (choices: trailing, leading, or leading-args) | ||
function-arrows: trailing | ||
|
||
# How to place commas in multi-line lists, records, etc. (choices: leading or trailing) | ||
comma-style: leading | ||
|
||
# Styling of import/export lists (choices: leading, trailing, or diff-friendly) | ||
import-export-style: diff-friendly | ||
|
||
# Whether to full-indent or half-indent 'where' bindings past the preceding body | ||
indent-wheres: false | ||
|
||
# Whether to leave a space before an opening record brace | ||
record-brace-space: false | ||
|
||
# Number of spaces between top-level declarations | ||
newlines-between-decls: 1 | ||
|
||
# How to print Haddock comments (choices: single-line, multi-line, or multi-line-compact) | ||
haddock-style: multi-line | ||
|
||
# How to print module docstring | ||
haddock-style-module: null | ||
|
||
# Styling of let blocks (choices: auto, inline, newline, or mixed) | ||
let-style: auto | ||
|
||
# How to align the 'in' keyword with respect to the 'let' keyword (choices: left-align, right-align, or no-space) | ||
in-style: right-align | ||
|
||
# Whether to put parentheses around a single constraint (choices: auto, always, or never) | ||
single-constraint-parens: always | ||
|
||
# Output Unicode syntax (choices: detect, always, or never) | ||
unicode: never | ||
|
||
# Give the programmer more choice on where to insert blank lines | ||
respectful: true | ||
|
||
# Fixity information for operators | ||
fixities: [] | ||
|
||
# Module reexports Fourmolu should know about | ||
reexports: [] |
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 @@ | ||
# Changelog for `lamagraph-compiler` | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to the | ||
[Haskell Package Versioning Policy](https://pvp.haskell.org/). | ||
|
||
## Unreleased | ||
|
||
## 0.1.0.0 - YYYY-MM-DD |
Empty file.
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 @@ | ||
import Distribution.Simple | ||
|
||
main = defaultMain |
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,6 @@ | ||
module Main (main) where | ||
|
||
import Lib | ||
|
||
main :: IO () | ||
main = someFunc |
Oops, something went wrong.