-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (73 loc) · 2.49 KB
/
ci.yml
File metadata and controls
86 lines (73 loc) · 2.49 KB
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
name: CI
on:
push:
branches:
- "7.0"
jobs:
deploy-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Deploy test stack
run: |
chmod +x ./others/cicd/simci
export PORTAINER_API_TOKEN="${{ secrets.PORTAINER_API_TOKEN }}"
export IO_PASSWORD="${{ secrets.IO_PASSWORD }}"
./others/cicd/simci portainer-stack-delete gitlab-simfeatures "${{ secrets.PORTAINER_URL }}"
./others/cicd/simci portainer-stack-deploy -f ./others/cicd/portainer-stack.yml gitlab-simfeatures "${{ secrets.PORTAINER_URL }}"
unit-tests:
runs-on: ubuntu-latest
needs: deploy-test
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run unit tests
run: |
chmod +x ./others/cicd/simci
export PORTAINER_API_TOKEN="${{ secrets.PORTAINER_API_TOKEN }}"
export IO_PASSWORD="${{ secrets.IO_PASSWORD }}"
./others/cicd/simci simplicite-run-unit-tests SimFeatures gitlab-simfeatures "${{ secrets.PORTAINER_URL }}"
./others/cicd/simci portainer-stack-get-coverage -v gitlab-simfeatures "${{ secrets.PORTAINER_URL }}"
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: jacoco-report
path: jacoco.xml
if-no-files-found: error
sonarcloud-check:
runs-on: ubuntu-latest
needs: unit-tests
if: ${{ vars.SONARCLOUD_ENABLED || 'false' }}
env:
MAVEN_OPTS: -Dmaven.repo.local=.m2/repository
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Java 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Cache Maven and SonarCloud files
uses: actions/cache@v4
with:
path: |
.sonar/cache
.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Download coverage report
uses: actions/download-artifact@v4
with:
name: jacoco-report
- name: Run SonarCloud analysis
run: |
mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \
-Dsonar.coverage.jacoco.xmlReportPaths=jacoco.xml