Skip to content

Commit

Permalink
Merge pull request #437 from intersystems/v1-jan-2024-updates
Browse files Browse the repository at this point in the history
Fold all updates since May from master and internal repo into v1
  • Loading branch information
isc-tleavitt authored Apr 12, 2024
2 parents e809ba1 + 8cb2711 commit f2fea39
Show file tree
Hide file tree
Showing 32 changed files with 473 additions and 971 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Images List
on:
workflow_call:
outputs:
images:
description: "The full list of images to use, as a JSON array of imagename:tag"
value: ${{ jobs.images.outputs.images }}
main:
description: "The main image to use (earliest relevant version) to generate the installer XML file"
value: ${{ jobs.images.outputs.main }}

env:
name: |
irishealth-community
iris-community
jobs:
images:
runs-on: ubuntu-latest
outputs:
images: ${{ steps.set-matrix.outputs.images }}
main: ${{ steps.set-matrix.outputs.main }}
steps:
- name: Images list
id: set-matrix
run: |
images=""
for n in $name; do
tags=$(curl -su ":" https://containers.intersystems.com/v2/intersystems/${n}/tags/list | jq -r '.tags[]' | awk '!/(-linux)|([1-4]-preview)/' | awk '!/\.[1-4]\.0\./' | uniq)
for tag in $tags; do images+='"'${n}:${tag}'",'; done
done;
echo images="[${images%?}]" >> $GITHUB_OUTPUT
echo main=${images%%,*} >> $GITHUB_OUTPUT
96 changes: 48 additions & 48 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,21 @@ on:
release:
types:
- released
env:
name: |
irishealth-community
iris-community

jobs:
images:
uses: ./.github/workflows/images.yml

prepare:
runs-on: ubuntu-latest
needs: images
outputs:
images: ${{ steps.set-matrix.outputs.images }}
main: ${{ steps.set-matrix.outputs.main }}
images: ${{ needs.images.outputs.images }}
main: ${{ needs.images.outputs.main }}
version: ${{ steps.version.outputs.number }}
steps:
- uses: actions/checkout@master
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Images list
id: set-matrix
run: |
images=""
for n in $name; do
tags=$(curl -su ":" https://containers.intersystems.com/v2/intersystems/${n}/tags/list | jq -r '.tags[]' | cut -d '-' -f1 | uniq)
for tag in $tags; do images+='"'${n}:${tag}'",'; done
done;
echo images="[${images%?}]" >> $GITHUB_OUTPUT
echo main=${images%%,*} >> $GITHUB_OUTPUT
- name: Setup version
id: version
run: |
Expand All @@ -44,14 +35,15 @@ jobs:
[ $GITHUB_EVENT_NAME == 'push' ] && VERSION+=-beta && VERSION+=.$(($(git tag -l "v$VERSION.*" | sort -nt. -k4 2>/dev/null | tail -1 | cut -d. -f4)+1))
[ $GITHUB_EVENT_NAME == 'pull_request' ] && VERSION+=-dev.${{ github.event.pull_request.number }} && VERSION+=.$(($(git tag -l "v$VERSION.*" | sort -nt. -k4 2>/dev/null | tail -1 | cut -d. -f5)+1))
echo number=${VERSION} >> $GITHUB_OUTPUT
build:
timeout-minutes: 20
needs:
- prepare
strategy:
fail-fast: false
matrix:
image: ${{ fromJson(needs.prepare.outputs.images) }}
image: ${{ fromJson(github.event.inputs.IMAGE || needs.prepare.outputs.images) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
Expand Down Expand Up @@ -103,16 +95,17 @@ jobs:
-e TEST_REGISTRY=http://registry:52773/registry/ \
-e TEST_REGISTRY_USER=admin \
-e TEST_REGISTRY_PASSWORD=SYS \
-v `pwd`:/home/irisowner/zpm/ \
zpm ${{ steps.image.outputs.flags }}
CONTAINER=`docker ps -lq`
sleep 5; docker exec $CONTAINER /usr/irissys/dev/Cloud/ICM/waitISC.sh
docker cp . $CONTAINER:/home/irisowner/zpm/
echo `docker exec -i --workdir /home/irisowner/zpm/ $CONTAINER ls -rtl`
/bin/echo -e '' \
'zpm "list":1\n' \
'zpm "test zpm -v -only":1\n' \
'zpm "verify zpm -v -only":1' \
'zpm "test zpm -v -only"\n' \
'zpm "verify zpm -v -only"\n' \
'halt\n' \
| docker exec -i $CONTAINER iris session iris -U%SYS
| docker exec -i $CONTAINER iris session iris -UUSER
docker stop $CONTAINER
- name: Restart temporary registry
timeout-minutes: 15
Expand All @@ -131,9 +124,10 @@ jobs:
- name: Test and publish to temporary registry
timeout-minutes: 15
run: |
docker run --network zpm -d --rm -v `pwd`:/home/irisowner/zpm/ zpm ${{ steps.image.outputs.flags }}
docker run --network zpm -d --rm zpm ${{ steps.image.outputs.flags }}
CONTAINER=`docker ps -lq`
sleep 5; docker exec $CONTAINER /usr/irissys/dev/Cloud/ICM/waitISC.sh
docker cp . $CONTAINER:/home/irisowner/zpm/
/bin/echo -e '' \
'zpm "repo -r -name registry -url https://pm.community.intersystems.com/":1\n' \
'zpm "repo -list":1\n' \
Expand All @@ -145,31 +139,32 @@ jobs:
'zpm "publish sslclient -v":1' \
'zpm "search":1' \
'halt\n' \
| docker exec -i $CONTAINER iris session iris -U%SYS
docker stop $CONTAINER
- name: Clean install current version and test new one. (Permitted to fail on 2023.1+)
timeout-minutes: 15
run: |
curl http://localhost:52773/registry/packages/-/all | jq
curl http://localhost:52773/registry/packages/zpm/ | jq
wget https://pm.community.intersystems.com/packages/zpm/latest/installer -O /tmp/zpm.xml
docker run --network zpm --rm -d -v /tmp/zpm.xml:/home/irisowner/zpm.xml ${{ steps.image.outputs.name }} ${{ steps.image.outputs.flags }}
CONTAINER=`docker ps -lq`
sleep 5; docker exec $CONTAINER /usr/irissys/dev/Cloud/ICM/waitISC.sh
/bin/echo -e '' \
'set sc = ##class(%SYSTEM.OBJ).Load("/home/irisowner/zpm.xml", "ck")\n' \
'if +sc=0 { halt:$System.Version.GetMajor()>=2023 do ##class(%SYSTEM.Process).Terminate(,1) }\n' \
'zpm "list":1\n' \
'zpm "repo -r -name registry -url ""http://registry:52773/registry/"" -username admin -password SYS":1\n' \
'zpm "repo -list"\n' \
'zpm "search":1\n' \
'zpm "install sslclient":1\n' \
'zpm "install zpm -v":1\n' \
'zpm "list":1\n' \
'zpm "version":1\n' \
'halt\n' \
| docker exec -i $CONTAINER iris session iris -U%SYS
| docker exec -i $CONTAINER iris session iris -UUSER
docker logs $CONTAINER
docker stop $CONTAINER
# - name: Clean install current version and test new one. (Permitted to fail on 2023.1+)
# timeout-minutes: 15
# run: |
# curl http://localhost:52773/registry/packages/-/all | jq
# curl http://localhost:52773/registry/packages/zpm/ | jq
# wget https://pm.community.intersystems.com/packages/zpm/latest/installer -O /tmp/zpm.xml
# docker run --network zpm --rm -d -v /tmp/zpm.xml:/home/irisowner/zpm.xml ${{ steps.image.outputs.name }} ${{ steps.image.outputs.flags }}
# CONTAINER=`docker ps -lq`
# sleep 5; docker exec $CONTAINER /usr/irissys/dev/Cloud/ICM/waitISC.sh
# /bin/echo -e '' \
# 'set sc = ##class(%SYSTEM.OBJ).Load("/home/irisowner/zpm.xml", "ck")\n' \
# 'if +sc=0 { halt:$System.Version.GetMajor()>=2023 do ##class(%SYSTEM.Process).Terminate(,1) }\n' \
# 'zpm "list":1\n' \
# 'zpm "repo -r -name registry -url ""http://registry:52773/registry/"" -username admin -password SYS":1\n' \
# 'zpm "repo -list"\n' \
# 'zpm "search":1\n' \
# 'zpm "install sslclient":1\n' \
# 'zpm "install zpm -v":1\n' \
# 'zpm "list":1\n' \
# 'zpm "version":1\n' \
# 'halt\n' \
# | docker exec -i $CONTAINER iris session iris -UUSER
# docker stop $CONTAINER
- name: Clean install and test
timeout-minutes: 15
run: |
Expand All @@ -186,20 +181,25 @@ jobs:
'zpm "list":1\n' \
'halt\n' \
| docker exec -i $CONTAINER iris session iris -U%SYS
docker logs $CONTAINER
docker stop $CONTAINER
- name: Prepare XML Installer
timeout-minutes: 15
run: |
wget http://localhost:52773/registry/packages/zpm/latest/installer -O zpm-${{ needs.prepare.outputs.version }}.xml
- name: Stop temporary registry
if: always()
run: |
CONTAINER=`docker ps -lq`
docker stop $CONTAINER
docker stop registry
docker network rm zpm
- uses: actions/upload-artifact@v3
if: matrix.image == ${{ needs.prepare.outputs.main }}
with:
name: zpm-${{ needs.prepare.outputs.version }}
path: zpm-${{ needs.prepare.outputs.version }}.xml

release:
runs-on: ubuntu-latest
if: github.event.repository.fork == false
Expand Down Expand Up @@ -241,7 +241,7 @@ jobs:
run: |
sed -i -E "s/<Version>(.*)<\/Version>/<Version>${VERSION}<\/Version>/" module.xml
cat module.xml
docker run -d --rm -v `pwd`:/home/irisowner/zpm/ containers.intersystems.com/intersystems/${{ needs.prepare.outputs.main }} --check-caps false
docker run -d --rm -v $(pwd):/home/irisowner/zpm/ containers.intersystems.com/intersystems/${{ needs.prepare.outputs.main }} --check-caps false
CONTAINER=`docker ps -lq`
sleep 5; docker exec $CONTAINER /usr/irissys/dev/Cloud/ICM/waitISC.sh
/bin/echo -e '' \
Expand All @@ -250,7 +250,7 @@ jobs:
'zpm "repo -r -name registry -url ""https://pm.community.intersystems.com/"" -username ${{ secrets.REGISTRY_USERNAME }} -password ${{ secrets.REGISTRY_PASSWORD }}":1\n' \
'zpm "publish zpm -v":1' \
'halt\n' \
| docker exec -i $CONTAINER iris session iris -U%SYS
| docker exec -i $CONTAINER iris session iris -UUSER
docker stop $CONTAINER
- name: Upload Public Release Asset
uses: actions/upload-release-asset@v1
Expand Down
113 changes: 102 additions & 11 deletions .github/workflows/packages.yml
Original file line number Diff line number Diff line change
@@ -1,19 +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 | 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
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:
matrix: ${{fromJson(needs.job1.outputs.matrix)}}
fail-fast: false
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
8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"intersystems.language-server",
"intersystems-community.testingmanager",
"intersystems-community.vscode-objectscript",
"ms-azuretools.vscode-docker"
]
}
6 changes: 3 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"host": "localhost",
"username": "_system",
"password": "SYS",
"ns": "%SYS"
}

"ns": "USER"
},
"intersystems.testingManager.client.relativeTestRoot": "tests/unit_tests"
}
Loading

0 comments on commit f2fea39

Please sign in to comment.