Skip to content

Commit

Permalink
Merge pull request #244 from semaphoreci/mk/update-test-results-cli
Browse files Browse the repository at this point in the history
Bump test results CLI to v0.4.5
  • Loading branch information
skipi authored Jul 2, 2021
2 parents 8ca794c + 1603c44 commit 7b5bc04
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
tmp*
report.xml
28 changes: 28 additions & 0 deletions .semaphore/reports.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: v1.0
name: Reports
agent:
machine:
type: e1-standard-2
os_image: ubuntu1804
blocks:
- name: Test results
task:
jobs:
- name: Generate pipeline report
commands:
- cd /tmp
- wget https://github.com/semaphoreci/test-results/releases/download/v0.4.5/test-results_Linux_x86_64.tar.gz -P /tmp
- tar -xf test-results_Linux_x86_64.tar.gz
- chmod +x test-results
- sudo mv test-results /usr/local/bin/test-results
- test-results --version
- cd -
- artifact pull workflow test-results -d /tmp/test-results
- cd /tmp/test-results
- >
for directory in * ; do
if [ -d "$directory" ]; then
test-results combine $directory $directory.json
artifact push workflow $directory.json -d test-results/$directory.json
fi
done
32 changes: 24 additions & 8 deletions .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,11 @@ blocks:
- tests/test-results.bats
- tests/macOS_sem_version.bats
commands:
- bats -o /tmp/ --report-formatter junit --tap --timing $TEST
- test-results publish /tmp/report.xml
- bats --report-formatter junit --tap --timing $TEST
epilogue:
always:
commands:
- 'test-results publish report.xml --name="Bats: Mac" --suite-prefix=$TEST'

- name: 'Bats: Docker'
dependencies: []
Expand Down Expand Up @@ -131,8 +134,11 @@ blocks:
- tests/artifacts.bats
- tests/test-results.bats
commands:
- bats -o /tmp/ --report-formatter junit --tap --timing $TEST
- test-results publish /tmp/report.xml
- bats --report-formatter junit --tap --timing $TEST
epilogue:
always:
commands:
- 'test-results publish report.xml --name="Bats: Docker" --suite-prefix=$TEST'

- name: 'Bats: Minimal Docker'
dependencies: []
Expand Down Expand Up @@ -161,8 +167,11 @@ blocks:
- tests/artifacts.bats
- tests/test-results.bats
commands:
- bats -o /tmp/ --report-formatter junit --tap --timing $TEST
- test-results publish /tmp/report.xml
- bats --report-formatter junit --tap --timing $TEST
epilogue:
always:
commands:
- 'test-results publish report.xml --name="Bats: Minimal Docker" --suite-prefix=$TEST'

- name: 'Bats: Linux'
dependencies: []
Expand Down Expand Up @@ -191,8 +200,11 @@ blocks:
- tests/compiler.bats
- tests/test-results.bats
commands:
- bats -o /tmp/ --report-formatter junit --tap --timing $TEST
- test-results publish /tmp/report.xml
- bats --report-formatter junit --tap --timing $TEST
epilogue:
always:
commands:
- 'test-results publish report.xml --name="Bats: Linux" --suite-prefix=$TEST'

promotions:
- name: Release
Expand All @@ -201,3 +213,7 @@ promotions:
- result: passed
branch:
- ^refs/tags/v*
- name: Pipeline report
pipeline_file: reports.yml
auto_promote:
when: true
2 changes: 1 addition & 1 deletion release/create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -euo pipefail
ARTIFACT_CLI_VERSION="v0.4.6"
WHEN_CLI_VERSION="v1.0.5"
SPC_CLI_VERSION="v1.8.1"
TEST_RESULTS_CLI_VERSION="v0.2.3"
TEST_RESULTS_CLI_VERSION="v0.4.5"

ARTIFACT_CLI_URL="https://github.com/semaphoreci/artifact/releases/download/$ARTIFACT_CLI_VERSION"
SPC_CLI_URL="https://github.com/semaphoreci/spc/releases/download/$SPC_CLI_VERSION"
Expand Down
1 change: 1 addition & 0 deletions tests/test-results.bats
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ teardown() {

teardown_file() {
artifact yank job test-results
artifact yank workflow test-results/$SEMAPHORE_PIPELINE_ID/$SEMAPHORE_JOB_ID.json
}

@test "test-results publish works" {
Expand Down
2 changes: 1 addition & 1 deletion tests/test-results/junit-sample.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"id":"a9497520-97f8-30ac-a6f4-6e3f69dc69a5","name":"Rspec Suite","framework":"rspec","isDisabled":false,"suites":[{"id":"6efd5b21-69b2-30f4-a3c3-12cf38a3406f","name":"spec/calculator/adder_spec.rb","isSkipped":false,"isDisabled":false,"timestamp":"","hostname":"","package":"","tests":[{"id":"92182c6a-bac1-3a92-ac0b-3c4b601f07ad","file":"spec/calculator/adder_spec.rb","classname":"spec.calculator.adder_spec","package":"","name":"Calculator::Adder sums arguments #1","duration":1084000,"state":"passed","failure":null,"error":null,"systemOut":"","systemErr":""},{"id":"2a7914b3-89eb-3493-a7aa-508425314d4a","file":"spec/calculator/adder_spec.rb","classname":"spec.calculator.adder_spec","package":"","name":"Calculator::Adder sums arguments #2","duration":12271000,"state":"failed","failure":{"message":"\nexpected: -1\n got: 3\n\n(compared using ==)\n","type":"RSpec::Expectations::ExpectationNotMetError","body":"Failure/Error: expect(result).to eq(-1)\n\n expected: -1\n got: 3\n\n (compared using ==)\n./spec/calculator/adder_spec.rb:11:in `block (2 levels) in \u003ctop (required)\u003e'"},"error":null,"systemOut":"","systemErr":""},{"id":"c7d4b798-9a11-3d01-9fc2-1729507f84b8","file":"spec/calculator/adder_spec.rb","classname":"spec.calculator.adder_spec","package":"","name":"Calculator::Adder can be skipped","duration":8000,"state":"skipped","failure":null,"error":null,"systemOut":"","systemErr":""}],"properties":null,"summary":{"total":3,"passed":1,"skipped":1,"error":0,"failed":1,"disabled":0,"duration":13363000},"systemOut":"","systemErr":""},{"id":"cfdb5d77-6d61-3d67-b11a-5b704c72c965","name":"spec/calculator/subtractor_spec.rb","isSkipped":false,"isDisabled":false,"timestamp":"","hostname":"","package":"","tests":[{"id":"272ecacb-e92d-35c7-a3f5-30a0e6bf4b99","file":"spec/calculator/subtractor_spec.rb","classname":"spec.calculator.subtractor_spec","package":"","name":"Calculator::Subtractor subtracts arguments #1","duration":153000,"state":"passed","failure":null,"error":null,"systemOut":"","systemErr":""},{"id":"8a7c05d0-ed13-3f07-a62b-8d2cdaa544a2","file":"spec/calculator/subtractor_spec.rb","classname":"spec.calculator.subtractor_spec","package":"","name":"Calculator::Subtractor subtracts arguments #2","duration":119000,"state":"failed","failure":{"message":"\nexpected: 3\n got: -1\n\n(compared using ==)\n","type":"RSpec::Expectations::ExpectationNotMetError","body":"Failure/Error: expect(result).to eq(3)\n\n expected: 3\n got: -1\n\n (compared using ==)\n./spec/calculator/subtractor_spec.rb:11:in `block (2 levels) in \u003ctop (required)\u003e'"},"error":null,"systemOut":"","systemErr":""},{"id":"801954c2-31fc-306c-b9d6-2eca8d1d0f07","file":"spec/calculator/subtractor_spec.rb","classname":"spec.calculator.subtractor_spec","package":"","name":"Calculator::Subtractor can be skipped","duration":5000,"state":"skipped","failure":null,"error":null,"systemOut":"","systemErr":""}],"properties":null,"summary":{"total":3,"passed":1,"skipped":1,"error":0,"failed":1,"disabled":0,"duration":277000},"systemOut":"","systemErr":""}],"summary":{"total":6,"passed":2,"skipped":2,"error":0,"failed":2,"disabled":0,"duration":13640000},"status":"success","statusMessage":""}
{"testResults":[{"id":"99ec6b78-8d28-33bb-9c4b-e38fd0000bf4","name":"Rspec Suite","framework":"rspec","isDisabled":false,"suites":[{"id":"7ec58d3e-ae4b-3245-964b-4fff0e02fc07","name":"spec/calculator/subtractor_spec.rb","isSkipped":false,"isDisabled":false,"timestamp":"","hostname":"","package":"","tests":[{"id":"96b79360-dc8d-343a-b747-7d79fcaf8829","file":"spec/calculator/subtractor_spec.rb","classname":"spec.calculator.subtractor_spec","package":"","name":"Calculator::Subtractor subtracts arguments #1","duration":153000,"state":"passed","failure":null,"error":null,"systemOut":"","systemErr":""},{"id":"bf57bb75-ecbc-347f-8b53-25007a5a8952","file":"spec/calculator/subtractor_spec.rb","classname":"spec.calculator.subtractor_spec","package":"","name":"Calculator::Subtractor subtracts arguments #2","duration":119000,"state":"failed","failure":{"message":"\nexpected: 3\n got: -1\n\n(compared using ==)\n","type":"RSpec::Expectations::ExpectationNotMetError","body":"Failure/Error: expect(result).to eq(3)\n\n expected: 3\n got: -1\n\n (compared using ==)\n./spec/calculator/subtractor_spec.rb:11:in `block (2 levels) in \u003ctop (required)\u003e'"},"error":null,"systemOut":"","systemErr":""},{"id":"b54dab46-234e-3317-80fd-7b8d9fc4677e","file":"spec/calculator/subtractor_spec.rb","classname":"spec.calculator.subtractor_spec","package":"","name":"Calculator::Subtractor can be skipped","duration":5000,"state":"skipped","failure":null,"error":null,"systemOut":"","systemErr":""}],"properties":null,"summary":{"total":3,"passed":1,"skipped":1,"error":0,"failed":1,"disabled":0,"duration":277000},"systemOut":"","systemErr":""},{"id":"d1c92324-83c6-3660-b21b-bcb065629fe3","name":"spec/calculator/adder_spec.rb","isSkipped":false,"isDisabled":false,"timestamp":"","hostname":"","package":"","tests":[{"id":"79e0641c-37ab-37ed-815c-a81a1cf653cd","file":"spec/calculator/adder_spec.rb","classname":"spec.calculator.adder_spec","package":"","name":"Calculator::Adder sums arguments #1","duration":1084000,"state":"passed","failure":null,"error":null,"systemOut":"","systemErr":""},{"id":"619bba0e-4b2f-3210-9814-aee2f176126f","file":"spec/calculator/adder_spec.rb","classname":"spec.calculator.adder_spec","package":"","name":"Calculator::Adder sums arguments #2","duration":12271000,"state":"failed","failure":{"message":"\nexpected: -1\n got: 3\n\n(compared using ==)\n","type":"RSpec::Expectations::ExpectationNotMetError","body":"Failure/Error: expect(result).to eq(-1)\n\n expected: -1\n got: 3\n\n (compared using ==)\n./spec/calculator/adder_spec.rb:11:in `block (2 levels) in \u003ctop (required)\u003e'"},"error":null,"systemOut":"","systemErr":""},{"id":"0d463856-2a5a-3197-a5bb-3d92298d1e36","file":"spec/calculator/adder_spec.rb","classname":"spec.calculator.adder_spec","package":"","name":"Calculator::Adder can be skipped","duration":8000,"state":"skipped","failure":null,"error":null,"systemOut":"","systemErr":""}],"properties":null,"summary":{"total":3,"passed":1,"skipped":1,"error":0,"failed":1,"disabled":0,"duration":13363000},"systemOut":"","systemErr":""}],"summary":{"total":6,"passed":2,"skipped":2,"error":0,"failed":2,"disabled":0,"duration":13640000},"status":"success","statusMessage":""}]}

0 comments on commit 7b5bc04

Please sign in to comment.