-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #444 from isc-shuliu/v1-jan-2024-updates
Add CI to test major packages on v1-jan-2024-updates branch
- Loading branch information
Showing
2 changed files
with
102 additions
and
13 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
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 |
---|---|---|
@@ -1,21 +1,110 @@ | ||
name: Test all packages | ||
on: workflow_dispatch | ||
name: Test major packages | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
minVersionCount: | ||
description: "Minimum number of versions a package must have to be tested" | ||
required: true | ||
type: number | ||
default: 10 | ||
|
||
jobs: | ||
job1: | ||
matrix-setup: | ||
runs-on: ubuntu-latest | ||
env: | ||
PM_URL: https://pm.community.intersystems.com/packages/-/all?allVersions=1 | ||
JQ_SCRIPT: reduce .[] as $item ([]; if $item.allVersions | length >= ${{ inputs.minVersionCount }} then . + [$item.name] else . end) | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.matrix }} | ||
steps: | ||
- id: set-matrix | ||
run: | | ||
matrix=`curl https://pm.community.intersystems.com/packages/-/all?allVersions=1 | jq 'reduce .[] as $item ([]; if $item.allVersions | length >= 10 then . + [$item.name] else . end)' | tr -d '\n\t\r '` | ||
echo $matrix | ||
echo "matrix=${matrix}" >> "$GITHUB_OUTPUT" | ||
job2: | ||
needs: job1 | ||
- id: set-matrix | ||
run: | | ||
matrix=$(curl -L "$PM_URL" | jq -cr "$JQ_SCRIPT") | ||
echo "matrix=$matrix" >> $GITHUB_OUTPUT | ||
prepare-image: | ||
timeout-minutes: 20 | ||
runs-on: ubuntu-latest | ||
env: | ||
IMAGE: containers.intersystems.com/intersystems/iris-community:latest-em | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- name: Build Image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
push: false | ||
load: true | ||
tags: zpm:latest | ||
build-args: Base=${{ env.IMAGE }} | ||
outputs: type=docker,dest=/tmp/zpmimage.tar | ||
- name: Test Image | ||
run: | | ||
docker load -i /tmp/zpmimage.tar | ||
docker image ls | ||
CONTAINER=$(docker run -d --rm -v `pwd`:/home/irisowner/zpm/ zpm) | ||
docker exec $CONTAINER /usr/irissys/dev/Cloud/ICM/waitISC.sh | ||
docker exec -i $CONTAINER iris session IRIS << EOF | ||
zpm "list":1 | ||
zn "%SYS" | ||
zpm "test zpm -v -only":1:1 | ||
EOF | ||
- name: Upload Image | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: zpmimage | ||
path: /tmp/zpmimage.tar | ||
|
||
run-tests: | ||
needs: | ||
- matrix-setup | ||
- prepare-image | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
package: ${{fromJson(needs.job1.outputs.matrix)}} | ||
package: ${{ fromJson(needs.matrix-setup.outputs.matrix) }} | ||
steps: | ||
- run: echo test | ||
- uses: actions/checkout@master | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- name: Download Artifact | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: zpmimage | ||
path: /tmp | ||
- name: Load Image | ||
run: | | ||
docker load -i /tmp/zpmimage.tar | ||
docker image ls | ||
- name: Container Setup | ||
id: setup-zpm | ||
timeout-minutes: 15 | ||
run: | | ||
# Don't specify the container name because `act` will run multiple jobs in parallel and cause name conflicts | ||
CONTAINER=$(docker run -d --rm -v `pwd`:/home/irisowner/zpm/ zpm) | ||
echo "CONTAINER=$CONTAINER" >> $GITHUB_OUTPUT | ||
docker exec $CONTAINER /usr/irissys/dev/Cloud/ICM/waitISC.sh | ||
docker exec -i $CONTAINER iris session IRIS << EOF | ||
zpm "repo -r -name registry -url https://pm.community.intersystems.com/":1 | ||
halt | ||
EOF | ||
- name: Test ${{ matrix.package }} | ||
timeout-minutes: 15 | ||
env: | ||
CONTAINER: ${{ steps.setup-zpm.outputs.CONTAINER }} | ||
test-flags: >- | ||
-verbose -DUnitTest.ManagerClass=%UnitTest.Manager -DUnitTest.JUnitOutput=/test-reports/junit.xml | ||
-DUnitTest.FailuresAreFatal=1 -DUnitTest.Manager=%UnitTest.Manager | ||
run: | | ||
docker exec -i ${{ env.CONTAINER }} iris session IRIS << EOF | ||
zpm "install ${{ matrix.package }}":1 | ||
zpm "${{ matrix.package }} test -only ${{ env.test-flags }}":1:1 | ||
EOF | ||
- name: Stop Container | ||
run: | | ||
# To ensure a clean state after using `act` locally | ||
docker stop -t 5 ${{ steps.setup-zpm.outputs.CONTAINER }} | ||
docker ps |