-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test-summary action examples for various languages
Examples for various languages and test frameworks for using the [test-summary action](https://github.com/test-summary/examples).
- Loading branch information
0 parents
commit 8f02e0d
Showing
38 changed files
with
18,441 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
name: Examples | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
|
||
# This runs C tests using the Clar test framework | ||
c-clar: | ||
name: C / Clar | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
- name: Build and test | ||
run: | | ||
make | ||
./test -rresults/tests.xml | ||
working-directory: c-clar | ||
- name: Create test summary | ||
uses: test-summary/action@dist | ||
with: | ||
paths: c-clar/results/**/*.xml | ||
output: c-clar/results/test-summary.md | ||
if: always() | ||
- name: Upload test summary | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: c-clar | ||
path: c-clar/results/test-summary.md | ||
if: always() | ||
|
||
# This runs .NET tests using the standard .NET test driver | ||
dotnet: | ||
name: .NET | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
- name: Build and test | ||
run: | | ||
dotnet build | ||
dotnet test --logger "junit;LogFilePath=results/tests.xml" | ||
working-directory: dotnet | ||
- name: Create test summary | ||
uses: test-summary/action@dist | ||
with: | ||
paths: dotnet/results/**/*.xml | ||
output: dotnet/results/test-summary.md | ||
if: always() | ||
- name: Upload test summary | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: dotnet | ||
path: dotnet/results/test-summary.md | ||
if: always() | ||
|
||
# This runs Java tests using the JUnit test framework | ||
java-junit: | ||
name: Java / JUint | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
- name: Build and test | ||
run: | | ||
ant | ||
working-directory: java-junit | ||
- name: Create test summary | ||
uses: test-summary/action@dist | ||
with: | ||
paths: java-junit/results/**/*.xml | ||
output: java-junit/results/test-summary.md | ||
if: always() | ||
- name: Upload test summary | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: java-junit | ||
path: java-junit/results/test-summary.md | ||
if: always() | ||
|
||
# This runs JavaScript tests using the Mocha test framework | ||
javascript-mocha: | ||
name: JavaScript / Mocha | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
- name: Build and test | ||
run: | | ||
npm ci | ||
npm run test | ||
working-directory: javascript-mocha | ||
- name: Create test summary | ||
uses: test-summary/action@dist | ||
with: | ||
paths: javascript-mocha/results/**/*.xml | ||
output: javascript-mocha/results/test-summary.md | ||
if: always() | ||
- name: Upload test summary | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: javascript-mocha | ||
path: javascript-mocha/results/test-summary.md | ||
if: always() | ||
|
||
# This runs JavaScript tests using the Node-Tap test framework | ||
javascript-tap: | ||
name: JavaScript / Node-Tap | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
- name: Build and test | ||
run: | | ||
npm ci | ||
npm run test | ||
working-directory: javascript-tap | ||
- name: Create test summary | ||
uses: test-summary/action@dist | ||
with: | ||
paths: javascript-tap/results/**/*.tap | ||
output: javascript-tap/results/test-summary.md | ||
if: always() | ||
- name: Upload test summary | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: javascript-tap | ||
path: javascript-tap/results/test-summary.md | ||
if: always() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
test-summary examples | ||
===================== | ||
 | ||
|
||
Some example projects to show how to emit test output in various types of projects, and create a test summary to add to your GitHub Actions workflow. | ||
|
||
Examples: | ||
|
||
* [C with the Clar test framework](c-clar/) | ||
* [Java with the JUnit test framework](java-junit/) | ||
* [JavaScript with the mocha test framework](javascript-mocha/) | ||
* [JavaScript with the node-tap test framework](javascript-tap/) | ||
* [.NET](dotnet/) | ||
|
||
For more information about how to configure the test-summary action, visit the [test-summary action](https://github.com/test-summary/action) repository. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
*.o | ||
example | ||
clar.suite | ||
.clarcache | ||
results/ | ||
test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
SRCS=clar.c test.c | ||
OBJS=$(SRCS:.c=.o) | ||
CFLAGS=-g -I. -Wall -Wextra -Werror -Wno-unused-function | ||
|
||
.PHONY: clean | ||
|
||
all: test | ||
|
||
.c.o: | ||
${CC} ${CFLAGS} -c $< | ||
|
||
clar.suite: test.c | ||
python generate.py | ||
|
||
clar.c: clar.suite .clarcache | ||
|
||
test: $(OBJS) | ||
$(CC) $(CFLAGS) -o $@ $(OBJS) | ||
|
||
clean: | ||
$(RM) $(OBJS) test .clarcache clar.suite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
test-summary example: C with Clar | ||
================================= | ||
|
||
This produces a test summary for a C project using the [Clar test framework](https://github.com/clar-test/clar). | ||
|
||
GitHub Actions Workflow | ||
----------------------- | ||
|
||
An example GitHub Actions workflow that builds a C project, runs the clar tests, runs the test-summary action and uploads the test summary markdown as an artifact. | ||
|
||
```yaml | ||
name: Build and Test .NET Core | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
name: Build and Test | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
- name: Build and test | ||
run: | | ||
make | ||
./test -rresults/tests.xml | ||
- name: Create test summary | ||
uses: test-summary/action@dist | ||
with: | ||
paths: results/**/*.xml | ||
output: results/test-summary.md | ||
if: always() | ||
- name: Upload test summary | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: test-summary | ||
path: results/test-summary.md | ||
if: always() | ||
``` |
Oops, something went wrong.