diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 42ac17eab2bfe497ec8fc16be4128d7b020ac0ff..3f959fbe32ad36117d8f62d822072ab14727a0cd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -55,7 +55,7 @@ deploy: script: - nix develop --command deploy after_script: - - nix develop --command cleanup + - nix develop --command clean-up when: on_success diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 2b23e356a827044baa9d8a955d99634d65723ebb..74c38da090351d0481f85b95777a18380208da8c 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,8 +5,12 @@ </component> <component name="ChangeListManager"> <list default="true" id="9979eb22-471e-4f2f-b624-fd3edb5e8c6e" name="Changes" comment=""> + <change beforePath="$PROJECT_DIR$/.gitlab-ci.yml" beforeDir="false" afterPath="$PROJECT_DIR$/.gitlab-ci.yml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> - <change beforePath="$PROJECT_DIR$/nix/scripts/run-ci-tests.nix" beforeDir="false" afterPath="$PROJECT_DIR$/nix/scripts/run-ci-tests.nix" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/flake.nix" beforeDir="false" afterPath="$PROJECT_DIR$/flake.nix" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/nix/scripts/cleanup.nix" beforeDir="false" afterPath="$PROJECT_DIR$/nix/scripts/clean-up.nix" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/nix/scripts/go-task.nix" beforeDir="false" afterPath="$PROJECT_DIR$/nix/scripts/go-task.nix" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/nix/scripts/run-extended-tests.nix" beforeDir="false" afterPath="$PROJECT_DIR$/nix/scripts/run-extended-tests.nix" afterDir="false" /> </list> <option name="SHOW_DIALOG" value="false" /> <option name="HIGHLIGHT_CONFLICTS" value="true" /> diff --git a/flake.nix b/flake.nix index a3d03cb57d05a2a5fc47f1e8994cfbb0778a4f32..c2558efd80095ad2eaca96b26ceafe2a41426785 100644 --- a/flake.nix +++ b/flake.nix @@ -23,6 +23,9 @@ script-run-ci-tests = pkgs'.callPackage ./nix/scripts/run-ci-tests.nix {}; script-check-code = pkgs'.callPackage ./nix/scripts/check-code.nix {}; script-build-cover-report = pkgs'.callPackage ./nix/scripts/build-cover-report.nix {}; + + script-clean-up = pkgs'.callPackage ./nix/scripts/clean-up.nix {}; + script-deploy = pkgs'.callPackage ./nix/scripts/deploy.nix {}; import-version = version.packages.${system}.version; in { @@ -38,6 +41,9 @@ script-check-code script-build-cover-report script-task + + script-clean-up + script-deploy import-version diff --git a/nix/scripts/cleanup.nix b/nix/scripts/clean-up.nix similarity index 82% rename from nix/scripts/cleanup.nix rename to nix/scripts/clean-up.nix index 8dc2182daa357b61b50d3ee04c6e94bea0223cd4..4b80e1671c03944d0d5a0fdaba3a211b626792ec 100644 --- a/nix/scripts/cleanup.nix +++ b/nix/scripts/clean-up.nix @@ -10,7 +10,10 @@ in echo_header "Cleaning up" + echo_step "Removing credentials" ${pkgs.git}/bin/git config --global --unset credential.helper if [ -f /root/.docker/config.json ]; then rm /root/.docker/config.json; fi + + echo_ok "Cleaned up" '' diff --git a/nix/scripts/go-task.nix b/nix/scripts/go-task.nix index 15c7eb25131660e419fab1a2509566337eda4d2e..19cd51470749c835708688e400069548c61702b5 100644 --- a/nix/scripts/go-task.nix +++ b/nix/scripts/go-task.nix @@ -24,6 +24,7 @@ - ret env: TEST_BY_TASK: true + USER_WORKING_DIR: "{{.USER_WORKING_DIR}}" cmds: - run-extended-tests silent: true diff --git a/nix/scripts/run-extended-tests.nix b/nix/scripts/run-extended-tests.nix index eca5e38407dcbf201281d85bf1e320d0069a04e7..04276ae0a457e753e46a6d466b751bd942a3f22b 100644 --- a/nix/scripts/run-extended-tests.nix +++ b/nix/scripts/run-extended-tests.nix @@ -9,32 +9,45 @@ in ${common} - echo_header "Running tests" - echo_step "Downloading docker images" + echo_header "Running extended tests" download_test_images setup_go_env + cd_working_dir - echo_section "Running tests" + echo_step "Running tests" if ! ${pkgs.go}/bin/go test -tags "runOnTask" -cover ./... then echo_fail "Failed to run tests" exit 1 fi + echo_ok "All tests passed" - echo_section "Running tests" + echo_step "Running benchmarks" if ! ${pkgs.go}/bin/go test -tags "runOnTask,bench" -bench ./... then echo_fail "Failed to run benchmarks" exit 1 fi + echo_ok "Benchmarks passed" - echo_section "Running tests" + echo_step "Running race tests" if ! ${pkgs.go}/bin/go test -tags "runOnTask,race" -race ./... then echo_fail "Failed to run race tests" exit 1 fi + echo_ok "race tests passed" + + echo_step "Running fuzz tests" + if ! ${pkgs.go}/bin/go test -tags "runOnTask,fuzz" -fuzz ./... + then + echo_fail "Failed to run fuzz tests" + exit 1 + fi + + echo_ok "Fuzz tests passed" + echo_ok "All tests passed" ''