From 3f899c501b514f8ef5d4b278d962118c3aa32b33 Mon Sep 17 00:00:00 2001 From: Shuheng Liu Date: Tue, 30 Jan 2024 11:42:08 -0500 Subject: [PATCH 01/11] ci: add ci to test popular packages --- .github/workflows/packages.yml | 69 +++++++++++++++++++++++++++++----- 1 file changed, 59 insertions(+), 10 deletions(-) diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index da98aff5..97e92890 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -1,19 +1,68 @@ -name: Test all packages +name: Test major packages on: workflow_dispatch + 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 >= 65 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 | jq '.[].name' | jq -s` - echo "::set-output name=matrix::$matrix" - job2: - needs: job1 + - id: set-matrix + run: | + matrix=$(curl -L "$PM_URL" | jq -cr "$JQ_SCRIPT") + echo "matrix=$matrix" >> $GITHUB_OUTPUT + + run-builds: + timeout-minutes: 20 runs-on: ubuntu-latest + needs: matrix-setup strategy: - matrix: ${{fromJson(needs.job1.outputs.matrix)}} + fail-fast: false + matrix: + package: ${{ fromJson(needs.matrix-setup.outputs.matrix) }} + env: + IMAGE: containers.intersystems.com/intersystems/iris-community:latest-em steps: - - run: echo test \ No newline at end of file + - uses: actions/checkout@master + - name: Build + uses: docker/build-push-action@v4 + with: + context: . + push: false + load: true + tags: zpm + build-args: Base=${{ env.IMAGE }} + - 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 -U%SYS << EOF + zpm "list":1 + zpm "test zpm -v -only":1 + 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 -U%SYS << EOF + zpm "install ${{ matrix.package }}":1 + zpm "${{ matrix.package }} test -only ${{ env.test-flags }}":1:1 + EOF || echo -e "'\nExit code: $?' + - name: Stop Container + run: | + # To ensure a clean state after using `act` locally + docker stop -t 5 ${{ steps.setup-zpm.outputs.CONTAINER }} + docker ps From 4b8c676b3543f6e9b0cde38977702a9276bc3806 Mon Sep 17 00:00:00 2001 From: Shuheng Liu Date: Wed, 31 Jan 2024 08:45:54 -0500 Subject: [PATCH 02/11] ci: share container among jobs --- .github/workflows/packages.yml | 41 +++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 97e92890..7a7148fd 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -15,26 +15,51 @@ jobs: matrix=$(curl -L "$PM_URL" | jq -cr "$JQ_SCRIPT") echo "matrix=$matrix" >> $GITHUB_OUTPUT - run-builds: + prepare-image: timeout-minutes: 20 runs-on: ubuntu-latest - needs: matrix-setup - strategy: - fail-fast: false - matrix: - package: ${{ fromJson(needs.matrix-setup.outputs.matrix) }} env: IMAGE: containers.intersystems.com/intersystems/iris-community:latest-em steps: - uses: actions/checkout@master - - name: Build + - 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 + tags: zpm:latest build-args: Base=${{ env.IMAGE }} + outputs: type=docker,dest=/tmp/zpmimage.tar + - 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.matrix-setup.outputs.matrix) }} + steps: + - 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 From f0cef1c78a972f455627662718f455f4ff6b05c9 Mon Sep 17 00:00:00 2001 From: Shuheng Liu Date: Wed, 31 Jan 2024 11:14:07 -0500 Subject: [PATCH 03/11] ci: checkout source code in each job --- .github/workflows/packages.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 7a7148fd..e43c8127 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -49,9 +49,10 @@ jobs: matrix: package: ${{ fromJson(needs.matrix-setup.outputs.matrix) }} steps: + - uses: actions/checkout@master - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - - name: Download artifact + - name: Download Artifact uses: actions/download-artifact@v2 with: name: zpmimage From f2c2e7190dbd89d6d531aa549a4b70f19d3cc6ab Mon Sep 17 00:00:00 2001 From: Shuheng Liu Date: Wed, 31 Jan 2024 12:01:38 -0500 Subject: [PATCH 04/11] fix bug in ci workflow --- .github/workflows/packages.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 43dfa49c..de9322dd 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -86,9 +86,9 @@ jobs: docker exec -i ${{ env.CONTAINER }} iris session IRIS -U%SYS << EOF zpm "install ${{ matrix.package }}":1 zpm "${{ matrix.package }} test -only ${{ env.test-flags }}":1:1 - EOF || echo -e "'\nExit code: $?' + 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 \ No newline at end of file + docker ps From 60e154d321caf06a3f742ea0b2672ac2ee6506c6 Mon Sep 17 00:00:00 2001 From: Shuheng Liu Date: Wed, 31 Jan 2024 12:58:30 -0500 Subject: [PATCH 05/11] ci: parameterize minVersionCount for packages.yml --- .github/workflows/packages.yml | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index e43c8127..b369a19a 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -1,12 +1,19 @@ name: Test major packages -on: workflow_dispatch +on: + workflow_dispatch: + inputs: + minVersionCount: + description: "Minimum number of versions a package must have to be tested" + required: true + type: number + default: 10 jobs: 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 >= 65 then . + [$item.name] else . end) + JQ_SCRIPT: reduce .[] as $item ([]; if $item.allVersions | length >= ${{ inputs.minVersionCount }} then . + [$item.name] else . end) outputs: matrix: ${{ steps.set-matrix.outputs.matrix }} steps: @@ -33,6 +40,14 @@ jobs: tags: zpm:latest build-args: Base=${{ env.IMAGE }} outputs: type=docker,dest=/tmp/zpmimage.tar + - name: Test Image + run: | + 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 -U%SYS << EOF + zpm "list":1 + zpm "test zpm -v -only":1:1 + EOF - name: Upload Image uses: actions/upload-artifact@v2 with: @@ -70,8 +85,6 @@ jobs: echo "CONTAINER=$CONTAINER" >> $GITHUB_OUTPUT docker exec $CONTAINER /usr/irissys/dev/Cloud/ICM/waitISC.sh docker exec -i $CONTAINER iris session IRIS -U%SYS << EOF - zpm "list":1 - zpm "test zpm -v -only":1 zpm "repo -r -name registry -url https://pm.community.intersystems.com/":1 halt EOF @@ -86,7 +99,7 @@ jobs: docker exec -i ${{ env.CONTAINER }} iris session IRIS -U%SYS << EOF zpm "install ${{ matrix.package }}":1 zpm "${{ matrix.package }} test -only ${{ env.test-flags }}":1:1 - EOF || echo -e "'\nExit code: $?' + EOF - name: Stop Container run: | # To ensure a clean state after using `act` locally From 926cd19946bea36a0960e78f0e437bc0fdaf504f Mon Sep 17 00:00:00 2001 From: Shuheng Liu Date: Wed, 31 Jan 2024 13:10:58 -0500 Subject: [PATCH 06/11] ci: bug fix --- .github/workflows/packages.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index b369a19a..2ce44243 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -42,6 +42,8 @@ jobs: 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 -U%SYS << EOF From 34d6ce48b81532eaa9ae59d6132ccf4a0b4f4191 Mon Sep 17 00:00:00 2001 From: Shuheng Liu Date: Thu, 1 Feb 2024 08:51:50 -0500 Subject: [PATCH 07/11] run ci in USER instead of %SYS --- .github/workflows/packages.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 2ce44243..3a55f04f 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -46,7 +46,7 @@ jobs: 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 -U%SYS << EOF + docker exec -i $CONTAINER iris session IRIS << EOF zpm "list":1 zpm "test zpm -v -only":1:1 EOF @@ -86,7 +86,7 @@ jobs: 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 -U%SYS << EOF + docker exec -i $CONTAINER iris session IRIS << EOF zpm "repo -r -name registry -url https://pm.community.intersystems.com/":1 halt EOF @@ -98,7 +98,7 @@ jobs: -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 -U%SYS << EOF + 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 From e8db00efac679ef332c60a3b3431071924f7bab8 Mon Sep 17 00:00:00 2001 From: Shuheng Liu Date: Thu, 1 Feb 2024 09:16:22 -0500 Subject: [PATCH 08/11] run zpm test in %SYS --- .github/workflows/packages.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 3a55f04f..313b026e 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -48,6 +48,7 @@ jobs: 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 From fe2475f5609208eb79910116f78b513124ab3126 Mon Sep 17 00:00:00 2001 From: Shuheng Liu Date: Thu, 1 Feb 2024 11:06:15 -0500 Subject: [PATCH 09/11] ci: fix type in %UnitTest.Manager name --- .github/workflows/packages.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 2ce44243..ac078bef 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -95,8 +95,8 @@ jobs: 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 + -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 -U%SYS << EOF zpm "install ${{ matrix.package }}":1 From 82e2f870311ee73c0251edaf51b4e2e3b1515085 Mon Sep 17 00:00:00 2001 From: Shuheng Liu Date: Thu, 1 Feb 2024 12:04:16 -0500 Subject: [PATCH 10/11] typo fix --- .github/workflows/packages.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/packages.yml b/.github/workflows/packages.yml index 313b026e..e3d67afc 100644 --- a/.github/workflows/packages.yml +++ b/.github/workflows/packages.yml @@ -96,8 +96,8 @@ jobs: 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 + -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 From d53fc9ad89d1d57f903c0427fd3ba61eb2289aa4 Mon Sep 17 00:00:00 2001 From: Shuheng Liu Date: Thu, 1 Feb 2024 13:28:13 -0500 Subject: [PATCH 11/11] typo fix --- .github/workflows/images.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/images.yml b/.github/workflows/images.yml index ffe8a4e8..37ddc3a2 100644 --- a/.github/workflows/images.yml +++ b/.github/workflows/images.yml @@ -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 }}