Skip to content

Commit

Permalink
Support GHC 9.6 in CI (#77)
Browse files Browse the repository at this point in the history
* Support GHC 9.6 in CI

* Malke sure we import the correct stuff from mtl

* Simplify CI, don't run for ghc9.2

* Install hspec-discover earlier in CI

* Downgrade to souffle 2.2

* Downgrade to souffle 2.2

* Add dockerfile for building souffle 2.2

* Update bench.cpp for souffle 2.2

---------

Co-authored-by: Luc Tielen <[email protected]>
  • Loading branch information
tchoutri and luc-tielen authored May 16, 2024
1 parent c33ea2f commit 268a112
Show file tree
Hide file tree
Showing 40 changed files with 1,203 additions and 1,463 deletions.
76 changes: 44 additions & 32 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,51 @@
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.2/x86_64-ubuntu-2004-souffle-2.2-Linux.deb
sudo apt install mcpp libffi7
sudo dpkg -i ./x86_64-ubuntu-2004-souffle-2.2-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: Configure
run: make configure
- name: Build
run: |
cabal install hspec-discover
make build
- name: Test
run: |
make tests
39 changes: 39 additions & 0 deletions .github/workflows/docker.yml
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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM primordus/souffle-ubuntu:2.3
FROM primordus/souffle-ubuntu:2.2

SHELL [ "/bin/bash", "-c" ]

Expand Down
25 changes: 25 additions & 0 deletions Dockerfile.builder
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM ubuntu:20.04
ARG VERSION=2.2

RUN echo 'tzdata tzdata/Areas select Europe' | debconf-set-selections \
&& echo 'tzdata tzdata/Zones/Europe select Paris' | debconf-set-selections
RUN apt update \
&& apt autoremove -y \
&& DEBIAN_FRONTEND=noninteractive apt install -y lsb-release wget \
software-properties-common gnupg curl bison build-essential cmake doxygen \
flex g++ git libffi-dev libncurses5-dev libsqlite3-dev make mcpp sqlite3 zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir -p /tmp/souffle-src \
&& cd /tmp/souffle-src \
&& git clone https://github.com/souffle-lang/souffle.git \
&& cd souffle \
&& git checkout $VERSION \
&& cmake -S . -B build -DCMAKE_BUILD_TYPE=Release \
&& cmake --build build -j \
&& cmake --build build --target install \
&& cd /tmp \
&& rm -rf /tmp/souffle-src

VOLUME [/code]
WORKDIR /app
CMD ["souffle" "--help"]
29 changes: 18 additions & 11 deletions Makefile
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
Loading

0 comments on commit 268a112

Please sign in to comment.