Skip to content

Commit

Permalink
Add some basic devenv tests
Browse files Browse the repository at this point in the history
devenv v1.0 will add proper testing infrastructure, but for now this is a
noddy solution.
  • Loading branch information
anoadragon453 committed Oct 27, 2023
1 parent 721de45 commit defd6c8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .ci/scripts/build-all-dev-envs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,19 @@ for project in "$PROJECT_FLAKES_DIR"/*/ ; do
# Extract the git URL of the project. We often need the files of the
# project locally in order to build the development shell:
url=$(grep "^# ci.project-url:" "$PROJECT_FLAKES_DIR/$project/default.nix" | awk -F': ' '{print $2}')
# Extract the CI test command of the project. We'll use this to check
# that the development environment built successfully.
cmd=$(grep "^# ci.test-command:" "$PROJECT_FLAKES_DIR/$project/default.nix" | awk -F': ' '{print $2}')
echo "Cloning repo: $url"
# Clone the project to a directory with the same name.
git clone --depth 1 -q "$url" "$project"
git clone --depth 1 --single-branch -q "$url" "$project"
# Enter the project directory.
cd "$project"
# Show the generated outputs of the flake.
nix flake show ..
# Attempt to build and enter the development environment,
# then immediately exit the built shell.
nix develop --impure ..#"$project" -c "true"
# then run the specified test command.
nix develop --impure ..#"$project" -c bash -c "$cmd"
# Leave the project directory.
cd ..
# Delete the project directory.
Expand Down
1 change: 1 addition & 0 deletions project-flakes/complement/module.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# ci.project-url: https://github.com/matrix-org/complement
# ci.test-command: go build ./tests/...
{ pkgs, ... }:

{
Expand Down
1 change: 1 addition & 0 deletions project-flakes/element-web/module.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# ci.project-url: https://github.com/vector-im/element-web
# ci.test-command: yarn install && yarn build
{ pkgs, ... }:

{
Expand Down
1 change: 1 addition & 0 deletions project-flakes/synapse/module.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# ci.project-url: https://github.com/matrix-org/synapse
# ci.test-command: python -m synapse.app.homeserver --server-name local -c homeserver.yaml --generate-config --report-stats=no
{ pkgs, ... }:

let
Expand Down
1 change: 1 addition & 0 deletions project-flakes/sytest/module.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# ci.project-url: https://github.com/matrix-org/sytest
# ci.test-command: perl --version
{ pkgs, ... }:

{
Expand Down

0 comments on commit defd6c8

Please sign in to comment.