Repository navigation
134 lines (118 loc) · 5.38 KB
/
Copy pathci.yml
File metadata and controls
134 lines (118 loc) · 5.38 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
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Continuous Integration
on:
push:
branches: ['**', '!renovate/**']
tags: ['v*.*.*']
pull_request:
branches: [main, 'release/**']
schedule:
- cron: '30 5 * * *'
permissions:
contents: read
jobs:
workflow-tests:
name: Workflow scripts
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup mise
uses: jdx/mise-action@08ae2a091c038e1e05ec6f5115dc5c69d5a2a6b8 # v5.1.2
with:
install: true
install_args: actionlint shellcheck
- name: Check workflow syntax
run: mise exec -- actionlint
build:
name: Build and test
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
java: [17, 21, 25]
steps:
- name: Checkout (with history)
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
fetch-tags: true
persist-credentials: false
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0
with:
distribution: 'zulu'
java-version: ${{ matrix.java }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0
with:
dependency-graph: disabled
validate-wrappers: true
- name: Download TLA+ tools
if: matrix.java == '17'
env:
TLA2TOOLS_SHA256: 936a262061c914694dfd669a543be24573c45d5aa0ff20a8b96b23d01e050e88
TLA2TOOLS_URL: https://github.com/tlaplus/tlaplus/releases/download/v1.7.4/tla2tools.jar
run: |
tla2tools_jar="${RUNNER_TEMP}/tla2tools-1.7.4.jar"
curl --fail --location --proto '=https' --tlsv1.2 \
--output "${tla2tools_jar}" "${TLA2TOOLS_URL}"
echo "${TLA2TOOLS_SHA256} ${tla2tools_jar}" | sha256sum --check
echo "TLA2TOOLS_JAR=${tla2tools_jar}" >> "${GITHUB_ENV}"
- name: Check TLA+ models
if: matrix.java == '17'
run: ./gradlew :sshlib:checkTla
- name: Configure Docker mirror
run: |
echo '{"registry-mirrors": ["https://mirror.gcr.io"]}' | sudo tee /etc/docker/daemon.json
sudo systemctl restart docker
- name: Build with Gradle
run: ./gradlew --dependency-verification strict build koverXmlReport --info -PjdkVersion=${{ matrix.java }}
- name: Read project version
id: project-version
if: matrix.java == '17'
run: |
version="$(sed -n 's/^version=//p' gradle.properties)"
echo "version=${version}" >> "${GITHUB_OUTPUT}"
- name: Verify release tag
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && matrix.java == '17'
run: |
test "$(git cat-file -t "${GITHUB_REF_NAME}")" = "tag"
git fetch origin \
"+refs/heads/main:refs/remotes/origin/main" \
"+refs/heads/release/*:refs/remotes/origin/release/*"
tag_commit="$(git rev-list -n 1 "${GITHUB_REF_NAME}")"
git branch -r --contains "${tag_commit}" | grep -E 'origin/(main|release/[0-9]+\.[0-9]+)$'
- name: Upload snapshot to Sonatype
if: >
github.event_name == 'push' &&
matrix.java == '17' &&
endsWith(steps.project-version.outputs.version, '-SNAPSHOT') &&
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/'))
run: |
./gradlew publishToMavenCentral --no-configuration-cache -PmavenCentralUsername="${ORG_GRADLE_PROJECT_mavenCentralUsername}" -PmavenCentralPassword="${ORG_GRADLE_PROJECT_mavenCentralPassword}"
env:
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.MAVEN_GPG_KEYID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
- name: Upload release to Sonatype
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && matrix.java == '17'
run: |
./gradlew publishToMavenCentral --no-configuration-cache -PmavenCentralUsername="${ORG_GRADLE_PROJECT_mavenCentralUsername}" -PmavenCentralPassword="${ORG_GRADLE_PROJECT_mavenCentralPassword}"
env:
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.MAVEN_GPG_KEYID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
- name: Run SonarCloud analysis
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: "${{ matrix.java == '25' && env.SONAR_TOKEN != '' }}"
run: ./gradlew sonar -Dsonar.projectVersion=${{ github.sha }}