CI-Build #928
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 sh -c 'echo "ChallengeResponseAuthentication no" >> /etc/ssh/sshd_config' | |
sudo sh -c 'echo "PasswordAuthentication no" >> /etc/ssh/sshd_config' | |
sudo sh -c 'echo "\nMatch User usr" >> /etc/ssh/sshd_config' | |
sudo sh -c 'echo "\tPasswordAuthentication yes" >> /etc/ssh/sshd_config' | |
sudo sh -c 'echo "\nMatch User All" >> /etc/ssh/sshd_config' | |
sudo sh -c 'echo "\tPasswordAuthentication no" >> /etc/ssh/sshd_config' | |
sudo systemctl enable ssh | |
sudo systemctl start ssh | |
- 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 user2ssh to group ${sshGroup}" | |
sudo useradd -s /bin/bash -d /home/usr2ssh -m -g ${sshGroup} -p $(echo pwd | openssl passwd -1 -stdin) usr2ssh | |
ssh-keygen -t rsa -b 4096 -N "123456" -f ~/.ssh/sftptest | |
chmod -R 700 ~/.ssh/sftptest | |
chmod 600 ~/.ssh/sftptest.pub | |
sudo -u usr2ssh mkdir /home/usr2ssh/.ssh/ | |
sudo cat ~/.ssh/sftptest.pub >> /home/usr2ssh/.ssh/authorized_keys | |
sudo chown -R usr2ssh:${sshGroup} /home/usr2ssh/.ssh | |
sudo chmod go-w /home/usr2ssh | |
sudo chmod -R 700 /home/usr2ssh/.ssh | |
sudo chmod 600 /home/usr2ssh/.ssh/authorized_keys | |
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 |