Skip to content

Commit 10e3aab

Browse files
committed
token usage updates
1 parent 526f90e commit 10e3aab

File tree

6 files changed

+45
-26
lines changed

6 files changed

+45
-26
lines changed

.c9build.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ mvn pmd:pmd
1313
# Test
1414
mvn cobertura:cobertura -Dcobertura.report.format=xml
1515

16-
# Publish
16+
# Push content
17+
18+
## Requires TESTSPACE_TOKEN = $ACCESS_TOKEN:@samples.testspace.com.
19+
20+
BRANCH_NAME=`git symbolic-ref --short HEAD`
21+
GIT_URL=`git remote show origin -n | grep Fetch\ URL: | sed 's/.*URL: //'`
22+
REPO_SLUG=`echo ${GIT_URL#*github.com?} | sed 's/.git//'`
23+
1724
curl -s https://testspace-client.s3.amazonaws.com/testspace-linux.tgz | sudo tar -zxvf- -C /usr/local/bin
18-
testspace target/pmd.xml [Tests]target/surefire-reports/TEST*.xml target/site/cobertura/coverage.xml master.c9
25+
testspace @.testspace.txt $TESTSPACE_TOKEN/${REPO_SLUG/\//:}/${BRANCH_NAME}#c9.Build

.testspace.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
target/pmd.xml
2+
[Tests]target/surefire-reports/TEST*.xml
3+
target/site/cobertura/coverage.xml

.travis.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ script:
66
- mvn pmd:pmd
77
- mvn cobertura:cobertura -Dcobertura.report.format=xml
88

9-
after_script:
9+
# Requires TESTSPACE_TOKEN environment variable.
10+
after_script:
1011
- curl -s https://testspace-client.s3.amazonaws.com/testspace-linux.tgz | sudo tar -zxvf- -C /usr/local/bin
11-
- testspace target/pmd.xml [Tests]target/surefire-reports/TEST*.xml target/site/cobertura/coverage.xml $TESTSPACE_TOKEN/${TRAVIS_BRANCH}#travis.Build.${TRAVIS_BUILD_NUMBER}
12+
- testspace @.testspace.txt $TESTSPACE_TOKEN/${TRAVIS_REPO_SLUG/\//:}/${TRAVIS_BRANCH}#travis.Build.${TRAVIS_BUILD_NUMBER}
13+

README.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
[![Testspace](http://www.testspace.com/public/img/testspace_logo.png)](http://www.testspace.com)
1+
[![Testspace](http://www.testspace.com/img/Testspace.png)](http://www.testspace.com)
2+
23
***
34

45
## Java/JUnit sample for demonstrating Testspace
@@ -15,10 +16,10 @@ Using Multiple Online CI Services:
1516
***
1617
Publishing **Test Content** using www.testspace.com.
1718

18-
[![Space Health](https://samples.testspace.com/projects/124/spaces/454/badge)](https://samples.testspace.com/projects/124/spaces/454 "Test Cases")
19-
[![Space Metric](https://samples.testspace.com/projects/124/spaces/454/metrics/293/badge)](https://samples.testspace.com/spaces/454/schema/Code%20Coverage "Code Coverage (branches)")
20-
[![Space Metric](https://samples.testspace.com/projects/124/spaces/454/metrics/295/badge)](https://samples.testspace.com/spaces/454/schema/Code%20Coverage "Code Coverage (methods)")
21-
[![Space Metric](https://samples.testspace.com/projects/124/spaces/454/metrics/332/badge)](https://samples.testspace.com/spaces/454/schema/Static%20Analysis "Static Analysis (issues)")
19+
[![Space Health](https://samples.testspace.com/projects/167/spaces/816/badge)](https://samples.testspace.com/projects/167/spaces/816 "Test Cases")
20+
[![Space Metric](https://samples.testspace.com/projects/167/spaces/816/metrics/789/badge)](https://samples.testspace.com/spaces/816/schema/Code%20Coverage "Code Coverage (branches)")
21+
[![Space Metric](https://samples.testspace.com/projects/167/spaces/816/metrics/791/badge)](https://samples.testspace.com/spaces/816/schema/Code%20Coverage "Code Coverage (methods)")
22+
[![Space Metric](https://samples.testspace.com/projects/167/spaces/816/metrics/792/badge)](https://samples.testspace.com/spaces/816/schema/Static%20Analysis "Static Analysis (issues)")
2223

2324

2425
***
@@ -31,22 +32,22 @@ Build examples:
3132
mvn cobertura:cobertura -Dcobertura.report.format=xml
3233
</pre>
3334

34-
Publishing results example:
35+
Push Content using **Testspace client**:
3536

3637
<pre>
37-
testspace target/pmd.xml [Tests]target/surefire-reports/TEST*.xml target/site/cobertura/coverage.xml $TESTSPACE_TOKEN/$BRANCH_NAME
38-
</pre>
38+
curl -s https://testspace-client.s3.amazonaws.com/testspace-linux.tgz | sudo tar -zxvf- -C /usr/local/bin
39+
testspace @.testspace.txt $TESTSPACE_TOKEN/$GITHUB_ORG:$REPO_NAME/$BRANCH_NAME#$BUILD_NUMBER
40+
</pre>
3941

40-
Checkout the [Space](https://samples.testspace.com/projects/java.junit).
42+
Checkout the published [Test Content](https://samples.testspace.com/projects/testspace-samples:java.junit). Note that the `.testspace.txt` file contains the [set of files](http://help.testspace.com/how-to:publish-content#publishing-via-content-list-file) to publish.
4143

4244
***
4345

4446
To replicate this sample:
45-
- Account at www.testspace.com.
46-
- CI Environment Variable called **TESTSPACE_TOKEN** required:
47-
- `TESTSPACE_TOKEN` = `credentials@my-org-name.testspace.com/my-project`
48-
- `credentials` set to `username:password` or your [access token](http://help.testspace.com/reference:client-reference#login-credentials).
49-
- `my-org-name.testspace.com/my-project` based on your *organization* (subdomain) and *project* names.
50-
51-
47+
- Setup account at www.testspace.com.
48+
- Create a Environment variable called `TESTSPACE_TOKEN`
49+
- `TESTSPACE_TOKEN` = `credentials@Your-Org-Name.testspace.com`
50+
- `credentials` set to `username:password` or your [access token](http://help.testspace.com/reference:client-reference#login-credentials)
51+
- To [use Testspace with a CI system](http://help.testspace.com/how-to:add-to-ci-workflow), store `TESTSPACE_TOKEN` as a secure environment variable
52+
5253

circle.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ test:
88
- mvn pmd:pmd
99
- mvn cobertura:cobertura -Dcobertura.report.format=xml
1010

11-
post:
11+
# Requires TESTSPACE_TOKEN environment variable.
12+
post:
1213
- curl -s https://testspace-client.s3.amazonaws.com/testspace-linux.tgz | sudo tar -zxvf- -C /usr/local/bin
13-
- testspace target/pmd.xml [Tests]target/surefire-reports/TEST*.xml target/site/cobertura/coverage.xml $TESTSPACE_TOKEN/${CIRCLE_BRANCH}#circle.Build.${CIRCLE_BUILD_NUM}
14-
14+
- testspace @.testspace.txt $TESTSPACE_TOKEN/${CIRCLE_PROJECT_USERNAME}:${CIRCLE_PROJECT_REPONAME}/${CIRCLE_BRANCH}#circle.Build.${CIRCLE_BUILD_NUM}
15+

shippable.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@ language: java
22

33
env:
44
global:
5-
- secure: iiKOFC7m5xA5NkM8YlM4Z2X2mhIPrFbQtZWV2mdHsUwNhURyuC2GT3pDyQYi43KcgXuol4A/LBu1X0prYPaW5YgvZGiK0NLdrnlxKGl0jmdSAOeZWqm26KzvM6SNhlexPqyYpbPyLzaC0l5bC1zMkBkHkHhXqymXx5Y5F3cT0ur0s5YZWfexbuMchndQIi5xho9Y8v/zpMNglv787vDAb+kJA2RWqDsK/qJighBz5pETTDK0djtUNGzEZpF8H0SKohGjBImcONrfY52A2D9S4/I3Jp4h8So2uW3H2mFIIouikGuOvo3RvCJJQehcMxBWA0XxmDJdLTWwHyahrw13cQ==
5+
- secure: GKig6dRs9LpzK/MJ/24SWafAT20d7PIKD11EgBi2r13ZfG9lZi1Ous6LTh8DfRn+nBMHMH+bBbwG98pACzCrfrdRu1Lp3CgkxyV4oo2hPlnCUNhdrz96MrvD0ExAGDg4hB5T7jZzYWBwM5wHQLMi1hRGWdimZvHpeRmj2HJKLuf5Mf22srlh1PQxDKw6XlAngZpYqZp0TkVlWsVLCFhm8BiR3ftu3jIY9gcDHtNCcYUQ0MeX2K0HOsqKThVjNHGn48MTezXaCWFw0Mm5b08WNLp4uwbwaPEMSwMYsPb4QL15tMogOwVQp771QtWm+w7RAt16XfzAiLNcYGMMNT8rkA==
66

77
build:
88
ci:
99
- mvn clean compile
1010
- mvn pmd:pmd
1111
- mvn cobertura:cobertura -Dcobertura.report.format=xml
1212

13-
post_ci:
13+
# Requires TESTSPACE_TOKEN environment variable.
14+
on_success:
1415
- curl -s https://testspace-client.s3.amazonaws.com/testspace-linux.tgz | sudo tar -zxvf- -C /usr/local/bin
15-
- testspace target/pmd.xml [Tests]target/surefire-reports/TEST*.xml target/site/cobertura/coverage.xml $TESTSPACE_TOKEN/${BRANCH}#ship.Build.${BUILD_NUMBER}
16+
- testspace @.testspace.txt $TESTSPACE_TOKEN/${SHIPPABLE_REPO_SLUG/\//:}/${BRANCH}#ship.Build.${BUILD_NUMBER}
17+
18+
on_failure:
19+
- curl -s https://testspace-client.s3.amazonaws.com/testspace-linux.tgz | sudo tar -zxvf- -C /usr/local/bin
20+
- testspace @.testspace.txt $TESTSPACE_TOKEN/${SHIPPABLE_REPO_SLUG/\//:}/${BRANCH}#ship.Build.${BUILD_NUMBER}

0 commit comments

Comments
 (0)