Skip to content

Bump

Bump #5

Workflow file for this run

#
# Copyright (c) 2023 Mercedes-Benz Tech Innovation GmbH
# Copyright (c) 2021, 2023 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
---
name: "Verify"
on:
push:
branches:
- feature/swagger-api-2
jobs:
verify-license-headers:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.5.2
- name: "Check for files without a license header"
run: |-
# checks all java, yaml, kts and sql files for an Apache 2.0 license header
cmd="grep -riL \"SPDX-License-Identifier: Apache-2.0\" --include=\*.{java,yaml,yml,kts,sql} --exclude-dir={.gradle,\*\openapi} ."
violations=$(eval $cmd | wc -l)
if [[ $violations -ne 0 ]] ; then
echo "$violations files without license headers were found:";
eval $cmd;
exit 1;
fi
verify-helm-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: addnab/docker-run-action@v3
with:
image: jnorwood/helm-docs:v1.10.0
options: -v ${{ github.workspace }}/charts:/helm-docs
run: helm-docs
- run: |
if $(git diff --quiet --exit-code); then
echo "Helm chart docs up to date"
else
echo "Helm chart docs not up to date:"
git diff
exit 1
fi
verify-dependencies:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-java
- name: Download latest Eclipse Dash
run: |
curl -L https://repo.eclipse.org/service/local/artifact/maven/redirect\?r\=dash-licenses\&g\=org.eclipse.dash\&a\=org.eclipse.dash.licenses\&v\=LATEST --output dash.jar
- name: Regenerate DEPENDENCIES
run: |
# dash returns a nonzero exit code if there are libs that need review. the "|| true" avoids that
./gradlew allDependencies | grep -Poh "(?<=\s)[\w.-]+:[\w.-]+:[^:\s\[\]]+" | sort | uniq | java -jar dash.jar - -summary DEPENDENCIES-gen || true
# log warning if restricted deps are found
grep -E 'restricted' DEPENDENCIES | if test $(wc -l) -gt 0; then
echo "::warning file=DEPENDENCIES,title=Restricted Dependencies found::Some dependencies are marked 'restricted' - please review them"
fi
# log error and fail job if rejected deps are found
grep -E 'rejected' DEPENDENCIES | if test $(wc -l) -gt 0; then
echo "::error file=DEPENDENCIES,title=Rejected Dependencies found::Some dependencies are marked 'rejected', they cannot be used"
exit 1
fi
- name: Check for differences
run: |
diff DEPENDENCIES DEPENDENCIES-gen
verify-formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.5.2
- uses: ./.github/actions/setup-java
- name: Verify proper formatting
run: ./gradlew spotlessCheck
- name: Run Checkstyle
run: |
./gradlew checkstyleMain checkstyleTest
markdown-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.5.2
- name: Install mardkdownlint
run: npm install -g markdownlint-cli2
- name: Run markdownlint
run: |
markdownlint-cli2-config .markdownlint.yaml "**/*.md" "#.github" "#charts"
unit-tests:
runs-on: ubuntu-latest
needs: [ verify-formatting, verify-license-headers ]
steps:
- uses: actions/checkout@v3.5.2
- uses: ./.github/actions/setup-java
- name: Run Unit tests
run: ./gradlew test
integration-tests:
runs-on: ubuntu-latest
needs: [ verify-formatting, verify-license-headers ]
steps:
- uses: actions/checkout@v3.5.2
- uses: ./.github/actions/setup-java
- name: Run Integration tests
run: ./gradlew test -DincludeTags="ComponentTest"
api-tests:
runs-on: ubuntu-latest
needs: [ verify-formatting, verify-license-headers ]
steps:
- uses: actions/checkout@v3.5.2
- uses: ./.github/actions/setup-java
- name: Run API tests
run: ./gradlew test -DincludeTags="ApiTest"
end-to-end-tests:
runs-on: ubuntu-latest
needs: [ verify-formatting, verify-license-headers ]
steps:
- uses: actions/checkout@v3.5.2
- uses: ./.github/actions/setup-java
- name: Run E2E tests
run: ./gradlew test -DincludeTags="EndToEndTest"
postgres-tests:
runs-on: ubuntu-latest
needs: [ verify-formatting, verify-license-headers ]
services:
postgres:
image: postgres:14.2
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: password
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-java
# create non-default schema name to test usage of non-default schema
- name: setup postgres schema
run: |
sudo apt update
sudo apt install --yes postgresql-client
psql -h localhost -d postgres -U postgres -c 'CREATE SCHEMA testschema;'
env:
PGPASSWORD: password
- name: Run Postgresql E2E tests
run: ./gradlew test -DincludeTags="PostgresqlIntegrationTest"
miw-integration-tests:
runs-on: ubuntu-latest
needs: [ verify-formatting, verify-license-headers ]
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-java
- uses: actions/checkout@v2
- name: Starting MIW, Keycloak and Postgres Servers
run: |
cd edc-tests/miw-tests/src/test/resources/docker-environment
docker compose up --wait
- uses: nick-fields/retry@v2
name: Wait for MIW
with:
timeout_minutes: 5
max_attempts: 3
command: |
code=$(curl -IL -sw "%{http_code}" http://localhost:8000/api/actuator/health -o /dev/null)
if [ "$code" -ne "401" ]; then
echo "MIW not ready yet, status = $code"
exit 1;
fi
- name: Seed test data
run: |
docker exec docker-environment-postgres-1 /opt/seed.sh
- name: Run MIW Integration tests
run: |
./gradlew -p edc-tests/miw-tests test -DincludeTags="MiwIntegrationTest" -PverboseTest=true
- name: Run SSI E2E tests
run: |
pwd
./gradlew compileJava compileTestJava
./gradlew -p edc-tests/e2e-tests test -DincludeTags="MiwIntegrationTest" -PverboseTest=true
# this is for testing only; remove later
swagger-api:
runs-on: ubuntu-latest
env:
SWAGGERHUB_API_KEY: ${{ secrets.SWAGGERHUB_API_KEY }}
SWAGGERHUB_USER: ${{ secrets.SWAGGERHUB_USER }}
steps:
- uses: actions/checkout@v3
- name: Setup JDK 17
uses: actions/setup-java@v3.11.0
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'
- name: Setup node
uses: actions/setup-node@v3
- name: Install tools
run: |
npm i -g swaggerhub-cli
sudo apt install -y crudini
- name: Extract versions
run: |
export DOWNSTREAM_VERSION=$(crudini --get ./gradle.properties '' version)
export UPSTREAM_VERSION=$(crudini --get ./gradle/libs.versions.toml versions edc | sed 's/"//g')-SNAPSHOT
[ -z $DOWNSTREAM_VERSION ] && exit 1
[ -z UPSTREAM_VERSION ] && exit 1
- name: Resolve TX EDC API Spec
shell: bash
run: |
./gradlew :edc-extensions:dataplane-proxy:edc-dataplane-proxy-provider-api:resolve
./gradlew :edc-extensions:dataplane-proxy:edc-dataplane-proxy-consumer-api:resolve
- name: Download upstream API specs
run: |
swaggerhub api:get eclipse-edc-bot/management-api/${{ env.UPSTREAM_VERSION }} > resources/openapi/yaml/upstream-management-api.yaml
swaggerhub api:get eclipse-edc-bot/control-api/${{ env.UPSTREAM_VERSION }} > resources/openapi/yaml/upstream-control-api.yaml
- name: Merge API specs
run: |
./gradlew -PapiTitle="tractusx-edc-api" -PapiDescription="Tractus EDC API Doc" :mergeApiSpec --input=./resources/openapi/yaml --output=./resources/openapi/yaml/tractusx-edc-api.yaml
# create API, will fail if exists
- name: Create API
continue-on-error: true
run: |
swaggerhub api:create ${{ env.SWAGGERHUB_USER }}/tractusx-edc/${{ env.DOWNSTREAM_VERSION }} -f ./resources/openapi/yaml/tractusx-edc-api.yaml --visibility=public --published=unpublish
# Post the API to SwaggerHub as "unpublished", because published APIs cannot be overwritten
- name: Publish API Specs to SwaggerHub
run: |
swaggerhub api:update ${{ env.SWAGGERHUB_USER }}/tractusx-edc/${{ env.DOWNSTREAM_VERSION }} -f ./resources/openapi/yaml/tractusx-edc-api.yaml --visibility=public --published=unpublish