Skip to content

Commit

Permalink
Generate junit results and publish in CI (#128)
Browse files Browse the repository at this point in the history
Summary:
bypass-lint
Pull Request resolved: #128

Differential Revision: D14548702

fbshipit-source-id: c27f797c56a8815280f2f4ef9b10346b87421165
  • Loading branch information
ulrikstrid authored and facebook-github-bot committed Mar 22, 2019
1 parent 319e8bb commit 6424555
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 8 deletions.
17 changes: 15 additions & 2 deletions .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'
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -28,3 +28,4 @@ _esyinstall
.merlin
_release
_esy
junit.xml
6 changes: 6 additions & 0 deletions azure-pipelines.yml
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion esy.json
Expand Up @@ -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": "*",
Expand Down
2 changes: 1 addition & 1 deletion scripts/test.cmd → scripts/test-ci.cmd 100755 → 100644
Expand Up @@ -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" "$@"
10 changes: 10 additions & 0 deletions 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" "$@"
13 changes: 13 additions & 0 deletions 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(),
),
);
1 change: 1 addition & 0 deletions tests/ReasonNativeTests.re → tests/TestDev.re
Expand Up @@ -5,4 +5,5 @@
* LICENSE file in the root directory of this source tree.
*/;


Tests.TestFramework.cli();
18 changes: 14 additions & 4 deletions tests/dune
Expand Up @@ -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__)

0 comments on commit 6424555

Please sign in to comment.