-
Notifications
You must be signed in to change notification settings - Fork 1
103 lines (90 loc) · 3.4 KB
/
ci.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
name: CI-Build
on:
push:
workflow_dispatch:
workflow_call:
inputs:
mvnArgs:
type: string
required: false
javaVersion:
type: number
default: 17
mvnVersion:
type: string
default: 3.6.3
schedule:
- cron: '21 21 * * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Java JDK
uses: actions/setup-java@v4
with:
java-version: ${{ inputs.javaVersion || '17' }}
distribution: temurin
- name: Install and start SFTP
run: |
sudo apt install openssh-server
sudo sed '/KbdInteractiveAuthentication/d' /etc/ssh/sshd_config
sudo sh -c 'echo "Match User usr4ssh" >> /etc/ssh/sshd_config'
sudo sh -c 'echo "\tPasswordAuthentication no" >> /etc/ssh/sshd_config'
sudo sh -c 'echo "\tPermitEmptyPasswords yes" >> /etc/ssh/sshd_config'
sudo sh -c 'echo "\tKbdInteractiveAuthentication no" >> /etc/ssh/sshd_config'
sudo sh -c 'echo "\tPubkeyAuthentication yes" >> /etc/ssh/sshd_config'
sudo sh -c 'echo "Match all" >> /etc/ssh/sshd_config'
sudo sh -c 'echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config'
sudo sh -c 'echo "KbdInteractiveAuthentication no" >> /etc/ssh/sshd_config'
sudo systemctl enable ssh
sudo systemctl start ssh
sudo cat /etc/ssh/sshd_config
- name: Create a test user account
run: |
sshGroupRaw=$(getent group | grep ssh)
sshGroup=${sshGroupRaw%:x*}
echo "adding user to group ${sshGroup}"
sudo useradd -s /bin/bash -d /home/usr -m -g ${sshGroup} -p $(echo pwd | openssl passwd -1 -stdin) usr
echo "adding user for test ssh keypair to group ${sshGroup}"
sudo useradd -s /bin/bash -d /home/usr4ssh -m -g ${sshGroup} -p $(echo pwd | openssl passwd -1 -stdin) usr4ssh
ssh-keygen -t rsa -b 4096 -N "123456" -f ~/.ssh/sftptest
chmod -R 700 ~/.ssh/sftptest
chmod 600 ~/.ssh/sftptest.pub
sudo -u usr4ssh mkdir /home/usr4ssh/.ssh/
sudo cat ~/.ssh/sftptest.pub >> /home/usr4ssh/.ssh/authorized_keys
sudo chown -R usr4ssh:${sshGroup} /home/usr4ssh/.ssh
sudo chmod -R 700 /home/usr4ssh/.ssh
sudo chmod 664 /home/usr4ssh/.ssh/authorized_keys
sudo systemctl restart ssh
cp ~/.ssh/sftptest ${GITHUB_WORKSPACE}/sftp-connector-test/src_test/com/axonivy/connector/sftp/test/sftptest
- name: Setup Maven
uses: stCarolas/setup-maven@v5
with:
maven-version: ${{ inputs.mvnVersion || '3.6.3' }}
- name: Build with Maven
run: mvn clean verify --batch-mode --fail-at-end ${{ inputs.mvnArgs }}
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
junit_files: |
*/target/*-reports/*.xml
!*/target/*-reports/failsafe-summary.xml
- name: Archive build artifact
uses: actions/upload-artifact@v4
with:
path: |
*/target/*.iar
*/target/*-[0-9]*.jar
*product/target/*.zip
- name: Archive test reports
uses: actions/upload-artifact@v4
if: failure()
with:
name: test-reports
retention-days: 5
path: |
*/target/testEngineOut.log
*/target/selenide/*
*/target/ivyEngine/deploy/*/*.deploymentLog