Skip to content

Commit

Permalink
Merge pull request #444 from isc-shuliu/v1-jan-2024-updates
Browse files Browse the repository at this point in the history
Add CI to test major packages on v1-jan-2024-updates branch
  • Loading branch information
isc-tleavitt authored Mar 4, 2024
2 parents e5b48e9 + a79e69a commit 64c7516
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
images:
description: "The full list of images to use, as a JSON array of imagename:tag"
value: ${{ jobs.images.outputs.images }}
secondword:
main:
description: "The main image to use (earliest relevant version) to generate the installer XML file"
value: ${{ jobs.images.outputs.main }}

Expand Down
113 changes: 101 additions & 12 deletions .github/workflows/packages.yml
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

0 comments on commit 64c7516

Please sign in to comment.