-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
446 additions
and
361 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 |
---|---|---|
@@ -1,39 +1,48 @@ | ||
name: "Build" | ||
on: [push, pull_request] | ||
jobs: | ||
build: | ||
runs-on: ${{matrix.os}} | ||
generate-matrix: | ||
name: "Generate matrix from cabal" | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Extract the tested GHC versions | ||
id: set-matrix | ||
uses: kleidukos/[email protected] | ||
with: | ||
cabal-file: souffle-haskell.cabal | ||
ubuntu: true | ||
version: 0.1.6.0 | ||
test: | ||
name: ${{ matrix.ghc }} on ${{ matrix.os }} | ||
needs: generate-matrix | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
# Workaround for 'No space left on device' error | ||
- name: free disk space | ||
run: | | ||
sudo docker rmi $(docker image ls -aq) >/dev/null 2>&1 || true | ||
sudo swapoff -a | ||
sudo rm -f /swapfile | ||
sudo apt clean | ||
df -h | ||
# In this step, this action saves a list of existing images, the cache is created without them in the post run. | ||
# It also restores the cache if it exists. | ||
- uses: jpribyl/[email protected] | ||
continue-on-error: true # Ignore the failure of a step and avoid terminating the job. | ||
|
||
- name: Build and test | ||
- name: Checkout base repo | ||
uses: actions/checkout@v4 | ||
- name: Set up Haskell | ||
id: setup-haskell | ||
uses: haskell-actions/setup@v2 | ||
with: | ||
ghc-version: ${{ matrix.ghc }} | ||
cabal-version: 'latest' | ||
- name: Install Souffle | ||
run: | | ||
set -eo pipefail | ||
export TIMESTAMP=$(date +%s) | ||
docker build -f Dockerfile . -t souffle-haskell:$TIMESTAMP | tee souffle-haskell-lang-${{matrix.os}}.log | ||
docker run --rm souffle-haskell:$TIMESTAMP bash -c "make tests" | tee -a souffle-haskell-lang-${{matrix.os}}.log | ||
- name: Upload logs | ||
if: ${{ always() }} | ||
uses: actions/upload-artifact@v2 | ||
wget https://github.com/souffle-lang/souffle/releases/download/2.3/x86_64-ubuntu-2004-souffle-2.3-Linux.deb | ||
sudo apt install mcpp libffi7 | ||
sudo dpkg -i ./x86_64-ubuntu-2004-souffle-2.3-Linux.deb | ||
- name: Cache | ||
uses: actions/[email protected] | ||
with: | ||
name: souffle-haskell-lang-${{matrix.os}}.log | ||
path: souffle-haskell-lang-${{matrix.os}}.log | ||
path: ${{ steps.setup-haskell.outputs.cabal-store }} | ||
key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-cabal-${{ hashFiles('**/plan.json') }} | ||
restore-keys: ${{ runner.os }}-ghc-${{ matrix.ghc }}- | ||
- name: Build | ||
run: cabal build | ||
- name: Test | ||
run: | | ||
cabal install hspec-discover | ||
cabal 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,39 @@ | ||
name: "Build" | ||
on: [push, pull_request] | ||
jobs: | ||
build: | ||
runs-on: ${{matrix.os}} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
# Workaround for 'No space left on device' error | ||
- name: free disk space | ||
run: | | ||
sudo docker rmi $(docker image ls -aq) >/dev/null 2>&1 || true | ||
sudo swapoff -a | ||
sudo rm -f /swapfile | ||
sudo apt clean | ||
df -h | ||
# In this step, this action saves a list of existing images, the cache is created without them in the post run. | ||
# It also restores the cache if it exists. | ||
- uses: jpribyl/[email protected] | ||
continue-on-error: true # Ignore the failure of a step and avoid terminating the job. | ||
|
||
- name: Build and test | ||
run: | | ||
set -eo pipefail | ||
export TIMESTAMP=$(date +%s) | ||
docker build -f Dockerfile . -t souffle-haskell:$TIMESTAMP | tee souffle-haskell-lang-${{matrix.os}}.log | ||
docker run --rm souffle-haskell:$TIMESTAMP bash -c "make tests" | tee -a souffle-haskell-lang-${{matrix.os}}.log | ||
- name: Upload logs | ||
if: ${{ always() }} | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: souffle-haskell-lang-${{matrix.os}}.log | ||
path: souffle-haskell-lang-${{matrix.os}}.log |
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,28 +1,35 @@ | ||
|
||
# NOTE: these all assume cabal v3 | ||
|
||
build: configure | ||
@cabal build | ||
|
||
configure: | ||
@hpack --force && cabal configure --enable-tests | ||
configure: ## Configure the project | ||
@cabal configure --enable-tests --enable-benchmarks | ||
|
||
clean: | ||
clean: ## Clean up the build artifacts | ||
@cabal clean | ||
|
||
lint: | ||
@hlint . | ||
lint: ## Run the code linter (HLint) | ||
@find tests lib benchmark -name "*.hs" | xargs -P $(PROCS) -I {} hlint --refactor-options="-i" --refactor {} | ||
|
||
style: ## Run the code styler (and cabal-fmt) | ||
@cabal-fmt -i *.cabal | ||
|
||
hoogle: | ||
hoogle: ## Start a hoogle server on port 8080 | ||
hoogle server --local -p 8080 | ||
|
||
tests: configure | ||
tests: configure ## Run tests | ||
DATALOG_DIR=tests/fixtures/ cabal run souffle-haskell-test | ||
|
||
docs: | ||
docs: ## Generate the documentation | ||
@cabal haddock | ||
|
||
bench: | ||
bench: ## Run the benchmarks | ||
@cabal run souffle-haskell-benchmarks -- --output /tmp/benchmarks.html | ||
|
||
.PHONY: hoogle lint clean configure build tests docs bench | ||
help: ## Display this help message | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.* ?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
.PHONY: all $(MAKECMDGOALS) | ||
|
||
.DEFAULT_GOAL := help |
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
Oops, something went wrong.