-
Notifications
You must be signed in to change notification settings - Fork 10
161 lines (143 loc) · 6.6 KB
/
gradle.yml
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
150
151
152
153
154
155
156
157
158
159
160
161
name: Gradle
on: [push, workflow_dispatch]
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest]
java: [17]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ matrix.java }}
- name: Pre-details
id: pre_details
run: |
packageChecksum=$(md5sum package.json)
packageStat=$(stat package.json | sed 's/$/\\n/' | tr -d '\n')
packageLockChecksum=$(md5sum package-lock.json || echo "File not found")
packageLockStat=$([[ -f package-lock.json ]] && stat package-lock.json | sed 's/$/\\n/' | tr -d '\n' || echo "File not found.")
echo $packageChecksum
echo "$packageStat"
echo $packageLockChecksum
echo "$packageLockStat"
echo "package=$packageChecksum" >> "$GITHUB_OUTPUT"
echo "packageStat=$packageStat" >> "$GITHUB_OUTPUT"
echo "packageLock=$packageLockChecksum" >> "$GITHUB_OUTPUT"
echo "packageLockStat=$packageLockStat" >> "$GITHUB_OUTPUT"
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
# The Gradle wrapper's version (already the default, putting it here to clarity)
gradle-version: wrapper
# Removing unused files from Gradle User Home before saving to cache (i.e. older versions of gradle)
gradle-home-cache-cleanup: false
# Cache downloaded JDKs in addition to the default directories.
gradle-home-cache-includes: |
caches
notifications
jdks
# Only write to the cache for builds on the 'main' and 'release' branches. (Default is 'main' only.)
# Builds on other branches will only read existing entries from the cache.
#cache-read-only: ${{ github.ref != 'refs/heads/main' }}
# In our setup, we have `main` as the `source of truth`, but to avoid complications we will just
# allow cache writing from any branch.
cache-read-only: false
env:
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
- name: Inspect gradle cache
id: inspect-gradle-cache
run: |
find ~/.gradle/caches/build-cache-1 -not -name "*.lock" -not -name "*.properties" -type f
ls -la ~/.gradle/caches/build-cache-1
mkdir /tmp/my-test
cd /tmp/my-test
cp ~/.gradle/caches/build-cache-1/ef4f26bcd52d876c2af6c948c6af4fa7 my.tgz
tar zxvf my.tgz
stat *.packageJson
- name: Cache pnpm packages
uses: actions/cache@v2
with:
path: |
~/.vaadin
~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml', '**/package.json') }}
- name: Archive package.json and package-lock.json (pre build)
uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
name: pre-build-package-json
path: |
package.json
package-lock.json
/tmp/my-test/*.packageJson
- name: Build with Gradle
run: ./gradlew build '-Pvaadin.productionMode' --stacktrace --debug --no-daemon --build-cache -Dorg.gradle.caching.debug=true
- name: Archive package.json and package-lock.json (post build)
uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
name: post-build-package-json
path: |
package.json
package-lock.json
- name: Post-details
id: post_details
run: |
packageChecksum=$(md5sum package.json)
packageStat=$(stat package.json | sed 's/$/\\n/' | tr -d '\n')
packageLockChecksum=$(md5sum package-lock.json || echo "File not found")
packageLockStat=$([[ -f package-lock.json ]] && stat package-lock.json | sed 's/$/\\n/' | tr -d '\n' || echo "File not found.")
echo $packageChecksum
echo "$packageStat"
echo $packageLockChecksum
echo "$packageLockStat"
echo "package=$packageChecksum" >> "$GITHUB_OUTPUT"
echo "packageStat=$packageStat" >> "$GITHUB_OUTPUT"
echo "packageLock=$packageLockChecksum" >> "$GITHUB_OUTPUT"
echo "packageLockStat=$packageLockStat" >> "$GITHUB_OUTPUT"
echo "packageLockStat=$packageLockStat" >> "$GITHUB_OUTPUT"
- name: Adding summary
run: |
echo '### Filesystem details' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo 'Workspace path:' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo '${{ github.workspace }}' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo 'Filesystem' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
fs=$(mount)
echo "$fs" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo '### Pre build details' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo 'Checksums: ' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo -e '${{ steps.pre_details.outputs.package }}' >> $GITHUB_STEP_SUMMARY
echo -e '${{ steps.pre_details.outputs.packageLock }}' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo 'File stats' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo -e '${{ steps.pre_details.outputs.packageStat }}' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo -e '${{ steps.pre_details.outputs.packageLockStat }}' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo '### Post build details' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo 'Checksums: ' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo -e '${{ steps.post_details.outputs.package }}' >> $GITHUB_STEP_SUMMARY
echo -e '${{ steps.post_details.outputs.packageLock }}' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo 'File stats' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo -e '${{ steps.post_details.outputs.packageStat }}' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo -e '${{ steps.post_details.outputs.packageLockStat }}' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY