Skip to content

Commit

Permalink
Merge pull request #18 from pete-murphy/fix-ci
Browse files Browse the repository at this point in the history
fix: Fix CI (#16)
  • Loading branch information
pete-murphy authored Dec 2, 2023
2 parents 7b3be40 + a4ca7ce commit a9a08ba
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 50 deletions.
46 changes: 11 additions & 35 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,46 +8,22 @@ on:
pull_request:
branches: [main]

# Run CI on all 3 latest OSes
jobs:
build:
check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- uses: purescript-contrib/setup-purescript@main
with:
purescript: "0.15.9"
purs-tidy: "0.10.0"
psa: "0.8.2"
spago: "unstable"

- name: Cache PureScript dependencies
uses: actions/cache@v2
with:
key: ${{ runner.os }}-spago-${{ hashFiles('**/*.dhall') }}
path: |
.spago
output
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main

- name: Set up Node toolchain
uses: actions/setup-node@v2
with:
node-version: "18"
- name: "Nix check"
run: nix flake check

# Compile the library/project
# censor-lib: ignore warnings emitted by dependencies
# strict: convert warnings into errors
# Note: `purs-args` actually forwards these args to `psa`
- name: Build the project
- name: "Run tests"
run: |
spago build --purs-args "--censor-lib --strict"
nix develop --command 'run-install'
nix develop --command 'run-test'
- name: Run tests
run: |
spago -x test.dhall test
- name: "Check format"
run: nix develop --command 'run-check-format'

- name: Check Formatting
run: |
purs-tidy check src test
69 changes: 54 additions & 15 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,59 @@
purescript-overlay.inputs.nixpkgs.follows = "nixpkgs";
};

outputs = { self, nixpkgs, flake-utils, purescript-overlay }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ purescript-overlay.overlays.default ];
pkgs = import nixpkgs { inherit system overlays; };
in {
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
purs
purs-tidy
purs-backend-es
nodejs
spago-unstable
];
outputs = {
self,
nixpkgs,
flake-utils,
purescript-overlay,
}:
flake-utils.lib.eachDefaultSystem (system: let
overlays = [purescript-overlay.overlays.default];
pkgs = import nixpkgs {inherit system overlays;};
scripts = pkgs.symlinkJoin {
name = "scripts";
paths = pkgs.lib.mapAttrsToList pkgs.writeShellScriptBin {
run-install = ''
spago install
'';

run-test = ''
spago test
'';

run-check-format = ''
purs-tidy check src test
'';
};
});
};
in {
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
scripts

# PureScript tools
purs
purs-tidy
purs-backend-es
spago-unstable
# Node
nodejs
# Nix
alejandra
];
};

checks = {
format =
pkgs.runCommand "check-format"
{
buildInputs = with pkgs; [
alejandra
];
} ''
${pkgs.alejandra}/bin/alejandra --check ${./.}
touch $out
'';
};
});
}

0 comments on commit a9a08ba

Please sign in to comment.