| 1 | name: CI |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: [ main ] |
| 6 | release: |
| 7 | types: [ published ] |
| 8 | pull_request: |
| 9 | |
| 10 | env: |
| 11 | REGISTRY: ghcr.io |
| 12 | IMAGE_NAME_BASE: ${{ github.repository_owner }} |
| 13 | |
| 14 | jobs: |
| 15 | backend: |
| 16 | name: Backend |
| 17 | runs-on: ubuntu-latest |
| 18 | timeout-minutes: 15 |
| 19 | permissions: |
| 20 | contents: read |
| 21 | packages: write |
| 22 | services: |
| 23 | postgres: |
| 24 | image: postgres:15 |
| 25 | env: |
| 26 | POSTGRES_USER: portal |
| 27 | POSTGRES_PASSWORD: portal |
| 28 | POSTGRES_DB: portal |
| 29 | ports: |
| 30 | - 5432:5432 |
| 31 | options: >- |
| 32 | --health-cmd pg_isready |
| 33 | --health-interval 10s |
| 34 | --health-timeout 5s |
| 35 | --health-retries 5 |
| 36 | env: |
| 37 | # For Docker Image |
| 38 | IMAGE_NAME: authority-portal-backend |
| 39 | IMAGE_TITLE: Authority Portal Backend |
| 40 | IMAGE_DESCRIPTION: Backend for the sovity Dataspace Authority Portal |
| 41 | |
| 42 | # For JooQ Codegen |
| 43 | SKIP_TESTCONTAINERS: true |
| 44 | TEST_POSTGRES_JDBC_URL: jdbc:postgresql://localhost:5432/portal |
| 45 | TEST_POSTGRES_JDBC_USER: portal |
| 46 | TEST_POSTGRES_JDBC_PASSWORD: portal |
| 47 | |
| 48 | # For Quarkus Tests |
| 49 | quarkus.datasource.devservices.enabled: false |
| 50 | quarkus.datasource.jdbc.url: jdbc:postgresql://localhost:5432/portal |
| 51 | quarkus.datasource.username: portal |
| 52 | quarkus.datasource.password: portal |
| 53 | quarkus.flyway.clean-at-start: true |
| 54 | steps: |
| 55 | - uses: actions/checkout@v3 |
| 56 | - name: "Set up JDK 17" |
| 57 | uses: actions/setup-java@v3 |
| 58 | with: |
| 59 | java-version: '17' |
| 60 | distribution: 'temurin' |
| 61 | - name: "Gradle: Validate Gradle Wrapper" |
| 62 | uses: gradle/actions/wrapper-validation@v3 |
| 63 | - name: "Gradle: Build" |
| 64 | uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 |
| 65 | env: |
| 66 | GPR_USER: ${{ secrets.GHCR_READONLY_USER }} |
| 67 | GPR_KEY: ${{ secrets.GHCR_READONLY_TOKEN }} |
| 68 | with: |
| 69 | build-root-directory: authority-portal-backend |
| 70 | arguments: build |
| 71 | - name: "Docker: Log in to the Container registry" |
| 72 | uses: docker/login-action@v2 |
| 73 | with: |
| 74 | registry: ${{ env.REGISTRY }} |
| 75 | username: ${{ github.actor }} |
| 76 | password: ${{ secrets.GITHUB_TOKEN }} |
| 77 | - name: "Docker: Extract metadata (tags, labels) for Docker" |
| 78 | id: meta |
| 79 | uses: docker/metadata-action@v4 |
| 80 | with: |
| 81 | images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_BASE }}/${{ env.IMAGE_NAME }} |
| 82 | labels: | |
| 83 | org.opencontainers.image.title=${{ env.IMAGE_TITLE }} |
| 84 | org.opencontainers.image.description=${{ env.IMAGE_DESCRIPTION }} |
| 85 | tags: | |
| 86 | type=schedule |
| 87 | type=semver,pattern={{version}} |
| 88 | type=semver,pattern={{major}}.{{minor}} |
| 89 | type=semver,pattern={{major}} |
| 90 | type=ref,event=branch |
| 91 | type=ref,event=pr |
| 92 | type=sha |
| 93 | type=raw,value=latest,enable={{is_default_branch}} |
| 94 | type=raw,value=release,enable=${{ startsWith(github.ref, 'refs/tags/') }} |
| 95 | - name: "Docker: Build and Push Image (authority-portal-backend)" |
| 96 | uses: docker/build-push-action@v4 |
| 97 | with: |
| 98 | file: authority-portal-backend/authority-portal-quarkus/src/main/docker/Dockerfile.jvm |
| 99 | context: authority-portal-backend/authority-portal-quarkus |
| 100 | push: true |
| 101 | tags: ${{ steps.meta.outputs.tags }} |
| 102 | labels: ${{ steps.meta.outputs.labels }} |
| 103 | network: host |
| 104 | - name: "Docker: Build and Push Image (authority-portal-crawler)" |
| 105 | uses: ./.github/actions/build-connector-image |
| 106 | with: |
| 107 | registry-url: ${{ env.REGISTRY }} |
| 108 | registry-user: ${{ github.actor }} |
| 109 | registry-password: ${{ secrets.GITHUB_TOKEN }} |
| 110 | image-base-name: ${{ env.IMAGE_NAME_BASE }} |
| 111 | image-name: "authority-portal-crawler" |
| 112 | connector-name: "catalog-crawler-ce" |
| 113 | title: "Catalog Crawler (Community Edition, DAPS)" |
| 114 | description: "sovity CE Catalog crawler for the sovity CE Authority Portal. Requires DAPS dataspace credentials to join an existing dataspace." |
| 115 | |
| 116 | frontend: |
| 117 | name: Frontend |
| 118 | runs-on: ubuntu-latest |
| 119 | timeout-minutes: 15 |
| 120 | permissions: |
| 121 | contents: read |
| 122 | packages: write |
| 123 | env: |
| 124 | # For Docker Image |
| 125 | IMAGE_NAME: authority-portal-frontend |
| 126 | IMAGE_TITLE: Authority Portal Frontend |
| 127 | IMAGE_DESCRIPTION: Frontend for the sovity Dataspace Authority Portal |
| 128 | steps: |
| 129 | - uses: actions/checkout@v3 |
| 130 | - name: "Set up JDK 17" |
| 131 | uses: actions/setup-java@v3 |
| 132 | with: |
| 133 | java-version: '17' |
| 134 | distribution: 'temurin' |
| 135 | - name: "Gradle: Validate Gradle Wrapper" |
| 136 | uses: gradle/actions/wrapper-validation@v3 |
| 137 | - name: "Gradle: Generate TypeScript Library Code" |
| 138 | uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 |
| 139 | env: |
| 140 | GPR_USER: ${{ secrets.GHCR_READONLY_USER }} |
| 141 | GPR_KEY: ${{ secrets.GHCR_READONLY_TOKEN }} |
| 142 | with: |
| 143 | build-root-directory: authority-portal-backend |
| 144 | arguments: :authority-portal-api:build |
| 145 | - name: "Set up Node 16" |
| 146 | uses: actions/setup-node@v3 |
| 147 | with: |
| 148 | node-version: '16' |
| 149 | cache: 'npm' |
| 150 | cache-dependency-path: | |
| 151 | authority-portal-backend/authority-portal-api-client-ts/package-lock.json |
| 152 | authority-portal-frontend/package-lock.json |
| 153 | - name: "Set up Chrome" |
| 154 | uses: browser-actions/setup-chrome@v1 |
| 155 | - name: "NPM: Build TypeScript Client Library" |
| 156 | run: cd authority-portal-backend/authority-portal-api-client-ts && npm ci && npm run build |
| 157 | - name: "NPM: Install Dependencies" |
| 158 | run: cd authority-portal-frontend && npm ci |
| 159 | - name: "NPM: Test Frontend" |
| 160 | run: cd authority-portal-frontend && npm run test-ci |
| 161 | - name: "NPM: Build Frontend" |
| 162 | run: cd authority-portal-frontend && npm run build |
| 163 | - name: "Docker: Log in to the Container registry" |
| 164 | uses: docker/login-action@v2 |
| 165 | with: |
| 166 | registry: ${{ env.REGISTRY }} |
| 167 | username: ${{ github.actor }} |
| 168 | password: ${{ secrets.GITHUB_TOKEN }} |
| 169 | - name: "Docker: Extract metadata (tags, labels) for Docker" |
| 170 | id: meta |
| 171 | uses: docker/metadata-action@v4 |
| 172 | with: |
| 173 | images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_BASE }}/${{ env.IMAGE_NAME }} |
| 174 | labels: | |
| 175 | org.opencontainers.image.title=${{ env.IMAGE_TITLE }} |
| 176 | org.opencontainers.image.description=${{ env.IMAGE_DESCRIPTION }} |
| 177 | tags: | |
| 178 | type=schedule |
| 179 | type=semver,pattern={{version}} |
| 180 | type=semver,pattern={{major}}.{{minor}} |
| 181 | type=semver,pattern={{major}} |
| 182 | type=ref,event=branch |
| 183 | type=ref,event=pr |
| 184 | type=sha |
| 185 | type=raw,value=latest,enable={{is_default_branch}} |
| 186 | type=raw,value=release,enable=${{ startsWith(github.ref, 'refs/tags/') }} |
| 187 | - name: "Docker: Build and Push Image" |
| 188 | uses: docker/build-push-action@v4 |
| 189 | with: |
| 190 | file: authority-portal-frontend/docker/Dockerfile |
| 191 | context: authority-portal-frontend |
| 192 | push: true |
| 193 | tags: ${{ steps.meta.outputs.tags }} |
| 194 | labels: ${{ steps.meta.outputs.labels }} |
| 195 | network: host |
| 196 | markdown-link-checks: |
| 197 | name: Markdown Link Checks |
| 198 | runs-on: ubuntu-latest |
| 199 | steps: |
| 200 | - uses: FranzDiebold/github-env-vars-action@v2 |
| 201 | - uses: actions/checkout@master |
| 202 | - name: "Markdown Link Checker: Generate Config" |
| 203 | run: .github/markdown-link-checker-config.jq > .github/markdown-link-checker-config.json |
| 204 | - name: "Markdown Link Checker: Validate Links" |
| 205 | uses: gaurav-nelson/github-action-markdown-link-check@v1 |
| 206 | with: |
| 207 | use-quiet-mode: 'yes' |
| 208 | config-file: '.github/markdown-link-checker-config.json' |