Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Nix Powered Checks #141

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
12 changes: 12 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: checks

on:
push:

jobs:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action@main
- run: nix flake check -Lv
36 changes: 18 additions & 18 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
name: Playwright Tests
on:
push:
branches: [ main, master ]
branches: [main]
pull_request:
branches: [ main, master ]
branches: [main]
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npx playwright test
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npx playwright test
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ yarn.lock
/playwright-report/
/blob-report/
/playwright/.cache/
result
184 changes: 184 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

112 changes: 112 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
{
description = "Nodejs Dev Shell";

inputs = {
devshell.url = "github:numtide/devshell";
flake-utils.url = "github:numtide/flake-utils";
git-hooks = {
inputs.nixpkgs.follows = "nixpkgs";
url = "github:cachix/git-hooks.nix";
};
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";

nix-filter.url = "github:numtide/nix-filter";
};

outputs =
{
devshell,
flake-utils,
git-hooks,
nixpkgs,
nix-filter,
self,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
app-source = nix-filter.lib.filter {
root = ./.;
exclude = [ ];

include = [
"src"
(nix-filter.lib.matchExt "js")
(nix-filter.lib.matchExt "json")
(nix-filter.lib.matchExt "ts")
];
};

pkg-lock = builtins.fromJSON (builtins.readFile ./package.json);

pkgs = import nixpkgs {
overlays = [ devshell.overlays.default ];
inherit system;
};
in
{
checks.git-hooks = git-hooks.lib.${system}.run {
src = self;
hooks = {
actionlint.enable = true;

deadnix = {
enable = true;
settings.edit = true;
};

nixfmt-rfc-style.enable = true;

prettier = {
enable = true;
settings.write = true;
};

statix.enable = true;

statix-write = {
enable = true;
name = "Statix Write";
entry = "${pkgs.statix}/bin/statix fix";
language = "system";
pass_filenames = false;
};

trufflehog-verified = {
enable = pkgs.stdenv.isLinux;
name = "Trufflehog Search";
entry = "${pkgs.trufflehog}/bin/trufflehog git file://. --since-commit HEAD --only-verified --fail --no-update";
language = "system";
pass_filenames = false;
};
};
};

devShells.default = pkgs.devshell.mkShell {
devshell.startup.git-hooks.text = self.checks.${system}.git-hooks.shellHook;
name = "dev-shell";
packages = with pkgs; [
deadnix
nixfmt-rfc-style
nodejs_20
nodePackages.prettier
nodePackages.typescript
statix
];
};

formatter = pkgs.nixfmt-rfc-style;

packages = {
newwwie = pkgs.buildNpmPackage {
inherit (pkg-lock) version;
pname = "newwwie";
src = app-source;
npmDepsHash = "sha256-FGQpZmR5uSh3kLYyRPLG4KlQnnOzUxnJKeVkCVMabZM=";
};
};
}
);

}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"fetchEvents": "ts-node ./fetch-events/fetch-events.ts",
"format": "prettier --write .",
"typecheck": "tsc",
"test":"npx playwright test"
"test": "npx playwright test"
},
"repository": {
"type": "git",
Expand Down
Loading