forked from intersystems/TestCoverage
-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (64 loc) · 2.96 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Export XML and Release on Tag Push
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+' # force semantic versioning
jobs:
build-and-release:
runs-on: ubuntu-latest
env:
# ** FOR GENERAL USE, LIKELY NEED TO CHANGE: **
package: TestCoverage
container_image: intersystemsdc/iris-community:latest
# ** FOR GENERAL USE, MAY NEED TO CHANGE: **
build_flags: -dev -verbose # Load in -dev mode to get unit test code preloaded
test_package: UnitTest
# ** FOR GENERAL USE, SHOULD NOT NEED TO CHANGE: **
instance: iris
# Note: test_reports value is duplicated in test_flags environment variable
test_reports: test-reports
test_flags: >-
-verbose -DUnitTest.ManagerClass=TestCoverage.Manager -DUnitTest.JUnitOutput=/test-reports/junit.xml
-DUnitTest.FailuresAreFatal=1 -DUnitTest.Manager=TestCoverage.Manager
-DUnitTest.UserParam.CoverageReportClass=TestCoverage.Report.Cobertura.ReportGenerator
-DUnitTest.UserParam.CoverageReportFile=/source/coverage.xml
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run Container
run: |
# Create test_reports directory to share test results before running container
mkdir $test_reports
chmod 777 $test_reports
# Run InterSystems IRIS instance
docker pull $container_image
docker run -d -h $instance --name $instance -v $GITHUB_WORKSPACE:/source -v $GITHUB_WORKSPACE/$test_reports:/$test_reports --init $container_image
echo halt > wait
# Wait for instance to be ready
until docker exec --interactive $instance iris session $instance < wait; do sleep 1; done
- name: Install TestCoverage
run: |
echo "zpm \"install testcoverage\":1:1" > install-testcoverage
docker exec --interactive $instance iris session $instance -B < install-testcoverage
# Workaround for permissions issues in TestCoverage (creating directory for source export)
chmod 777 $GITHUB_WORKSPACE
- name: Export XML
run: |
# Pick the targets to export as XML
echo 'set list("TestCoverage.*.cls") = ""' >> export
echo 'set list("TestCoverage.inc") = ""' >> export
echo 'do $System.OBJ.Export(.list,"/source/TestCoverage-${{ github.ref_name }}.xml","/exportversion=2017.2")' >> export
docker exec --interactive $instance iris session $instance -B < export
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: TestCoverage-${{ github.ref_name }}.xml
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
body: |
Automated release created by [action-gh-release](https://github.com/softprops/action-gh-release).
draft: false
prerelease: false