Repository navigation
149 lines (136 loc) · 6 KB
/
Copy pathcheck-dependencies.yml
File metadata and controls
149 lines (136 loc) · 6 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
144
145
146
147
148
149
name: "3rd-party"
on:
workflow_call:
inputs:
submit-baseline:
type: boolean
default: false
check-inventory:
type: boolean
default: true
outputs:
artifact_id:
value: ${{ jobs.dependency-check.outputs.artifact_id }}
inventory_artifact_id:
value: ${{ jobs.dependency-check.outputs.inventory_artifact_id }}
permissions:
contents: read
jobs:
dependency-check:
name: dependency-check
runs-on: ubuntu-24.04
# Preserve the existing inventory job budget; baseline-only builds keep their 60-minute limit.
timeout-minutes: ${{ inputs.check-inventory && 360 || 60 }}
outputs:
artifact_id: ${{ steps.snapshot.outputs.artifact-id }}
inventory_artifact_id: ${{ steps.inventory.outputs.artifact-id }}
env:
USE_STAGE: 'false' # Whether to include the stage repository.
SCRIPT_DEPENDENCY: install-dist/scripts/dependency
PYTHONDONTWRITEBYTECODE: '1' # Keep generated Python caches out of source style checks.
INPUT_TOKEN: ''
GITHUB_TOKEN: ''
GH_TOKEN: ''
steps:
- name: Checkout source
id: checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.sha }}
persist-credentials: false
- name: Set up project JDK
uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
with:
java-version-file: .github/workflows/.java-version
distribution: 'temurin'
cache: maven
- name: use staged maven repo settings
if: ${{ env.USE_STAGE == 'true' }}
run: |
cp "$HOME/.m2/settings.xml" /tmp/settings.xml
mv -vf .github/configs/settings.xml "$HOME/.m2/settings.xml"
- name: Test shared foundation checks
if: inputs.check-inventory
run: python3 -m unittest discover -s install-dist/scripts/shared-foundation -p 'test_*.py'
- name: Test dependency inventory producer and checker
run: python3 -m unittest discover -s install-dist/scripts/dependency -p 'test_*.py'
- name: Verify baseline checkout and current master
if: inputs.submit-baseline
env:
EXPECTED_SHA: ${{ github.sha }}
run: |
test "$(git rev-parse HEAD)" = "$EXPECTED_SHA"
test "$(git ls-remote origin refs/heads/master | cut -f1)" = "$EXPECTED_SHA"
- name: mvn install
env:
CHECK_INVENTORY: ${{ inputs.check-inventory }}
run: |
args=(-Dmaven.test.skip=true -ntp --fail-at-end)
if [[ "$CHECK_INVENTORY" != 'true' ]]; then
args+=(-Dmaven.javadoc.skip=true)
fi
mvn install "${args[@]}"
- name: Check shared foundation boundaries and shipped classes
if: inputs.check-inventory
run: |
REVISION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
python3 install-dist/scripts/shared-foundation/check_shared_foundation.py --revision "$REVISION"
- name: generate current dependencies
if: inputs.check-inventory
run: |
bash "$SCRIPT_DEPENDENCY/regenerate_known_dependencies.sh" "$PWD/target/dependency/current-dependencies.txt"
- name: check third dependencies
if: inputs.check-inventory
run: |
bash "$SCRIPT_DEPENDENCY/check_dependencies.sh" \
"$SCRIPT_DEPENDENCY/known-dependencies.txt" "$PWD/target/dependency/current-dependencies.txt"
- name: Generate resolved reactor snapshot
if: inputs.submit-baseline
run: |
mvn -B -ntp com.github.ferstl:depgraph-maven-plugin:4.0.3:graph \
-DgraphFormat=json -DoutputFileName=maven-dependency-submission-action-depgraph.json \
-Dmaven.test.skip=true -Dmaven.javadoc.skip=true
python3 .github/scripts/dependency-snapshot.py "$RUNNER_TEMP/snapshot.json"
- name: Resolve independent dependency inventory
if: inputs.submit-baseline
run: |
mvn -B -ntp org.apache.maven.plugins:maven-dependency-plugin:3.8.1:tree \
-DoutputType=json -DoutputFile=target/dependency-inventory.json \
-Dverbose=false -DappendOutput=false \
-Dmaven.test.skip=true -Dmaven.javadoc.skip=true
python3 .github/scripts/dependency-inventory.py "$RUNNER_TEMP/inventory.json"
- name: Refuse stale dependency reports
if: inputs.submit-baseline
env:
EXPECTED_SHA: ${{ github.sha }}
run: test "$(git ls-remote origin refs/heads/master | cut -f1)" = "$EXPECTED_SHA"
- name: Upload snapshot data only
if: inputs.submit-baseline
id: snapshot
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: dependency-snapshot-${{ github.run_id }}-${{ github.run_attempt }}
path: ${{ runner.temp }}/snapshot.json
if-no-files-found: error
retention-days: 1
- name: Upload inventory data only
if: inputs.submit-baseline
id: inventory
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: dependency-inventory-${{ github.run_id }}-${{ github.run_attempt }}
path: ${{ runner.temp }}/inventory.json
if-no-files-found: error
retention-days: 1
- name: 'Dependency Review'
if: ${{ !cancelled() && steps.checkout.outcome == 'success' && github.event_name == 'pull_request' }}
uses: actions/dependency-review-action@v5
# Refer: https://github.com/actions/dependency-review-action
with:
# TODO: reset critical to low before releasing
fail-on-severity: critical
# No Scorecard gate is configured; avoid informational lookups for every package.
show-openssf-scorecard: false
# Action will fail if dependencies don't match the list
#allow-licenses: Apache-2.0, MIT
#deny-licenses: GPL-3.0, AGPL-1.0, AGPL-3.0, LGPL-2.0, CC-BY-3.0