refactor(ci): skip building and testing in release ci #6
Workflow file for this run
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
name: Export XML and Release on Tag Push | |
on: | |
push: | |
tags: | |
- '*' | |
jobs: | |
build: | |
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: Get latest tag | |
id: tag | |
uses: actions-ecosystem/action-get-latest-tag@v1 | |
- 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-${{ steps.tag.outputs.tag }}.xml","/exportversion=2017.2")' >> export | |
docker exec --interactive $instance iris session $instance -B < export | |
ls -lR | |
- name: Create Release | |
id: create_release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
files: TestCoverage-${{ steps.tag.outputs.tag }}.xml | |
tag_name: ${{ github.ref }} | |
name: ${{ steps.tag.outputs.tag }} | |
body: | | |
Automated release created by [action-gh-release](https://github.com/softprops/action-gh-release). | |
draft: false | |
prerelease: false |