forked from hyphanet/fred
-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (75 loc) · 2.53 KB
/
Copy pathbuild.yml
File metadata and controls
88 lines (75 loc) · 2.53 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
name: Build cryptad artifacts
on:
workflow_call:
inputs:
git-ref:
type: string
default: main
jdk-version:
type: string
default: '25'
outputs:
artifact-id:
description: The artifact-id for built cryptad.jar
value: ${{ jobs.build.outputs.artifact-id }}
secrets:
SONAR_TOKEN:
description: SonarCloud token forwarded from caller
required: false
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
actions: write # required for actions/cache to reserve/upload caches
# Expose selected secrets as env so we can use them in step `if:`
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
outputs:
artifact-id: ${{ steps.upload-artifact.outputs.artifact-id}}
steps:
- uses: actions/checkout@v6
with:
repository: crypta-network/cryptad
ref: ${{ inputs.git-ref }}
fetch-depth: 0 # Required for Sonar analysis accuracy
- name: Set up JDK
uses: actions/setup-java@v5
with:
java-version: ${{ inputs.jdk-version }}
distribution: 'temurin'
# Cache SonarQube packages to speed up analysis
- name: Cache SonarQube packages
uses: actions/cache@v5
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@f29f5a9d7b09a7c6b29859002d29d24e1674c884 # v5
- name: Install Gradle properties
uses: ./.github/actions/setup-gradle-properties
- name: Build and analyze (Gradle)
if: ${{ env.SONAR_TOKEN != '' }}
env:
GITHUB_TOKEN: ${{ github.token }}
SONAR_TOKEN: ${{ env.SONAR_TOKEN }}
run: ./gradlew build sonar --warning-mode all
- name: Build (no Sonar token)
if: ${{ env.SONAR_TOKEN == '' }}
env:
GITHUB_TOKEN: ${{ github.token }}
run: ./gradlew build
- name: Upload cryptad.jar
id: upload-artifact
uses: actions/upload-artifact@v6
with:
name: cryptad
path: build/libs/cryptad.jar
- name: Upload jlink tarball
uses: actions/upload-artifact@v6
with:
name: cryptad-jlink
path: build/distributions/cryptad-jlink-v*.tar.gz