Skip to content

Commit

Permalink
Merge pull request #6 from vst/5-run-tests-on-prs
Browse files Browse the repository at this point in the history
Run tests and build on PRs
  • Loading branch information
vst authored Apr 23, 2024
2 parents bb01d39 + 7b41902 commit 13c7eb2
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "Check Codebase"

on:
pull_request:
workflow_dispatch:

jobs:
check:
runs-on: "ubuntu-latest"

steps:
- name: "Checkout Codebase"
uses: "actions/checkout@v4"

- name: "Install nix"
uses: "cachix/install-nix-action@v26"
with:
nix_path: "nixpkgs=channel:nixos-23.11"

- name: "Use magic Nix cache"
uses: "DeterminateSystems/magic-nix-cache-action@v4"

- name: "Check Application"
run: |
nix-shell --pure --run "dev-test-build"
24 changes: 24 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,27 @@ let
## SHELL ##
###########

## Test and build script for development:
dev-test-build = pkgs.writeShellScriptBin "dev-test-build" ''
#!/usr/bin/env bash
## Fail on any error:
set -e
## Show commands executed:
set -x
hpack
fourmolu --mode check app/ src/ test/
prettier --check .
find . -iname "*.nix" -not -path "*/nix/sources.nix" -print0 | xargs --null nixpkgs-fmt --check
hlint app/ src/ test/
cabal build -O0
cabal run -O0 clompse -- --version
cabal v1-test
cabal haddock -O0
'';

## Prepare Nix shell:
thisShell = thisHaskell.shellFor {
## Define packages for the shell:
Expand Down Expand Up @@ -92,6 +113,9 @@ let
pkgs.nixpkgs-fmt
pkgs.nodePackages.prettier
pkgs.upx

## Our custom development scripts:
dev-test-build
];
};

Expand Down

0 comments on commit 13c7eb2

Please sign in to comment.