forked from eclipse-sw360/sw360
-
Notifications
You must be signed in to change notification settings - Fork 4
113 lines (96 loc) · 4.05 KB
/
build_and_test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# -----------------------------------------------------------------------------
# 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"
- ".github/workflows/scorecard.yml"
workflow_dispatch:
env:
COUCHDB_USER: sw360
COUCHDB_PASSWORD: sw360fossie
permissions:
contents: read
jobs:
build:
name: Build and Test
runs-on: ubuntu-24.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: webiny/action-conventional-commits@8bc41ff4e7d423d56fa4905f6ff79209a78776c7 # v1.3.0
- 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 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: Set up JDK 21
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
with:
java-version: "21"
distribution: "temurin"
check-latest: true
cache: "maven"
- name: Cache Thrift
id: cache-thrift
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: |
${{ github.workspace }}/dist/thrift-${{ env.THRIFT_VERSION }}
key: ${{ runner.os }}-thrift-${{ env.THRIFT_VERSION }}
restore-keys: |
${{ runner.os }}-thrift-${{ env.THRIFT_VERSION }}
- name: Install Thrift
if: steps.cache-thrift.outputs.cache-hit != 'true'
run: |
sudo apt-get update -qq
sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq build-essential libevent-dev libtool flex bison pkg-config libssl-dev git cmake
chmod +x scripts/install-thrift.sh
DESTDIR=${{ github.workspace }}/dist/thrift-${{ env.THRIFT_VERSION }} scripts/install-thrift.sh
- name: Build SW360
run: |
export PATH=$PATH:${{ github.workspace }}/dist/thrift-${{ env.THRIFT_VERSION }}/usr/local/bin
mvn clean install \
--no-transfer-progress \
-P deploy -Dhelp-docs=true \
-Dbase.deploy.dir=. \
-Djars.deploy.dir=${PWD}/deploy \
-Dbackend.deploy.dir=${PWD}/deploy/webapps \
-Drest.deploy.dir=${PWD}/deploy/webapps \
-DRunComponentVisibilityRestrictionTest=false \
-DRunPrivateProjectAccessTest=false \
-DRunRestForceUpdateTest=false \
-fae \
-Dmaven.plugin.validation=VERBOSE
- name: Run PrivateProjectAccessTest
run: |
mvn install -pl :build-configuration -am -Dbase.deploy.dir=.
mvn -pl :datahandler test -Dtest=ProjectPermissionsVisibilityTest -DRunPrivateProjectAccessTest=true -DRunRestForceUpdateTest=true -Dbase.deploy.dir=.
- name: Run BulkReleaseDeletingTest
run: |
mvn -pl :backend-components test -Dtest=BulkDeleteUtilTest -DRunPrivateProjectAccessTest=true -DRunBulkReleaseDeletingTest=true -Dbase.deploy.dir=.