mirror of
https://github.com/infinisil/all-hies.git
synced 2024-11-22 22:27:42 +03:00
b8fb659620
* Remove update command Will be replaced with haskell.nix * Project revamp using haskell.nix - Only unstable HIE - Only GHC 8.6.5 and 8.8.3 (or more in the future), but on Linux for both glibc 2.27 (NixOS 19.09) and glibc 2.30 (NixOS 20.03/unstable) - Using haskell.nix for the builds. This makes evaluation slower, but makes things simpler overall. - No global installation intended anymore, instead you add HIE to your projects shell.nix file (to be documented in future commits) Co-authored-by: galagora <45048741+galagora@users.noreply.github.com> * Remove old files not needed anymore with the revamp * Add new haskell.nix-generated files * Add haskell.nix template * Add nixpkgs infra template * Build, push and test using GitHub Actions This builds and pushes all necessary configurations using GitHub Actions automatically. Also tests the templates * Update Readme for revamp * Add template documentation * Add warning for unsupported versions * Add haskell.nix + stack template * Minor Readme changes * Remove check-cache script * Don't CI on pushes to haskell.nix * Use same haskell.nix version for stack/cabal + cleanups Co-authored-by: galagora <45048741+galagora@users.noreply.github.com>
181 lines
5.6 KiB
YAML
181 lines
5.6 KiB
YAML
name: CI
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
jobs:
|
|
materialize-check:
|
|
name: Check materialization files for GHC ${{ matrix.ghc }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
ghc: [ "8.6.5", "8.8.3" ]
|
|
glibc: [ "2.30" ]
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: cachix/install-nix-action@v10
|
|
- name: Make sure materializations are up-to-date
|
|
run: |
|
|
materializationId=$(nix-instantiate --read-write-mode --eval sources.nix -A materializationId | tr -d '"')
|
|
if ! diff "$materializationId" "generated/${{ matrix.ghc }}/materialization-id"; then
|
|
echo "The materialization files for ${{ matrix.ghc }} are outdated"
|
|
echo "Run"
|
|
echo " \$(nix-build build.nix -A materialize --argstr ghcVersion ${{ matrix.ghc }} --argstr glibcName glibc-${{ matrix.glibc }})"
|
|
echo "to update them"
|
|
exit 1
|
|
fi
|
|
echo "Materialization files up-to-date" >&2
|
|
|
|
build:
|
|
name: HIE Build for ${{ matrix.os }}, GHC ${{ matrix.ghc }}, glibc ${{ matrix.glibc }}
|
|
runs-on: ${{ matrix.os }}
|
|
needs: materialize-check
|
|
strategy:
|
|
matrix:
|
|
os: [ ubuntu-latest, macos-latest ]
|
|
ghc: [ "8.6.5", "8.8.3" ]
|
|
glibc: [ "2.30" ]
|
|
include:
|
|
# Only linux needs matching glibc versions
|
|
- os: ubuntu-latest
|
|
ghc: "8.6.5"
|
|
glibc: "2.27"
|
|
- os: ubuntu-latest
|
|
ghc: "8.8.3"
|
|
glibc: "2.27"
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: cachix/install-nix-action@v10
|
|
- uses: cachix/cachix-action@09c0620ab018415cbf1e6792e1f415cf892879b5
|
|
with:
|
|
name: all-hies
|
|
extraPullNames: iohk
|
|
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
|
|
- name: Instantiate HIE
|
|
run: |
|
|
nix-instantiate build.nix \
|
|
-A combined \
|
|
--argstr ghcVersion ${{ matrix.ghc }} \
|
|
--argstr glibcName glibc-${{ matrix.glibc }} \
|
|
--add-root $PWD/drv --indirect
|
|
- name: Build HIE
|
|
run: |
|
|
path=$(nix-store --query --outputs drv)
|
|
url=$(sed -E <<< "$path" \
|
|
-e 's|-.*|.narinfo|' \
|
|
-e 's|/nix/store|https://all-hies.cachix.org|')
|
|
code=$(curl -s -o /dev/null -w "%{http_code}\n" "$url")
|
|
case "$code" in
|
|
200)
|
|
echo "Derivation already in cache, not building it"
|
|
;;
|
|
*)
|
|
echo "Derivation not in cache, building it"
|
|
# Since we have a lot of derivations to build, do as many of them
|
|
# in parallel, but all of them with a single core
|
|
nix-store --realise drv --max-jobs auto --cores 1
|
|
;;
|
|
esac
|
|
|
|
template_haskell-nix-stack:
|
|
name: Haskell.nix stack template for ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
needs: build
|
|
strategy:
|
|
matrix:
|
|
os: [ ubuntu-latest, macos-latest ]
|
|
defaults:
|
|
run:
|
|
working-directory: templates/haskell.nix-stack
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: cachix/install-nix-action@v10
|
|
- uses: cachix/cachix-action@09c0620ab018415cbf1e6792e1f415cf892879b5
|
|
with:
|
|
name: all-hies
|
|
extraPullNames: iohk
|
|
- name: Entering nix-shell
|
|
run: |
|
|
nix-shell --run "echo Successfully entered nix-shell"
|
|
- name: Call HIE
|
|
run: |
|
|
nix-shell --run "hie 2>&1 | tee /dev/stderr | grep 'Main.hs: OK'"
|
|
- name: Search hoogle
|
|
run: |
|
|
nix-shell --run "hoogle fromMaybe | grep Data.Maybe"
|
|
- name: Build and run with cabal
|
|
run: |
|
|
nix-shell --run "stack run"
|
|
- name: Build and run with Nix
|
|
run: |
|
|
nix-build
|
|
./result/bin/all-hies-template
|
|
|
|
template_haskell-nix-cabal:
|
|
name: Haskell.nix cabal template for ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
needs: build
|
|
strategy:
|
|
matrix:
|
|
os: [ ubuntu-latest, macos-latest ]
|
|
defaults:
|
|
run:
|
|
working-directory: templates/haskell.nix-cabal
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: cachix/install-nix-action@v10
|
|
- uses: cachix/cachix-action@09c0620ab018415cbf1e6792e1f415cf892879b5
|
|
with:
|
|
name: all-hies
|
|
extraPullNames: iohk
|
|
- name: Entering nix-shell
|
|
run: |
|
|
nix-shell --run "echo Successfully entered nix-shell"
|
|
- name: Call HIE
|
|
run: |
|
|
nix-shell --run "hie 2>&1 | tee /dev/stderr | grep 'Main.hs: OK'"
|
|
- name: Search hoogle
|
|
run: |
|
|
nix-shell --run "hoogle fromMaybe | grep Data.Maybe"
|
|
- name: Build and run with cabal
|
|
run: |
|
|
nix-shell --run "cabal run"
|
|
- name: Build and run with Nix
|
|
run: |
|
|
nix-build
|
|
./result/bin/all-hies-template
|
|
|
|
template_nixpkgs-cabal:
|
|
name: Nixpkgs cabal template for ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
needs: build
|
|
strategy:
|
|
matrix:
|
|
os: [ ubuntu-latest, macos-latest ]
|
|
defaults:
|
|
run:
|
|
working-directory: templates/nixpkgs-cabal
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: cachix/install-nix-action@v10
|
|
- uses: cachix/cachix-action@09c0620ab018415cbf1e6792e1f415cf892879b5
|
|
with:
|
|
name: all-hies
|
|
- name: Entering nix-shell
|
|
run: |
|
|
nix-shell --run "echo Successfully entered nix-shell"
|
|
- name: Call HIE
|
|
run: |
|
|
nix-shell --run "hie 2>&1 | tee /dev/stderr | grep 'Main.hs: OK'"
|
|
- name: Search hoogle
|
|
run: |
|
|
nix-shell --run "hoogle fromMaybe | grep Data.Maybe"
|
|
- name: Build and run with cabal
|
|
run: |
|
|
nix-shell --run "cabal run"
|
|
- name: Build and run with Nix
|
|
run: |
|
|
nix-build
|
|
./result/bin/all-hies-template
|