Skip to content

Commit

Permalink
Use devenv shell instead of nix-shell in github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
mpscholten committed Apr 29, 2023
1 parent 055bb57 commit dc9086a
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ jobs:
- name: Build Docs
run: |
cd $GITHUB_WORKSPACE
nix-shell --run "cd Guide; make guide.tar.gz"
devenv shell build-guide
- name: Build API Reference
run: |
cd $GITHUB_WORKSPACE
nix-shell --run "chmod +x build-haddock; ./build-haddock"
devenv shell build-api-reference
tar -czvf api-reference.tar.gz haddock-build
- name: Uploading to S3
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ihp-new.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ jobs:
- name: Build ihp-new Package
run: |
cd $GITHUB_WORKSPACE
nix-shell --run "cd ProjectGenerator; make tarball.tar.gz"
devenv shell build-ihp-new
- name: Uploading ihp-new Package
run: aws s3 cp ./ProjectGenerator/tarball.tar.gz s3://${{ secrets.S3_BUCKET }}/ihp-new.tar.gz
7 changes: 4 additions & 3 deletions .github/workflows/pr_compile_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ jobs:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/093f236f30c3b82205355806043263a8d636f8c2.tar.gz
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/a95ed9fe764c3ba2bf2d2fa223012c379cd6b32e.tar.gz
- uses: cachix/cachix-action@v12
with:
name: digitallyinduced
skipPush: true

- name: Install devenv.sh
run: nix profile install --accept-flake-config github:cachix/devenv/latest
- run: |
cd $GITHUB_WORKSPACE
mkdir -p ~/.config/nixpkgs
echo "{ allowBroken = true; }" >> ~/.config/nixpkgs/config.nix
nix-shell --run "cabal build --flag FastBuild"
devenv shell fastbuild
6 changes: 4 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ jobs:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/093f236f30c3b82205355806043263a8d636f8c2.tar.gz
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/a95ed9fe764c3ba2bf2d2fa223012c379cd6b32e.tar.gz
- uses: cachix/cachix-action@v12
with:
name: digitallyinduced
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: nix-shell --run "runghc $(make -f lib/IHP/Makefile.dist print-ghc-extensions) -iIDE Test/Main.hs"
- name: Install devenv.sh
run: nix profile install --accept-flake-config github:cachix/devenv/latest
- run: devenv shell tests
5 changes: 1 addition & 4 deletions build-haddock
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash

# Builds the api documentation for all IHP modules
# Output is placed in directory haddock-build
# After building, you can view the api docs with: open haddock-build/index.html

mkdir -p haddock-build

haddock --html -t "IHP Api Reference" --hyperlinked-source --built-in-themes --quickjump -o haddock-build \
$(find IHP -regex '.+\.hs' -not \( -regex '.+GenericController.hs' \) -not \( -regex '.+CLI/.+.hs' \) | xargs) \
$(find IHP -name '*.hs' -not \( -name 'GenericController.hs' \) -not \( -regex '.+CLI/.+.hs' \) | xargs) \
--optghc="-i." \
--optghc="-XOverloadedStrings" \
--optghc="-XNoImplicitPrelude" \
Expand Down
23 changes: 23 additions & 0 deletions devenv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,27 @@
hspec
ihp-hsx
]);

scripts.tests.exec = ''
runghc $(make -f lib/IHP/Makefile.dist print-ghc-extensions) -iIDE Test/Main.hs
'';

scripts.fastbuild.exec = ''
cabal build --flag FastBuild
'';

scripts.build-ihp-new.exec = ''
cd ProjectGenerator
make tarball.tar.gz
'';

scripts.build-guide.exec = ''
cd Guide
make guide.tar.gz
'';

scripts.build-api-reference.exec = ''
chmod +x build-haddock
./build-haddock
'';
}

0 comments on commit dc9086a

Please sign in to comment.