-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (124 loc) · 4.01 KB
/
Copy pathci.yml
File metadata and controls
132 lines (124 loc) · 4.01 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
# ---------------------------------------------------------------
# workflow: build
#
# Perform on all push and pull_request events.
# Steps will be skipped if there are no build-affecting changes
#
# * Checks all commits for compliance with conventional commit formatting
# * Builds all artifacts
# * Runs all tests
# * Runs all code checks and linters
# * Checks dependencies for required new versions
# * Checks dependencies for vulnerabilities
#
# See: https://github.com/dorny/paths-filter
#
on:
workflow_call:
inputs:
java-version:
default: '21'
description: JDK version
required: false
type: string
java-distribution:
default: 'corretto'
description: JDK distribution
required: false
type: string
force:
default: false
description: Force all steps (ignore changes and branch)
required: false
type: boolean
skip-dependency-checks:
default: false
description: Skip dependency check steps
required: false
type: boolean
name: ci
jobs:
commits:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- uses: gentleseal/action-conventional-commits@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
valid-commit-types: >
[
"build",
"chore",
"docs",
"feat",
"fix",
"perf",
"refactor",
"revert",
"style",
"test"
]
- name: Determine branches
id: vars
run: |
HEAD_BRANCH=$(echo ${GITHUB_REF#refs/heads/})
BASE_BRANCH='master'
echo "BASE_BRANCH=$BASE_BRANCH" >> $GITHUB_ENV
echo "HEAD_BRANCH=$HEAD_BRANCH" >> $GITHUB_ENV
- name: Reject Merge Commits
env:
BASE_BRANCH: ${{ env.BASE_BRANCH }}
HEAD_BRANCH: ${{ env.HEAD_BRANCH }}
run: |
git fetch origin $BASE_BRANCH $HEAD_BRANCH
commits=$(git rev-list --merges origin/${{ env.BASE_BRANCH }}..origin/${{ env.HEAD_BRANCH }})
if [ -n "$commits" ]; then
echo "Push contains merge commits. Please rebase and remove merge commits."
echo "Merge commits found: $commits"
exit 1
else
echo "No merge commits found."
exit 0
fi
changes:
if: ${{ !startsWith(github.ref_name, 'release-please--') }}
runs-on: ubuntu-latest
# Set job outputs to values from filter step
outputs:
src: ${{ steps.filter.outputs.src }}
steps:
- uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: filter
with:
filters: .github/src_filters.yml
validate:
needs: [commits, changes]
if: ${{ (inputs.force || (!inputs.skip-dependency-checks && needs.changes.outputs.src == 'true' && github.ref_name != 'master')) && !startsWith(github.ref_name, 'release-please--') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
- name: Set up JDK ${{ inputs.java-version }} (${{ inputs.java-distribution }})
uses: actions/setup-java@v3
with:
java-version: ${{ inputs.java-version }}
distribution: ${{ inputs.java-distribution }}
- name: Validate dependencies
run: ./gradlew vogueReport
build:
needs: [commits, changes]
if: ${{ (inputs.force || needs.changes.outputs.src == 'true') && !startsWith(github.ref_name, 'release-please--') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
- name: Set up JDK ${{ inputs.java-version }} (${{ inputs.java-distribution }})
uses: actions/setup-java@v3
with:
java-version: ${{ inputs.java-version }}
distribution: ${{ inputs.java-distribution }}
- name: Build
run: ./gradlew build