Skip to content

Merge pull request #1495 from OSGP/dependabot/maven/spring.kafka.vers… #1905

Merge pull request #1495 from OSGP/dependabot/maven/spring.kafka.vers…

Merge pull request #1495 from OSGP/dependabot/maven/spring.kafka.vers… #1905

Workflow file for this run

# SPDX-FileCopyrightText: Contributors to the GXF project
#
# SPDX-License-Identifier: Apache-2.0
name: Build analyse and push docker container
on:
push:
branches:
- development
tags:
- '**'
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
jobs:
build:
name: Build and analyze
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
cache: maven
- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Set maven options
id: maven_options
if: contains(github.ref, 'release') || contains(github.ref, 'development') || contains(github.event.pull_request.labels.*.name, 'build_containers')
run: echo 'maven_options=-DskipTestJarWithDependenciesAssembly=false' >> $GITHUB_OUTPUT
- name: Build and analyse
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -T1C -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=gxf -Dsonar.projectKey=OSGP_open-smart-grid-platform ${{ steps.maven_options.outputs.maven_options }}
- name: Staging war and jar files
run: mkdir staging && find . -name *.war -not -path './staging/*' -exec cp -prv --parents '{}' 'staging/' ';' -o -name cucumber-*-test-jar-with-dependencies.jar -not -path './staging/*' -exec cp -prv --parents '{}' 'staging/' ';'
if: contains(github.ref, 'release') || contains(github.ref, 'development') || contains(github.event.pull_request.labels.*.name, 'build_containers')
- uses: actions/upload-artifact@v4
if: contains(github.ref, 'release') || contains(github.ref, 'development') || contains(github.event.pull_request.labels.*.name, 'build_containers')
with:
name: warFiles
path: staging
docker:
name: Building docker images
runs-on: ubuntu-latest
if: contains(github.ref, 'release') || contains(github.ref, 'development') || contains(github.event.pull_request.labels.*.name, 'build_containers')
needs: build
permissions:
contents: read
packages: write
attestations: write
id-token: write
strategy:
matrix:
include:
- image: ghcr.io/osgp/osgp-core
context: ./osgp/platform/osgp-core/
- image: ghcr.io/osgp/osgp-logging
context: ./osgp/platform/osgp-logging/
- image: ghcr.io/osgp/osgp-adapter-domain-admin
context: ./osgp/platform/osgp-adapter-domain-admin/
- image: ghcr.io/osgp/osgp-adapter-domain-core
context: ./osgp/platform/osgp-adapter-domain-core/
- image: ghcr.io/osgp/osgp-adapter-domain-publiclighting
context: ./osgp/platform/osgp-adapter-domain-publiclighting/
- image: ghcr.io/osgp/osgp-adapter-domain-smartmetering
context: ./osgp/platform/osgp-adapter-domain-smartmetering/
- image: ghcr.io/osgp/osgp-adapter-domain-tariffswitching
context: ./osgp/platform/osgp-adapter-domain-tariffswitching/
- image: ghcr.io/osgp/osgp-adapter-ws-admin
context: ./osgp/platform/osgp-adapter-ws-admin/
- image: ghcr.io/osgp/osgp-adapter-ws-core
context: ./osgp/platform/osgp-adapter-ws-core/
- image: ghcr.io/osgp/osgp-adapter-ws-publiclighting
context: ./osgp/platform/osgp-adapter-ws-publiclighting/
- image: ghcr.io/osgp/osgp-adapter-ws-smartmetering
context: ./osgp/platform/osgp-adapter-ws-smartmetering/
- image: ghcr.io/osgp/osgp-adapter-ws-tariffswitching
context: ./osgp/platform/osgp-adapter-ws-tariffswitching/
- image: ghcr.io/osgp/osgp-protocol-adapter-iec60870
context: ./osgp/protocol-adapter-iec60870/osgp-protocol-adapter-iec60870
- image: ghcr.io/osgp/osgp-protocol-simulator-iec60870
context: ./osgp/protocol-adapter-iec60870/osgp-protocol-simulator-iec60870
- image: ghcr.io/osgp/osgp-protocol-adapter-iec61850
context: ./osgp/protocol-adapter-iec61850/osgp-protocol-adapter-iec61850
- image: ghcr.io/osgp/osgp-protocol-simulator-iec61850
context: ./osgp/protocol-adapter-iec61850/osgp-protocol-simulator-iec61850
- image: ghcr.io/osgp/osgp-protocol-adapter-oslp
context: ./osgp/protocol-adapter-oslp/osgp-protocol-adapter-oslp-elster
- image: ghcr.io/osgp/osgp-signing-server
context: ./osgp/protocol-adapter-oslp/signing-server
- image: ghcr.io/osgp/osgp-web-device-simulator
context: ./osgp/protocol-adapter-oslp/web-device-simulator
- image: ghcr.io/osgp/osgp-cucumber-tests-platform-common
context: ./integration-tests/cucumber-tests-platform-common
- image: ghcr.io/osgp/osgp-cucumber-tests-platform-publiclighting
context: ./integration-tests/cucumber-tests-platform-publiclighting
- image: ghcr.io/osgp/osgp-cucumber-tests-platform-smartmetering
context: ./integration-tests/cucumber-tests-platform-smartmetering
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download war files
uses: actions/download-artifact@v4
with:
name: warFiles
- run: find ${{ matrix.context }}
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ matrix.image }}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
context: ${{ matrix.context }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ matrix.image }}
subject-digest: ${{ steps.push.outputs.digest }}