Skip to content

SW360 Build and Test #28

SW360 Build and Test

SW360 Build and Test #28

# -----------------------------------------------------------------------------
# Copyright Siemens AG, 2021.
# Part of the SW360 Portal Project.
#
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# -----------------------------------------------------------------------------
name: SW360 Build and Test
on:
pull_request:
branches: [ main ]
paths-ignore:
- "**.md"
- ".github/workflows/docker_deploy.yml"
workflow_dispatch:
permissions: write-all
env:
COUCHDB_USER: admin
COUCHDB_PASSWORD: password
jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: webiny/[email protected]
- name: Verify license headers
run: |
chmod +x .github/testForLicenseHeaders.sh
bash .github/testForLicenseHeaders.sh
- name: Set environment variables
run: |
cat .versions >> $GITHUB_ENV
- name: Setup CouchDB
run: scripts/startCouchdbForTests.sh
- name: Update properties with DB credentials
run: |
sudo mkdir -p /etc/sw360
sudo cp ./build-configuration/test-resources/couchdb-test.properties /etc/sw360/
sudo cp ./scripts/sw360BackendRestDockerConfig/etc_sw360/rest-test.properties /etc/sw360/
sudo sed -i 's/^couchdb.user\s*=/& '${COUCHDB_USER}'/' /etc/sw360/couchdb-test.properties
sudo sed -i 's/^couchdb.password\s*=/& '${COUCHDB_PASSWORD}'/' /etc/sw360/couchdb-test.properties
- name: Prepare build environment
run: |
sudo apt-get update -qq
sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq python3-pip build-essential libboost-dev libboost-test-dev libboost-program-options-dev libevent-dev automake libtool flex bison pkg-config libssl-dev git cmake
pip install mkdocs mkdocs-material
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
check-latest: true
cache: 'maven'
- name: Cache Thrift
id: cache-thrift
uses: actions/cache@v4
with:
path: |
/usr/local/bin
/usr/share/thrift/${{ env.THRIFT_VERSION }}
key: ${{ runner.os }}-thrift-${{ env.THRIFT_VERSION }}
- name: Install Thrift
if: steps.cache-thrift.outputs.cache-hit != 'true'
run: |
chmod +x scripts/install-thrift.sh
bash scripts/install-thrift.sh
- name: Build SW360
id: build
run: |
mvn clean install --no-transfer-progress -P deploy -Dhelp-docs=true -Dbase.deploy.dir=${{ github.workspace }} -Dbackend.deploy.dir=${PWD}/deploy/webapps -Drest.deploy.dir=${PWD}/deploy/webapps -DRunComponentVisibilityRestrictionTest=false -DRunPrivateProjectAccessTest=false -DRunRestForceUpdateTest=false -Dmaven.plugin.validation=VERBOSE
- name: Run PrivateProjectAccessTest
run: |
cd ${{ github.workspace }}/libraries/datahandler
mvn test -Dbase.deploy.dir=${{ github.workspace }} -Dtest=ProjectPermissionsVisibilityTest -DRunPrivateProjectAccessTest=true -DRunRestForceUpdateTest=true
- name: Run BulkReleaseDeletingTest
run: |
cd ${{ github.workspace }}/backend/src/src-components
mvn test -Dbase.deploy.dir=${{ github.workspace }} -Dtest=BulkDeleteUtilTest -DRunPrivateProjectAccessTest=true -DRunBulkReleaseDeletingTest=true
# - name: Deploy Backend and Rest Server
# shell: bash
# run: |
# cd ${{ github.workspace }}
# sudo docker build -t sw360backendrest -f scripts/sw360BackendRest.Dockerfile .
# sudo docker run -dt --network=host sw360backendrest
# scripts/sw360BackendRestDockerConfig/scripts/checkDeploymentIsSuccess.sh
# - name: Create users and oauth client
# shell: bash
# run: |
# scripts/sw360BackendRestDockerConfig/scripts/createUserAndOauthClient.sh
# - name: Run Client Integration Test for Rest Api
# run: |
# cd ${{ github.workspace }}/clients
# mvn clean install -Dbase.deploy.dir=${{ github.workspace }} --no-transfer-progress -DRunRestIntegrationTest=true
# - name: Upload test reports
# if: failure()
# uses: actions/upload-artifact@v4
# with:
# name: test-reports
# path: ${{ github.workspace }}/libraries/importers/target/surefire-reports