-
Notifications
You must be signed in to change notification settings - Fork 2
134 lines (128 loc) · 4.64 KB
/
ci-build.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
130
131
132
133
134
# Generated by Project Keeper
# https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/ci-build-db-version-matrix.yml
name: CI Build
on:
push:
branches: ["main"]
pull_request:
jobs:
matrix-build:
runs-on: ubuntu-latest
defaults:
run:
shell: "bash"
permissions:
contents: read
checks: write # Allow scacap/action-surefire-report
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.exasol_db_version }}
cancel-in-progress: true
strategy:
fail-fast: false
matrix:
exasol_db_version: ["8.26.0", "7.1.26"]
env:
DEFAULT_EXASOL_DB_VERSION: "8.26.0"
steps:
- name: Free Disk Space
if: ${{ true }}
run: |
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/share/dotnet
- name: Checkout the repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDKs
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: |
11
17
cache: "maven"
- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Enable testcontainer reuse
run: echo 'testcontainers.reuse.enable=true' > "$HOME/.testcontainers.properties"
- name: Run tests and build with Maven
id: pk-verify
run: |
mvn --batch-mode clean verify \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
-DtrimStackTrace=false \
-Dcom.exasol.dockerdb.image=${{ matrix.exasol_db_version }}
env:
# Set additional environment variable as in scala projects the scalatest plugin does not forward
# the system property -Dcom.exasol.dockerdb.image to the test's implementation.
EXASOL_DB_VERSION: ${{ matrix.exasol_db_version }}
- name: Publish Test Report for Exasol ${{ matrix.exasol_db_version }}
uses: scacap/action-surefire-report@v1
if: ${{ always() && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Sonar analysis
if: ${{ env.SONAR_TOKEN != null && matrix.exasol_db_version == env.DEFAULT_EXASOL_DB_VERSION }}
run: |
mvn --batch-mode org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
-DtrimStackTrace=false \
-Dsonar.token=$SONAR_TOKEN
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Verify Release Artifacts
run: |
print_message() {
local -r message=$1
echo "$message"
echo "$message" >> "$GITHUB_STEP_SUMMARY"
}
print_message "# Release Artifacts"
IFS=$'\n' artifacts_array=($ARTIFACTS)
missing_files=()
for file in "${artifacts_array[@]}";
do
echo "Checking if file $file exists..."
if ! [[ -f "$file" ]]; then
print_message "* ⚠️ \`$file\` does not exist ⚠️"
echo "Content of directory $(dirname "$file"):"
ls "$(dirname "$file")"
missing_files+=("$file")
else
print_message "* \`$file\` ✅"
fi
done
print_message ""
number_of_missing_files=${#missing_files[@]}
if [[ $number_of_missing_files -gt 0 ]]; then
print_message "⚠️ $number_of_missing_files release artifact(s) missing ⚠️"
exit 1
else
print_message "All ${#artifacts_array[@]} artifact(s) present ✅"
fi
env:
ARTIFACTS: ${{ steps.pk-verify.outputs.release-artifacts }}
build:
needs: matrix-build
runs-on: ubuntu-latest
steps:
- run: echo "Build successful"
# [impl->dsn~release-workflow.ci-build-starts-release~1]
start_release:
needs: build
if: ${{ github.ref == 'refs/heads/main' }}
concurrency:
cancel-in-progress: false
group: "release"
secrets: inherit
permissions:
contents: write
actions: read
uses: ./.github/workflows/release.yml
with:
started-from-ci: true