-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (137 loc) · 5.11 KB
/
Copy pathtest.yml
File metadata and controls
143 lines (137 loc) · 5.11 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
135
136
137
138
139
140
141
142
143
name: Tests
on:
workflow_call:
inputs:
bypass-checks:
type: boolean
default: false
description: Do not fail pipeline if checks failed
style-checks-enabled:
type: boolean
default: true
description: Enable style_checks
style-checks-bypassed:
type: boolean
default: false
description: Do not fail pipeline if style_checks failed
style-task-name:
type: string
default: "checkstyleMain"
description: Gradle task name to run in style_checks
code-checks-enabled:
type: boolean
default: true
description: Enable code_checks
code-checks-bypassed:
type: boolean
default: false
description: Do not fail pipeline if code_checks failed
ort-enabled:
type: boolean
default: true
description: Enable ORT scanning
ort-bypassed:
type: boolean
default: false
description: Do not fail pipeline if ORT scan failed
ort-version:
type: string
default: "latest"
description: ORT version to use
ort-config-repository:
type: string
description: ORT config repository to use
default: ${{ vars.ORT_CONFIG_VCS_URL || 'https://github.com/oss-review-toolkit/ort-config.git' }}
ort-config-revision:
type: string
description: ORT config revision to use
default: ${{ vars.ORT_CONFIG_VCS_REVISION || 'main' }}
java-version:
type: string
default: "17"
description: Java version to use
java-distribution:
type: string
default: "temurin"
description: Java distribution to use
runs-on:
type: string
description: Overrides jobs runs-on settings (json-encoded list)
default: '["ubuntu-24.04"]'
permissions:
contents: read
jobs:
style_checks:
if: ${{ inputs.style-checks-enabled }}
runs-on: ${{ fromJSON(inputs.runs-on) }}
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
lfs: true
- uses: epam/ai-dial-ci/actions/java_prepare@4.5.0
with:
java-version: ${{ inputs.java-version }}
java-distribution: ${{ inputs.java-distribution }}
- name: Test
continue-on-error: ${{ inputs.bypass-checks || inputs.style-checks-bypassed }}
shell: bash
env:
# PAT is used temporarily
GPR_USERNAME: ${{ secrets.GPR_USERNAME }}
GPR_PASSWORD: ${{ secrets.GPR_PASSWORD }}
STYLE_TASK_NAME: ${{ inputs.style-task-name }}
run: |
if [ -n "$STYLE_TASK_NAME" ] && ./gradlew tasks --all --quiet | grep -qw "$STYLE_TASK_NAME"; then
./gradlew "$STYLE_TASK_NAME"
else
echo "::error::Gradle task '$STYLE_TASK_NAME' was not found" && exit 1
fi
code_checks:
if: ${{ inputs.code-checks-enabled }}
runs-on: ${{ fromJSON(inputs.runs-on) }}
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
lfs: true
- uses: epam/ai-dial-ci/actions/java_prepare@4.5.0
with:
java-version: ${{ inputs.java-version }}
java-distribution: ${{ inputs.java-distribution }}
- name: Test
continue-on-error: ${{ inputs.bypass-checks || inputs.code-checks-bypassed }}
shell: bash
env:
# PAT is used temporarily
GPR_USERNAME: ${{ secrets.GPR_USERNAME }}
GPR_PASSWORD: ${{ secrets.GPR_PASSWORD }}
SKIP_STYLE_TASK: ${{ inputs.style-checks-enabled }}
STYLE_TASK_NAME: ${{ inputs.style-task-name }}
run: |
#!/bin/bash
check_args=()
if [ "$SKIP_STYLE_TASK" = "true" ]; then
if [ -n "$STYLE_TASK_NAME" ] && ./gradlew tasks --all --quiet | grep -qw "$STYLE_TASK_NAME"; then
check_args=(-x "$STYLE_TASK_NAME")
else
echo "::warning::Gradle task '$STYLE_TASK_NAME' was not found; nothing to exclude"
fi
fi
./gradlew check "${check_args[@]}" || { echo "::error::Checks failed" && exit 1; } # TODO: figure out why we need to capture exit code
ort:
if: ${{ inputs.ort-enabled }}
runs-on: ${{ fromJSON(inputs.runs-on) }}
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
lfs: true
- uses: oss-review-toolkit/ort-ci-github-action@9acdf1e56f1b42972b12274ae56c35bf70a5f65b # v1.0.1
env:
CONTINUE_ON_ERROR: ${{ inputs.bypass-checks || inputs.ort-bypassed }} # Hack to use the input below as a boolean
with:
image: "ghcr.io/oss-review-toolkit/ort:${{ inputs.ort-version }}"
allow-dynamic-versions: "true"
fail-on: "violations"
ort-cli-args: "-P ort.forceOverwrite=true --stacktrace -P ort.analyzer.enabledPackageManagers=Gradle"
ort-config-repository: ${{ inputs.ort-config-repository }}
ort-config-revision: ${{ inputs.ort-config-revision }}
continue-on-error: ${{ fromJSON(env.CONTINUE_ON_ERROR) }}