forked from eclipse-sw360/sw360-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
164 lines (138 loc) · 5.66 KB
/
build-and-automation-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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "binhth/actions-cypress" ]
pull_request:
branches: [ "binhth/actions-cypress" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions: write-all
env:
COUCHDB_USER: admin
COUCHDB_PASSWORD: password
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
# - uses: webiny/[email protected]
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: 'true'
ssh-key: ${{ secrets.binhth2 }}
- name: Verify license headers
run: |
cd ./sw360
chmod +x ./.github/testForLicenseHeaders.sh
bash ./.github/testForLicenseHeaders.sh
cd ../
- name: Set environment variables
run: |
echo _JAVA_OPTIONS= '-Djdk.util.zip.disableZip64ExtraFieldValidation=true' >> $GITHUB_ENV
cat ./sw360/.versions >> $GITHUB_ENV
- name: Setup CouchDB
run: |
cd ./sw360
scripts/startCouchdbForTests.sh
cd ../
- name: Update properties with DB credentials
run: |
cd ./sw360
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
cd ../
- 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 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
check-latest: true
cache: 'maven'
- name: Cache Thrift
id: cache-thrift
uses: actions/cache@v4
with:
path: |
/usr/local/bin/thrift
/usr/share/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: |
cd ./sw360
chmod +x scripts/install-thrift.sh
bash scripts/install-thrift.sh
cd ../
- name: Build SW360
run: |
cd ./sw360
mvn clean install --no-transfer-progress -P deploy -Dhelp-docs=true -Dbase.deploy.dir=. -Dliferay.deploy.dir=${PWD}/deploy -Dbackend.deploy.dir=${PWD}/deploy/webapps -Drest.deploy.dir=${PWD}/deploy/webapps -DRunComponentVisibilityRestrictionTest=false -DRunPrivateProjectAccessTest=false -DRunRestForceUpdateTest=false
cd ../
- name: Run PrivateProjectAccessTest
run: |
cd ./sw360/build-configuration
mvn install
cd ..
cd libraries/datahandler
mvn test -Dtest=ProjectPermissionsVisibilityTest -DRunPrivateProjectAccessTest=true -DRunRestForceUpdateTest=true
cd ../../
- name: Run BulkReleaseDeletingTest
run: |
cd sw360/backend/src/src-components
mvn test -Dtest=BulkDeleteUtilTest -DRunPrivateProjectAccessTest=true -DRunBulkReleaseDeletingTest=true
cd ../
- name: Deploy Backend and Rest Server
run: |
cd ./sw360
sudo docker build -t sw360backendrest -f sw360BackendRest.Dockerfile .
sudo docker run -dt --network=host sw360backendrest
bash scripts/sw360BackendRestDockerConfig/scripts/checkDeploymentIsSuccess.sh
cd ../
- name: Create users and oauth client
run: |
cd ./sw360
bash scripts/sw360BackendRestDockerConfig/scripts/createUserAndOauthClient.sh
cd ../
- name: Run Client Integration Test for Rest Api
run: |
cd ./sw360/clients
mvn clean install --no-transfer-progress -DRunRestIntegrationTest=true
cd ../
- name: Install Nodejs
run: |
sudo apt-get update
curl -sL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install nodejs -y
nodejs -v
npm -v
- name: Install Google Chrome
run: |
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
google-chrome --version
- name: Install dependencies of running sw360-frontend
run: |
sudo apt-get install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libnss3 libxss1 libasound2 libxtst6 xauth xvfb jq
npm i
- name: run cypress
run: |
npx cypress run --browser chrome