Skip to content

Commit 31961fd

Browse files
committed
ci: implement workflow for automatic release
1 parent 915fae1 commit 31961fd

File tree

1 file changed

+60
-5
lines changed

1 file changed

+60
-5
lines changed

.github/workflows/release.yml

+60-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Create Release on Tag Push
1+
name: Export XML and Release on Tag Push
22

33
on:
44
push:
@@ -8,18 +8,73 @@ on:
88
jobs:
99
build:
1010
runs-on: ubuntu-latest
11+
12+
env:
13+
# ** FOR GENERAL USE, LIKELY NEED TO CHANGE: **
14+
package: TestCoverage
15+
container_image: intersystemsdc/iris-community:latest
16+
17+
# ** FOR GENERAL USE, MAY NEED TO CHANGE: **
18+
build_flags: -dev -verbose # Load in -dev mode to get unit test code preloaded
19+
test_package: UnitTest
20+
21+
# ** FOR GENERAL USE, SHOULD NOT NEED TO CHANGE: **
22+
instance: iris
23+
# Note: test_reports value is duplicated in test_flags environment variable
24+
test_reports: test-reports
25+
test_flags: >-
26+
-verbose -DUnitTest.ManagerClass=TestCoverage.Manager -DUnitTest.JUnitOutput=/test-reports/junit.xml
27+
-DUnitTest.FailuresAreFatal=1 -DUnitTest.Manager=TestCoverage.Manager
28+
-DUnitTest.UserParam.CoverageReportClass=TestCoverage.Report.Cobertura.ReportGenerator
29+
-DUnitTest.UserParam.CoverageReportFile=/source/coverage.xml
30+
1131
steps:
1232
- name: Checkout code
13-
uses: actions/checkout@v2
33+
uses: actions/checkout@v4
34+
35+
- name: Run Container
36+
run: |
37+
# Create test_reports directory to share test results before running container
38+
mkdir $test_reports
39+
chmod 777 $test_reports
40+
# Run InterSystems IRIS instance
41+
docker pull $container_image
42+
docker run -d -h $instance --name $instance -v $GITHUB_WORKSPACE:/source -v $GITHUB_WORKSPACE/$test_reports:/$test_reports --init $container_image
43+
echo halt > wait
44+
# Wait for instance to be ready
45+
until docker exec --interactive $instance iris session $instance < wait; do sleep 1; done
46+
47+
- name: Install TestCoverage
48+
run: |
49+
echo "zpm \"install testcoverage\":1:1" > install-testcoverage
50+
docker exec --interactive $instance iris session $instance -B < install-testcoverage
51+
# Workaround for permissions issues in TestCoverage (creating directory for source export)
52+
chmod 777 $GITHUB_WORKSPACE
53+
54+
- name: Build, Test, and Export XML
55+
run: |
56+
# Run build
57+
echo "zpm \"load /source $build_flags\":1:1" > build
58+
# Test package is compiled first as a workaround for some dependency issues.
59+
echo "do \$System.OBJ.CompilePackage(\"$test_package\",\"ckd\") " > test
60+
# Run tests
61+
echo "zpm \"$package test -only $test_flags\":1:1" >> test
62+
# Pick the targets to export as XML
63+
echo 'set list("TestCoverage.*.cls") = ""' >> export
64+
echo 'set list("TestCoverage.inc") = ""' >> export
65+
echo 'do $System.OBJ.Export(.list,"TestCoverage-${{ github.ref }}.xml","/exportversion=2017.2")' >> export
66+
docker exec --interactive $instance iris session $instance -B < build && docker exec --interactive $instance iris session $instance -B < test && docker exec --interactive $instance iris session $instance -B < export
67+
1468
- name: Create Release
1569
id: create_release
16-
uses: actions/create-release@v1
70+
uses: softprops/action-gh-release@v1
1771
env:
1872
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1973
with:
74+
files: TestCoverage-${{ github.ref }}.xml
2075
tag_name: ${{ github.ref }}
21-
release_name: Release ${{ github.ref }}
76+
name: Release ${{ github.ref }}
2277
body: |
23-
Changes in this Release
78+
Automated release created by [action-gh-release](https://github.com/softprops/action-gh-release).
2479
draft: false
2580
prerelease: false

0 commit comments

Comments
 (0)