-
Notifications
You must be signed in to change notification settings - Fork 35
129 lines (129 loc) · 6.75 KB
/
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
name: Build and Test
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
branches-ignore:
- '!l10n_master'
jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 11
run: |
sudo apt-get update
sudo apt-get -q -y install default-jdk
# apt-get -q -y install libservlet3.1-java tomcat9
# uses: actions/setup-java@v1
# with:
# java-version: 11
- name: Set up Maven
uses: stCarolas/[email protected]
with:
maven-version: 3.8.7
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build
run: |
VERSION=$(grep -oP '<application.version>\K[^<]+' /home/runner/work/ctsms/ctsms/pom.xml)
echo "VERSION=$VERSION" >> $GITHUB_ENV
COMMIT=$(git log --format=%B -n 1 "$GITHUB_SHA")
COMMIT_MESSAGE_REGEX="[Mm]erge [a-zA-Z0-9]+ into [a-zA-Z0-9]+"
if [[ $COMMIT =~ $COMMIT_MESSAGE_REGEX ]];
then
COMMIT=$(echo "$COMMIT" | sed -e 's/[Mm]erge \([a-zA-Z0-9]\+\) into [a-zA-Z0-9]\+/\1/' | cut -c 1-7)
else
COMMIT=$(git rev-parse --short HEAD)
fi
echo "COMMIT=$COMMIT" >> $GITHUB_ENV
sed -r -i "s/<application.version>([^<]+)<\/application.version>/<application.version>\1 [$COMMIT]<\/application.version>/" /home/runner/work/ctsms/ctsms/pom.xml
UUID="test-"
UUID+=$(cat /proc/sys/kernel/random/uuid)
sed -r -i "s/<application.uuid><\/application.uuid>/<application.uuid>$UUID<\/application.uuid>/" /home/runner/work/ctsms/ctsms/pom.xml
mvn install -DskipTests --no-transfer-progress
- name: Setup database
run: |
sudo chmod 755 /home/runner/work/ctsms/ctsms/.github/workflows/setup_database.sh
/home/runner/work/ctsms/ctsms/.github/workflows/setup_database.sh
- name: Download master data
run: |
sudo chmod 755 /home/runner/work/ctsms/ctsms/.github/workflows/download_masterdata.sh
sudo /home/runner/work/ctsms/ctsms/.github/workflows/download_masterdata.sh
echo "CTSMS_PROPERTIES=/ctsms/properties" >> $GITHUB_ENV
echo "CTSMS_JAVA=/ctsms/java" >> $GITHUB_ENV
- name: Setup BulkProcessor
run: |
sudo chmod 755 /home/runner/work/ctsms/ctsms/.github/workflows/setup_bulkprocessor.sh
sudo -E /home/runner/work/ctsms/ctsms/.github/workflows/setup_bulkprocessor.sh
- name: Setup dbtool.sh
env:
MAIL_SENDER_HOST: ${{ secrets.MAIL_SENDER_HOST }}
MAIL_SENDER_PORT: ${{ secrets.MAIL_SENDER_PORT }}
MAIL_SENDER_PROTOCOL: ${{ secrets.MAIL_SENDER_PROTOCOL }}
MAIL_SENDER_USERNAME: ${{ secrets.MAIL_SENDER_USERNAME }}
MAIL_SENDER_PASSWORD: ${{ secrets.MAIL_SENDER_PASSWORD }}
MAIL_SENDER_AUTH: ${{ secrets.MAIL_SENDER_AUTH }}
MAIL_SENDER_STARTTLS: ${{ secrets.MAIL_SENDER_STARTTLS }}
MAIL_SENDER_ADDRESS: ${{ secrets.MAIL_SENDER_ADDRESS }}
run: |
sudo echo "email_exec_from_address=$MAIL_SENDER_ADDRESS" >> /ctsms/properties/ctsms-settings.properties
sudo echo "email_exec_from_name=Phoenix CTMS Automated Tests" >> /ctsms/properties/ctsms-settings.properties
sudo echo "job_mail_sender_host=$MAIL_SENDER_HOST" >> /ctsms/properties/ctsms-applicationcontext.properties
sudo echo "job_mail_sender_port=$MAIL_SENDER_PORT" >> /ctsms/properties/ctsms-applicationcontext.properties
sudo echo "job_mail_sender_protocol=$MAIL_SENDER_PROTOCOL" >> /ctsms/properties/ctsms-applicationcontext.properties
sudo echo "job_mail_sender_username=$MAIL_SENDER_USERNAME" >> /ctsms/properties/ctsms-applicationcontext.properties
sudo echo "job_mail_sender_password=$MAIL_SENDER_PASSWORD" >> /ctsms/properties/ctsms-applicationcontext.properties
sudo touch /ctsms/properties/ctsms-job-mail-sender.properties
sudo chown ctsms:ctsms /ctsms/properties/ctsms-job-mail-sender.properties
sudo chmod 777 /ctsms/properties/ctsms-job-mail-sender.properties
sudo echo "mail.smtp.auth=$MAIL_SENDER_AUTH" >> /ctsms/properties/ctsms-job-mail-sender.properties
sudo echo "mail.smtp.starttls.enable=$MAIL_SENDER_STARTTLS" >> /ctsms/properties/ctsms-job-mail-sender.properties
sudo chown ctsms:ctsms /home/runner/work/ctsms/ctsms/.github/workflows/dbtool.sh
sudo chmod 755 /home/runner/work/ctsms/ctsms/.github/workflows/dbtool.sh
sudo mv /home/runner/work/ctsms/ctsms/.github/workflows/dbtool.sh /ctsms/dbtool.sh
sudo chmod 777 /home
sudo chmod 777 /home/runner
sudo chmod 777 /home/runner/work
sudo chmod 777 /home/runner/work/ctsms
sudo chmod 777 /home/runner/work/ctsms/ctsms/web -R
- name: Initialize DB
run: |
sudo chmod 755 /home/runner/work/ctsms/ctsms/.github/workflows/init_database.sh
/home/runner/work/ctsms/ctsms/.github/workflows/init_database.sh
- name: Setup Tomcat
run: |
sudo chmod 755 /home/runner/work/ctsms/ctsms/.github/workflows/setup_tomcat.sh
sudo -E /home/runner/work/ctsms/ctsms/.github/workflows/setup_tomcat.sh
- name: Setup ChromeDriver
run: |
sudo chmod 755 /home/runner/work/ctsms/ctsms/.github/workflows/setup_selenium.sh
sudo /home/runner/work/ctsms/ctsms/.github/workflows/setup_selenium.sh
sudo chmod 755 /home/runner/work/ctsms/ctsms/.github/workflows/run_selenium_test.sh
sudo apt-get -q -y install wkhtmltopdf
# xvfb-run java -Dwebdriver.chrome.driver=/usr/bin/chromedriver -jar selenium-server-standalone-4.4.0.jar 2>&1 &
# sleep 5
- name: Load demo data
run: |
/ctsms/dbtool.sh -ldd -f
- name: Run tests
env:
FTP_HOST: ${{ secrets.FTP_HOST }}
FTP_USERNAME: ${{ secrets.FTP_USERNAME }}
FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }}
FTP_PATH: ${{ secrets.FTP_PATH }}
run: |
/home/runner/work/ctsms/ctsms/.github/workflows/run_selenium_test.sh org.phoenixctms.ctsms.selenium.proband.* "Proband Tests" [email protected]
/home/runner/work/ctsms/ctsms/.github/workflows/run_selenium_test.sh org.phoenixctms.ctsms.selenium.trial.* "Trial Tests" [email protected]
# - name: test perl selenium remote
# run: |
# perl /home/runner/work/ctsms/ctsms/.github/workflows/seleniumtest.pl