Skip to content

Commit 59b4566

Browse files
committed
Convert integration tests to a flake
1 parent cc92726 commit 59b4566

7 files changed

Lines changed: 124 additions & 56 deletions

File tree

integration-tests/.envrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
use nix
1+
#!/bin/sh
2+
3+
use flake

integration-tests/default.nix

Lines changed: 0 additions & 44 deletions
This file was deleted.

integration-tests/flake.lock

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration-tests/flake.nix

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
description = "integration tests";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.05";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
};
8+
9+
outputs = { self, nixpkgs, flake-utils, ... }:
10+
flake-utils.lib.eachDefaultSystem (system:
11+
with import nixpkgs { inherit system; };
12+
with pkgs;
13+
let
14+
getEnv = name: default:
15+
(if "" == builtins.getEnv name then
16+
default
17+
else
18+
builtins.getEnv name);
19+
composerPackages = {
20+
"7.4" = php74Packages.composer;
21+
"8.0" = php80Packages.composer;
22+
"8.1" = php81Packages.composer;
23+
};
24+
phpPackages = {
25+
"7.4" = pkgs.php74;
26+
"8.0" = pkgs.php80;
27+
"8.1" = pkgs.php81;
28+
};
29+
phpVersion = getEnv "PHP_VERSION" "7.4";
30+
composer = lib.getAttr phpVersion composerPackages;
31+
php = lib.getAttr phpVersion phpPackages;
32+
wordpress = (pkgs.wordpress.overrideAttrs (oldAttrs: rec {
33+
version = getEnv "WORDPRESS_VERSION" "6.0.1";
34+
src = fetchurl {
35+
url = "https://wordpress.org/wordpress-${version}.tar.gz";
36+
sha256 = getEnv "WORDPRESS_SHA256"
37+
"f678596804aa89d7cdc9280862938464eab25aeaebfefa91ae175e15aa3ef054";
38+
};
39+
}));
40+
in {
41+
devShells.default = mkShell {
42+
buildInputs = [
43+
(clojure.override { jdk = jdk17_headless; })
44+
composer
45+
git
46+
mariadb
47+
nginx
48+
php
49+
rlwrap
50+
unzip
51+
wordpress
52+
wp-cli
53+
zip
54+
];
55+
WORDPRESS_PATH = wordpress;
56+
};
57+
});
58+
}

integration-tests/run-dev-server.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
set -e
44

5-
WP2STATIC_SYMLINK=t nix-shell --run "clojure -M:dev-server"
5+
WP2STATIC_SYMLINK=t nix develop -c clojure -M:dev-server

integration-tests/shell.nix

Lines changed: 0 additions & 9 deletions
This file was deleted.

integration-tests/test-matrix.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ for PHP_VERSION in "7.4" "8.0" "8.1"; do
1010
WORDPRESS_VERSION="${WP%=*}"
1111
WORDPRESS_SHA256="${WP#*=}"
1212
echo "PHP Version $PHP_VERSION, Wordpress Version $WORDPRESS_VERSION"
13-
PHP_VERSION=$PHP_VERSION WORDPRESS_SHA256=$WORDPRESS_SHA256 WORDPRESS_VERSION=$WORDPRESS_VERSION nix-shell --run "clojure -X:test"
13+
PHP_VERSION=$PHP_VERSION WORDPRESS_SHA256=$WORDPRESS_SHA256 WORDPRESS_VERSION=$WORDPRESS_VERSION nix develop -c clojure -X:test
1414
done
1515
done

0 commit comments

Comments
 (0)