diff --git a/.ci/esy-build-steps.yml b/.ci/esy-build-steps.yml index d0423a38..ab08a1d7 100644 --- a/.ci/esy-build-steps.yml +++ b/.ci/esy-build-steps.yml @@ -1,3 +1,6 @@ +parameters: + platform: "macOS" + steps: - script: 'npm install -g esy@0.5.6 --unsafe-perm' displayName: 'npm install -g esy' @@ -8,8 +11,18 @@ steps: - script: 'esy build' displayName: 'esy build' - - script: 'esy test' - displayName: 'esy test' + - script: 'esy test-ci' + displayName: 'esy test-ci' + continueOnError: true + + - task: PublishTestResults@2 + displayName: 'Publish JUnit file' + inputs: + testResultsFormat: JUnit + testResultsFiles: '**/junit.xml' + buildPlatform: ${{ parameters.platform }} + testRunTitle: ${{ parameters.platform }} + failTaskOnFailedTests: true - script: | :; set -e diff --git a/.gitignore b/.gitignore index 8b9aecc2..1c110a3c 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ _esyinstall .merlin _release _esy +junit.xml diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3730bfd0..f0564785 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -21,6 +21,8 @@ jobs: - template: .ci/use-node.yml - template: .ci/restore-build-cache.yml - template: .ci/esy-build-steps.yml + parameters: + platform: Linux - template: .ci/publish-build-cache.yml - job: MacOS @@ -39,6 +41,8 @@ jobs: - template: .ci/use-node.yml - template: .ci/restore-build-cache.yml - template: .ci/esy-build-steps.yml + parameters: + platform: macOS - template: .ci/publish-build-cache.yml - job: Windows @@ -57,6 +61,8 @@ jobs: - template: .ci/use-node.yml - template: .ci/restore-build-cache.yml - template: .ci/esy-build-steps.yml + parameters: + platform: Windows - template: .ci/publish-build-cache.yml # - job: Release diff --git a/esy.json b/esy.json index 620354f4..55c33ab9 100644 --- a/esy.json +++ b/esy.json @@ -22,7 +22,8 @@ "scripts": { "bootstrap": "esy x bash -cx ./bootstrap.cmd", "all": "./scripts/run-all.sh", - "test": "esy x bash -cx ./scripts/test.cmd" + "test": "esy x bash -cx ./scripts/test-dev.cmd", + "test-ci": "esy x bash -cx ./scripts/test-ci.cmd" }, "dependencies": { "@opam/dune": "*", diff --git a/scripts/test.cmd b/scripts/test-ci.cmd old mode 100755 new mode 100644 similarity index 78% rename from scripts/test.cmd rename to scripts/test-ci.cmd index ef36ee06..3da729d8 --- a/scripts/test.cmd +++ b/scripts/test-ci.cmd @@ -7,4 +7,4 @@ :; FORCE_COLOR=true esy x bash -cx ./src/refmterr/runTests.cmd :; # Run ReasonNativeTests.exe with correct root set. -:; REASON_NATIVE_ROOT="$DIR/../" esy x "ReasonNativeTests.exe" "$@" +:; REASON_NATIVE_ROOT="$DIR/../" esy x "TestCi.exe" "$@" diff --git a/scripts/test-dev.cmd b/scripts/test-dev.cmd new file mode 100755 index 00000000..96885b52 --- /dev/null +++ b/scripts/test-dev.cmd @@ -0,0 +1,10 @@ +:; set -e + +:; # This will be the location of this script. +:; DIR="$(cd "$(dirname "$0")" && pwd)" + +:; # Run refmterr tests. +:; FORCE_COLOR=true esy x bash -cx ./src/refmterr/runTests.cmd + +:; # Run ReasonNativeTests.exe with correct root set. +:; REASON_NATIVE_ROOT="$DIR/../" esy x "TestDev.exe" "$@" diff --git a/tests/TestCi.re b/tests/TestCi.re new file mode 100644 index 00000000..d6ccdce6 --- /dev/null +++ b/tests/TestCi.re @@ -0,0 +1,13 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */; + +Tests.TestFramework.run( + Rely.RunConfig.withReporters( + [Default, JUnit("./junit.xml")], + Rely.RunConfig.initialize(), + ), +); diff --git a/tests/ReasonNativeTests.re b/tests/TestDev.re similarity index 99% rename from tests/ReasonNativeTests.re rename to tests/TestDev.re index d4982ed3..96ae586e 100644 --- a/tests/ReasonNativeTests.re +++ b/tests/TestDev.re @@ -5,4 +5,5 @@ * LICENSE file in the root directory of this source tree. */; + Tests.TestFramework.cli(); diff --git a/tests/dune b/tests/dune index 10975a45..0b54e1e0 100644 --- a/tests/dune +++ b/tests/dune @@ -8,16 +8,26 @@ console.lib pastel-console.lib ) - (modules (:standard \ ReasonNativeTests)) + (modules (:standard \ TestDev TestCi)) ) (executable (package tests) - (name ReasonNativeTests) - (public_name ReasonNativeTests.exe) + (name TestDev) + (public_name TestDev.exe) (libraries Tests ) - (modules ReasonNativeTests) + (modules TestDev) +) +(executable + (package tests) + (name TestCi) + (public_name TestCi.exe) + (libraries + Tests + ) + (modules TestCi) ) (include_subdirs unqualified) (dirs :standard __tests__) +