Skip to content

Commit

Permalink
ci: add github data folder
Browse files Browse the repository at this point in the history
ci: add load-json reusable workflow
refactor: rename gradle, docker workflows
ci: add artifact upload for docker workflow
ci: make ebsi reusable workflow
ci: update docker login action version
  • Loading branch information
mikeplotean committed Feb 9, 2025
1 parent 35fabb9 commit 927c423
Show file tree
Hide file tree
Showing 12 changed files with 204 additions and 106 deletions.
69 changes: 0 additions & 69 deletions .github/workflows/build-docker.yml

This file was deleted.

25 changes: 21 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branches-ignore:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
version:
uses: walt-id/waltid-identity/.github/workflows/version.yml@266f5c09359450c39019a6da38f2b331e7122918
Expand All @@ -13,8 +17,21 @@ jobs:
needs: version
with:
version: ${{ needs.version.outputs.release_version }}
docker-build:
uses: walt-id/waltid-identity/.github/workflows/build-docker.yml@266f5c09359450c39019a6da38f2b331e7122918
needs: version
docker-matrix:
uses: walt-id/waltid-identity/.github/workflows/load-json.yml@feat/docker-build-share
with:
jsonpath: ".github/workflows/data/docker-matrix.json"
docker:
uses: walt-id/waltid-identity/.github/workflows/docker.yml@feat/docker-build-share
needs: [ version, docker-matrix ]
with:
images: ${{ needs.docker-matrix.outputs.json }}
version: ${{ needs.version.outputs.release_version }}
artifact: true
ebsi-ct-v3:
uses: walt-id/waltid-identity/.github/workflows/ebsictv3.yml@feat/docker-build-share
needs: [ version, docker ]
secrets: inherit
with:
version: ${{ needs.version.outputs.release_version }}
artifact: issuer-api
tag: "waltid/issuer-api:${{ needs.version.outputs.release_version }}"
26 changes: 26 additions & 0 deletions .github/workflows/data/docker-matrix.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[
{
"folder": "waltid-services/waltid-issuer-api",
"image": "issuer-api"
},
{
"folder": "waltid-services/waltid-verifier-api",
"image": "verifier-api"
},
{
"folder": "waltid-services/waltid-wallet-api",
"image": "wallet-api"
},
{
"folder": "waltid-applications/waltid-web-wallet/apps/waltid-demo-wallet",
"image": "waltid-demo-wallet"
},
{
"folder": "waltid-applications/waltid-web-wallet/apps/waltid-dev-wallet",
"image": "waltid-dev-wallet"
},
{
"folder": "waltid-applications/waltid-web-portal",
"image": "portal"
}
]
1 change: 0 additions & 1 deletion .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ on:

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
env:
IMAGE_TAG: ${{ inputs.version }}
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build and/or push docker (reusable workflow)

on:
workflow_call:
inputs:
images:
description: "The json array specifying image data (built with prepare-docker workflow)"
required: true
type: string
version:
description: "release version"
required: true
type: string
tag:
description: "desired tag, e.g. latest, dev (defaults to dev)"
required: false
type: string
default: "dev"
publish:
description: "Specifies whether to publish the images (defaults to false)"
required: false
type: boolean
default: false
artifact:
description: "Upload docker artifact (defaults to false)"
required: false
type: boolean
default: false

jobs:
docker:
runs-on: ubuntu-latest
strategy:
matrix:
include: ${{ fromJSON(inputs.images) }}
steps:
- run: |
echo "${{ matrix.image }}::: ${{ inputs.tag }} / ${{ inputs.version }}"
- uses: actions/checkout@v4
- name: Login to Docker Hub
if: ${{ inputs.publish }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up Docker Buildx
if: ${{ !inputs.publish }}
uses: docker/setup-buildx-action@v3
- name: Build and push Docker images (${{ matrix.image }})
uses: docker/build-push-action@v6
with:
push: ${{ inputs.publish }}
file: ${{ matrix.folder }}/Dockerfile
tags: waltid/${{ matrix.image }}:${{ inputs.tag }}, waltid/${{ matrix.image }}:${{ inputs.version }}
outputs: type=docker,dest=${{ runner.temp }}/${{ matrix.image }}.tar
- name: Upload artifact
if: ${{ inputs.artifact }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.image }}
path: ${{ runner.temp }}/${{ matrix.image }}.tar
retention-days: 1
48 changes: 37 additions & 11 deletions .github/workflows/ebsictv3.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
name: EBSI Conformance Test v3.2

on:
push:
paths:
- 'waltid-libraries/credentials/**'
- 'waltid-libraries/crypto/**'
- 'waltid-libraries/protocols/**'
- 'waltid-libraries/waltid-did/**'
- 'waltid-services/services/waltid-issuer-api/**'
- '.github/workflows/**'
workflow_call:
inputs:
artifact:
description: "Load image from this artifact (defaults to empty)"
required: false
type: string
path:
description: "Specifies the artifact path (defaults to empty)"
required: false
type: string
tag:
description: "Use this docker image tag (defaults to empty)"
required: false
type: string

jobs:
EBSI-Conformance-Test-v3:
name: Run
runs-on: ubuntu-latest
env:
use-artifact: ${{ inputs.artifact != '' && inputs.tag != '' }}
steps:
- name: The EBSI Conformance Test v3.2 job is starting
run: |
Expand All @@ -32,6 +41,18 @@ jobs:
- name: Docker
run: docker --version

- name: Download artifact
if: ${{ env.use-artifact }}
uses: actions/download-artifact@v4
with:
name: ${{ inputs.artifact }}
path: ${{ runner.temp }}

- name: Load Docker image from tarball
if: ${{ env.use-artifact }}
run: |
docker load --input ${{ runner.temp }}/${{ inputs.artifact }}.tar
- name: Check out repository code
uses: actions/checkout@v4

Expand All @@ -53,9 +74,14 @@ jobs:
sed -i 's|readonly ISSUER_URL=".*"|readonly ISSUER_URL="'"${NGROK_URL}"'"|g' .github/workflows/ebsictv3/EBSICTV3-IssueToHolder.sh
sed -i 's|baseUrl = ".*"|baseUrl = "'"${NGROK_URL}"'"|g' waltid-services/waltid-issuer-api/config/issuer-service.conf
docker build -t waltid/issuer-api:latest -f waltid-services/waltid-issuer-api/Dockerfile .
docker run --net=host -d -v $PWD/waltid-services/waltid-issuer-api/config:/waltid-issuer-api/config --name waltid-issuer-api waltid/issuer-api:latest
image="${{ inputs.tag }}"
if [[ "${{ env.use-artifact }}" != "true" ]]; then
image="waltid/issuer-api:latest"
docker build -t $image -f waltid-services/waltid-issuer-api/Dockerfile .
fi
docker run --net=host -d -v $PWD/waltid-services/waltid-issuer-api/config:/waltid-issuer-api/config --name waltid-issuer-api $image
curl --retry 5 --retry-delay 5 --retry-connrefused http://localhost:7002/livez
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ on:
default: false

jobs:
build:
name: Build
gradle:
runs-on: ubuntu-latest
steps:
- name: Free Disk Space (Ubuntu)
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/load-json.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Load json

on:
workflow_call:
inputs:
jsonpath:
description: "the json file path containing the matrix"
required: true
type: string
outputs:
json:
description: "The json data"
value: ${{ jobs.load-json.outputs.result }}

jobs:
load-json:
runs-on: ubuntu-latest
outputs:
result: ${{ steps.load-json.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- id: load-json
run: |
echo "matrix=$(jq -c . < ${{ inputs.jsonpath }})" >> $GITHUB_OUTPUT
17 changes: 11 additions & 6 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,28 @@ jobs:
uses: walt-id/waltid-identity/.github/workflows/version.yml@266f5c09359450c39019a6da38f2b331e7122918
with:
suffix: -SNAPSHOT
gradle-build:
uses: walt-id/waltid-identity/.github/workflows/build-gradle.yml@266f5c09359450c39019a6da38f2b331e7122918
gradle:
uses: walt-id/waltid-identity/.github/workflows/gradle.yml@feat/docker-build-share
secrets: inherit
needs: version
with:
version: ${{ needs.version.outputs.release_version }}
publish: true
docker-build:
uses: walt-id/waltid-identity/.github/workflows/build-docker.yml@266f5c09359450c39019a6da38f2b331e7122918
docker-matrix:
uses: walt-id/waltid-identity/.github/workflows/load-json.yml@feat/docker-build-share
with:
jsonpath: ".github/workflows/data/docker-matrix.json"
docker:
uses: walt-id/waltid-identity/.github/workflows/docker.yml@feat/docker-build-share
secrets: inherit
needs: version
needs: [ version, docker-matrix ]
with:
images: ${{ needs.docker-matrix.outputs.json }}
version: ${{ needs.version.outputs.release_version }}
publish: true
tag:
uses: walt-id/waltid-identity/.github/workflows/tag.yml@266f5c09359450c39019a6da38f2b331e7122918
needs: [ version, gradle-build, docker-build ]
needs: [ version, gradle, docker ]
with:
version: ${{ needs.version.outputs.release_version }}
pre-release:
Expand Down
17 changes: 11 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,30 @@ jobs:
uses: walt-id/waltid-identity/.github/workflows/version.yml@266f5c09359450c39019a6da38f2b331e7122918
with:
preferred: ${{ inputs.release_version }}
gradle-build:
uses: walt-id/waltid-identity/.github/workflows/build-gradle.yml@266f5c09359450c39019a6da38f2b331e7122918
gradle:
uses: walt-id/waltid-identity/.github/workflows/gradle.yml@feat/docker-build-share
secrets: inherit
needs: version
with:
version: ${{ needs.version.outputs.release_version }}
publish: true
docker-build:
uses: walt-id/waltid-identity/.github/workflows/build-docker.yml@266f5c09359450c39019a6da38f2b331e7122918
docker-matrix:
uses: walt-id/waltid-identity/.github/workflows/load-json.yml@feat/docker-build-share
with:
jsonpath: ".github/workflows/data/docker-matrix.json"
docker:
uses: walt-id/waltid-identity/.github/workflows/docker.yml@feat/docker-build-share
secrets: inherit
needs: version
needs: [ version, docker-matrix ]
with:
images: ${{ needs.docker-matrix.outputs.json }}
version: ${{ needs.version.outputs.release_version }}
tag: latest
publish: true
deploy:
uses: walt-id/waltid-identity/.github/workflows/deployment.yml@dd9e94a2b08b2f9917d56543061963e6757def1f
secrets: inherit
needs: [ version, gradle-build, docker-build ]
needs: [ version, gradle, docker ]
with:
version: ${{ needs.version.outputs.release_version }}
deployment: prod
Expand Down
Loading

0 comments on commit 927c423

Please sign in to comment.