From bf7e20f68e86ed9eeae15085b3d28882dba302fd Mon Sep 17 00:00:00 2001 From: 21CSM <81891917+21CSM@users.noreply.github.com> Date: Sat, 21 Sep 2024 00:49:41 -0400 Subject: [PATCH 1/3] ci: add integration testing to build.yml Just checking if this even works - not sure if it will run on a fresh Ubuntu install --- .github/workflows/build.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4868e02..c4d6b14 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,4 +34,7 @@ jobs: nix develop -c pnpm install - name: Run Unit Tests run: | - nix develop -c pnpm run test:unit \ No newline at end of file + nix develop -c pnpm run test:unit + - name: Run Integration Tests + run: | + nix develop -c pnpm run test:integration \ No newline at end of file From f73ed7ba785f04dc491bd4e27fcb0ab6ee2b55fe Mon Sep 17 00:00:00 2001 From: 21CSM <81891917+21CSM@users.noreply.github.com> Date: Sat, 21 Sep 2024 00:54:14 -0400 Subject: [PATCH 2/3] ci: add command to install playwright browsers This is not very "nix-like" but should get it working for now. --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c4d6b14..f257922 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,4 +37,5 @@ jobs: nix develop -c pnpm run test:unit - name: Run Integration Tests run: | + nix develop -c pnpm exec playwright install nix develop -c pnpm run test:integration \ No newline at end of file From f959adc705d4bdf66cc86b3f169bf933b1446757 Mon Sep 17 00:00:00 2001 From: 21CSM <81891917+21CSM@users.noreply.github.com> Date: Sat, 21 Sep 2024 01:21:24 -0400 Subject: [PATCH 3/3] build(flake): add playwright-web-flake for integration testing --- .github/workflows/build.yml | 1 - flake.lock | 69 ++++++++++++++++++++++++++++++++++++- flake.nix | 16 +++++++-- 3 files changed, 82 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f257922..c4d6b14 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,5 +37,4 @@ jobs: nix develop -c pnpm run test:unit - name: Run Integration Tests run: | - nix develop -c pnpm exec playwright install nix develop -c pnpm run test:integration \ No newline at end of file diff --git a/flake.lock b/flake.lock index f8cec64..5277ece 100644 --- a/flake.lock +++ b/flake.lock @@ -18,6 +18,24 @@ "type": "github" } }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1689068808, + "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1726755586, @@ -34,10 +52,44 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1691371061, + "narHash": "sha256-BxPbPVlBIoneaXIBiHd0LVzA+L4nmvFCNBU6TmQAiMM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5068bc8fe943bde3c446326da8d0ca9c93d5a682", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "playwright": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1726878103, + "narHash": "sha256-6j8gDbPS8d8jSgo+wBCYKH3/JWrSf8VTueoAC1iV2PM=", + "owner": "pietdevries94", + "repo": "playwright-web-flake", + "rev": "03a85b72fa2d1f764118c3544a5850bec9989555", + "type": "github" + }, + "original": { + "owner": "pietdevries94", + "repo": "playwright-web-flake", + "type": "github" + } + }, "root": { "inputs": { "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "playwright": "playwright" } }, "systems": { @@ -54,6 +106,21 @@ "repo": "default", "type": "github" } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index eab1cb8..eb13b41 100644 --- a/flake.nix +++ b/flake.nix @@ -4,20 +4,32 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; + playwright.url = "github:pietdevries94/playwright-web-flake"; }; - outputs = { self, nixpkgs, flake-utils }: + outputs = { self, nixpkgs, flake-utils, playwright }: flake-utils.lib.eachDefaultSystem (system: let - pkgs = import nixpkgs { inherit system; }; + overlay = final: prev: { + inherit (playwright.packages.${system}) playwright-test playwright-driver; + }; + pkgs = import nixpkgs { + inherit system; + overlays = [ overlay ]; + }; buildInputs = with pkgs; [ nodejs_22 pnpm + playwright-test ]; in { devShells.default = pkgs.mkShell { inherit buildInputs; + shellHook = '' + export PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 + export PLAYWRIGHT_BROWSERS_PATH="${pkgs.playwright-driver.browsers}" + ''; }; checks.default = pkgs.runCommand "check-env" {