1
+ # Continuous integration workflow
2
+ name : CI
3
+
4
+ # Controls when the action will run. Triggers the workflow on push or pull request
5
+ # events in all branches
6
+ on : [push, pull_request]
7
+
8
+ # A workflow run is made up of one or more jobs that can run sequentially or in parallel
9
+ jobs :
10
+ # This workflow contains a single job called "build"
11
+ build :
12
+ # The type of runner that the job will run on
13
+ runs-on : ubuntu-latest
14
+
15
+ env :
16
+ # ** FOR GENERAL USE, LIKELY NEED TO CHANGE: **
17
+ package : TestCoverage
18
+ container_image : intersystemsdc/iris-community:2019.4.0.383.0-zpm
19
+
20
+ # ** FOR GENERAL USE, MAY NEED TO CHANGE: **
21
+ build_flags : -dev -verbose # Load in -dev mode to get unit test code preloaded
22
+ test_package : UnitTest
23
+
24
+ # ** FOR GENERAL USE, SHOULD NOT NEED TO CHANGE: **
25
+ instance : iris
26
+ # Note: test_reports value is duplicated in test_flags environment variable
27
+ test_reports : test-reports
28
+ test_flags : >-
29
+ -verbose -DUnitTest.ManagerClass=TestCoverage.Manager -DUnitTest.JUnitOutput=/test-reports/junit.xml
30
+ -DUnitTest.FailuresAreFatal=1 -DUnitTest.Manager=TestCoverage.Manager
31
+ -DUnitTest.UserParam.CoverageReportClass=TestCoverage.Report.Cobertura.ReportGenerator
32
+ -DUnitTest.UserParam.CoverageReportFile=/source/coverage.xml
33
+
34
+ # Steps represent a sequence of tasks that will be executed as part of the job
35
+ steps :
36
+
37
+ # Checks out this repository under $GITHUB_WORKSPACE, so your job can access it
38
+ - uses : actions/checkout@v2
39
+
40
+ - name : Run Container
41
+ run : |
42
+ # Create test_reports directory to share test results before running container
43
+ mkdir $test_reports
44
+ chmod 777 $test_reports
45
+ # Run InterSystems IRIS instance
46
+ docker pull $container_image
47
+ docker run -d -h $instance --name $instance -v $GITHUB_WORKSPACE:/source -v $GITHUB_WORKSPACE/$test_reports:/$test_reports --init $container_image
48
+ echo halt > wait
49
+ # Wait for instance to be ready
50
+ until docker exec --interactive $instance iris session $instance < wait; do sleep 1; done
51
+
52
+ - name : Install TestCoverage
53
+ run : |
54
+ echo "zpm \"install testcoverage\":1:1" > install-testcoverage
55
+ docker exec --interactive $instance iris session $instance -B < install-testcoverage
56
+ # Workaround for permissions issues in TestCoverage (creating directory for source export)
57
+ chmod 777 $GITHUB_WORKSPACE
58
+
59
+ # Runs a set of commands using the runners shell
60
+ - name : Build and Test
61
+ run : |
62
+ # Run build
63
+ echo "zpm \"load /source $build_flags\":1:1" > build
64
+ # Test package is compiled first as a workaround for some dependency issues.
65
+ echo "do \$System.OBJ.CompilePackage(\"$test_package\",\"ckd\") " > test
66
+ # Run tests
67
+ echo "zpm \"$package test -only $test_flags\":1:1" >> test
68
+ docker exec --interactive $instance iris session $instance -B < build && docker exec --interactive $instance iris session $instance -B < test && bash <(curl -s https://codecov.io/bash)
69
+ # Generate and Upload HTML xUnit report
70
+ - name : XUnit Viewer
71
+ id : xunit-viewer
72
+ uses : AutoModality/action-xunit-viewer@v1
73
+ if : always()
74
+ with :
75
+ # With -DUnitTest.FailuresAreFatal=1 a failed unit test will fail the build before this point.
76
+ # This action would otherwise misinterpret our xUnit style output and fail the build even if
77
+ # all tests passed.
78
+ fail : false
79
+ - name : Attach the report
80
+ uses : actions/upload-artifact@v1
81
+ if : always()
82
+ with :
83
+ name : ${{ steps.xunit-viewer.outputs.report-name }}
84
+ path : ${{ steps.xunit-viewer.outputs.report-dir }}
0 commit comments