-
Notifications
You must be signed in to change notification settings - Fork 267
120 lines (105 loc) · 3.4 KB
/
build_and_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
name: Build and Test
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
container:
image: eclipse-temurin:17-jdk
env:
_JAVA_OPTIONS: "-Xmx3G -Xms2G"
steps:
- uses: actions/checkout@v2
- name: Install Node.js
run: |
curl -fsSL https://deb.nodesource.com/setup_21.x | bash -
apt-get install -y nodejs
- name: Check Node.js version
run: node --version
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Setup
run: |
apt update -y && apt install -y gnupg2
- name: Verify files
run: |
curl -sSL https://secchannel.rsk.co/SUPPORT.asc | gpg2 --import -
gpg2 --verify SHA256SUMS.asc && sha256sum --check SHA256SUMS.asc
- name: Build
run: |
./configure.sh
./gradlew --no-daemon dependencies
./gradlew --no-daemon --stacktrace build -x test
- name: Persist workspace
uses: actions/upload-artifact@v3
with:
name: workspace
path: .
sonarqube:
needs: build
runs-on: ubuntu-latest
container:
image: eclipse-temurin:17-jdk
steps:
- uses: actions/checkout@v2
- name: Run SonarQube analysis
env:
SONAR_URL: ${{ secrets.SONAR_URL }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
apt-get update && apt-get install -yqq git
extra_flags=""
if [ "${{ github.event_name }}" == "pull_request" ]; then
git branch -f master origin/master
pr_number=${{ github.event.pull_request.number }}
extra_flags="-Dsonar.pullrequest.base=master
-Dsonar.pullrequest.branch=${{ github.head_ref }}
-Dsonar.pullrequest.key=$pr_number"
else
extra_flags="-Dsonar.branch.name=master"
fi
./gradlew sonarqube --no-daemon -x build -x test $extra_flags
unit-tests:
needs: build
runs-on: ubuntu-latest
container:
image: eclipse-temurin:17-jdk
steps:
- uses: actions/checkout@v2
- name: Install Node.js
run: |
curl -fsSL https://deb.nodesource.com/setup_21.x | bash -
apt-get install -y nodejs
- name: Check Node.js version
run: node --version
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: actions/download-artifact@v3
with:
name: workspace
path: .
- name: Run unit tests
run: |
./gradlew --no-daemon --stacktrace test
- name: Save test results
run: |
mkdir -p ${{ github.workspace }}/junit/
find rskj-core/build/test-results -type f -name "*.xml" \
-exec cp {} ${{ github.workspace }}/junit/ \;
if: always()
- uses: actions/upload-artifact@v3
with:
name: junit-results
path: ${{ github.workspace }}/junit/