Skip to content

Commit 1e9f6a9

Browse files
committed
Revert "Remove checks that are stalled"
This reverts commit b2d8501.
1 parent b2d8501 commit 1e9f6a9

File tree

3 files changed

+174
-0
lines changed

3 files changed

+174
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: API compatibility verification
2+
3+
on:
4+
pull_request:
5+
types: [ opened, synchronize, reopened, labeled, unlabeled ]
6+
branches: [ main ]
7+
8+
jobs:
9+
api-compat-verification:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Check for API compatibility
14+
if: ${{ !contains(github.event.pull_request.labels.*.name, 'acknowledge-api-break') }}
15+
run: |
16+
git fetch origin ${{ github.base_ref }} --depth 1 && \
17+
git diff remotes/origin/${{ github.base_ref }} --numstat "*.api" | awk '
18+
BEGIN { s = 0 }
19+
20+
# git diff numstat shows lines deleted in field 2, hence sum up field 2 across all items
21+
{ s += $2 }
22+
23+
# exit with the number of lines deleted as the result code so that `if failure()` works below
24+
END { exit s }
25+
'
26+
- name: Error message
27+
if: ${{ failure() }}
28+
run: |
29+
echo "::error ::This change modifies the public API in a way that may be backwards-incompatible. Carefully review this pull request and either:"
30+
echo "::error ::* Revert the changes which caused the API incompatibility –or–"
31+
echo "::error ::* Add the 'acknowledge-api-break' label to this PR (in rare cases warranting an API breakage)"
32+
exit 1
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
name: Artifact Size Metrics
2+
on:
3+
pull_request:
4+
types: [ opened, synchronize, reopened, labeled, unlabeled ]
5+
branches: [ main ]
6+
release:
7+
types: [published]
8+
9+
permissions:
10+
id-token: write
11+
contents: read
12+
pull-requests: write
13+
14+
jobs:
15+
release-metrics:
16+
if: github.event_name == 'release'
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout Sources
20+
uses: actions/checkout@v4
21+
- name: Configure JDK
22+
uses: actions/setup-java@v3
23+
with:
24+
distribution: 'corretto'
25+
java-version: 17
26+
cache: 'gradle'
27+
- name: Configure AWS Credentials
28+
uses: aws-actions/configure-aws-credentials@v4
29+
with:
30+
role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }}
31+
aws-region: us-west-2
32+
- name: Generate Artifact Size Metrics
33+
run: ./gradlew artifactSizeMetrics
34+
- name: Save Artifact Size Metrics
35+
run: ./gradlew saveArtifactSizeMetrics -Prelease=${{ github.event.release.tag_name }}
36+
- name: Put Artifact Size Metrics in CloudWatch
37+
run: ./gradlew putArtifactSizeMetricsInCloudWatch -Prelease=${{ github.event.release.tag_name }}
38+
size-check:
39+
if: github.event_name == 'pull_request'
40+
runs-on: ubuntu-latest
41+
steps:
42+
- name: Checkout Sources
43+
uses: actions/checkout@v4
44+
- name: Configure JDK
45+
uses: actions/setup-java@v3
46+
with:
47+
distribution: 'corretto'
48+
java-version: 17
49+
cache: 'gradle'
50+
- name: Configure AWS Credentials
51+
uses: aws-actions/configure-aws-credentials@v4
52+
with:
53+
role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }}
54+
aws-region: us-west-2
55+
- name: Generate Artifact Size Metrics
56+
run: ./gradlew artifactSizeMetrics
57+
- name: Analyze Artifact Size Metrics
58+
run: ./gradlew analyzeArtifactSizeMetrics
59+
- name: Show Results
60+
uses: actions/github-script@v7
61+
with:
62+
script: |
63+
const getComments =
64+
`query {
65+
repository(owner:"${context.repo.owner}", name:"${context.repo.repo}"){
66+
pullRequest(number: ${context.issue.number}) {
67+
id
68+
comments(last:100) {
69+
nodes {
70+
id
71+
body
72+
author {
73+
login
74+
}
75+
isMinimized
76+
}
77+
}
78+
}
79+
}
80+
}`
81+
82+
const response = await github.graphql(getComments)
83+
const comments = response.repository.pullRequest.comments.nodes
84+
85+
const mutations = comments
86+
.filter(comment => comment.author.login == 'github-actions' && !comment.isMinimized && comment.body.startsWith('Affected Artifacts'))
87+
.map(comment =>
88+
github.graphql(
89+
`mutation {
90+
minimizeComment(input:{subjectId:"${comment.id}", classifier:OUTDATED}){
91+
clientMutationId
92+
}
93+
}`
94+
)
95+
)
96+
await Promise.all(mutations)
97+
98+
const fs = require('node:fs')
99+
const comment = fs.readFileSync('build/reports/metrics/artifact-analysis.md', 'utf8')
100+
101+
const writeComment =
102+
`mutation {
103+
addComment(input:{body:"""${comment}""", subjectId:"${response.repository.pullRequest.id}"}){
104+
clientMutationId
105+
}
106+
}`
107+
108+
await github.graphql(writeComment)
109+
110+
- name: Evaluate
111+
if: ${{ !contains(github.event.pull_request.labels.*.name, 'acknowledge-artifact-size-increase') }}
112+
run: |
113+
cd build/reports/metrics
114+
cat has-significant-change.txt | grep false || {
115+
echo An artifact increased in size by more than allowed or a new artifact was created.
116+
echo If this is expected please add the 'acknowledge-artifact-size-increase' label to this pull request.
117+
exit 1
118+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Changelog verification
2+
3+
on:
4+
pull_request:
5+
types: [ opened, synchronize, reopened, labeled, unlabeled ]
6+
branches: [ main ]
7+
8+
jobs:
9+
changelog-verification:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Check for changelog entry
14+
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-changelog') }}
15+
run: |
16+
git fetch origin ${{ github.base_ref }} --depth 1 && \
17+
git diff remotes/origin/${{ github.base_ref }} --name-only | grep -P "\.changes/[0-9a-f-]+\.json"
18+
- name: Error message
19+
if: ${{ failure() }}
20+
run: |
21+
echo "::error ::No new/updated changelog entry found in /.changes directory. Please either:"
22+
echo "::error ::* Add a changelog entry (see CONTRIBUTING.md for instructions) –or–"
23+
echo "::error ::* Add the 'no-changelog' label to this PR (in rare cases not warranting a changelog entry)"
24+
exit 1

0 commit comments

Comments
 (0)