Skip to content

Commit 1548bae

Browse files
authored
Use actions to cut down on repeated workflow code (#27486)
* Testing this out * Moving to actions * Can't do this for checkout :( * Giving these names * Collapsing more * Moving this to the right place * Moving these to the new standard ones * Updating name * Adding CodeQL * Moving last straggler over * This retry isn't buying us anything anymore, this was a github infra issue * Cleaning this one up too * Typo on this one * Size reports * Workaround not needed anymore * This needs to be done in this order * Typo in this flow * Fixing lint file * adding recursive back
1 parent 642d6dd commit 1548bae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+541
-1766
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Bootstrap cache
2+
description: Bootstrap cache
3+
runs:
4+
using: "composite"
5+
steps:
6+
- uses: Wandalen/wretry.action@v1.3.0
7+
name: Bootstrap cache
8+
continue-on-error: true
9+
with:
10+
action: buildjet/cache@v3
11+
attempt_limit: 3
12+
attempt_delay: 2000
13+
with: |
14+
key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }}
15+
path: |
16+
.environment
17+
build_overrides/pigweed_environment.gni

.github/actions/bootstrap/action.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: Bootstrap
2+
description: Bootstrap
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Bootstrap
7+
shell: bash
8+
run: bash scripts/bootstrap.sh
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Checkout submodules & Bootstrap
2+
description: Checkout submodules & Bootstrap
3+
inputs:
4+
platform:
5+
description: "Platform name"
6+
required: true
7+
extra-submodule-parameters:
8+
description: "extra submodule parameters"
9+
required: false
10+
default: ""
11+
bootstrap-log-name:
12+
description: "Bootstrap log name"
13+
required: false
14+
default: bootstrap-logs
15+
runs:
16+
using: "composite"
17+
steps:
18+
- name: Checkout submodules
19+
uses: ./.github/actions/checkout-submodules
20+
with:
21+
platform: ${{ inputs.platform }}
22+
extra-parameters: ${{ inputs.extra-submodule-parameters }}
23+
- name: Bootstrap Cache
24+
uses: ./.github/actions/bootstrap-cache
25+
- name: Bootstrap
26+
uses: ./.github/actions/bootstrap
27+
- name: Upload Bootstrap Logs
28+
uses: ./.github/actions/upload-bootstrap-logs
29+
with:
30+
platform: ${{ inputs.bootstrap-log-name }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Checkout submodules
2+
description: Checkout submodules
3+
inputs:
4+
extra-parameters:
5+
description: "extra parameters"
6+
required: false
7+
default: ""
8+
platform:
9+
description: "Platform name"
10+
required: true
11+
runs:
12+
using: "composite"
13+
steps:
14+
- name: Checkout submodules
15+
shell: bash
16+
run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform ${{ inputs.platform }} ${{ inputs.extra-parameters }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Run CodeQL Analysis
2+
description: Run and upload CodeQL Analysis
3+
inputs:
4+
language:
5+
description: "language for codeql analysis"
6+
required: true
7+
runs:
8+
using: "composite"
9+
steps:
10+
- name: Perform CodeQL Analysis
11+
if: ${{ inputs.run-codeql }}
12+
uses: github/codeql-action/analyze@v2
13+
with:
14+
category: "/language:${{ inputs.language }}"
15+
upload: False
16+
output: sarif-results
17+
- name: filter-sarif
18+
if: ${{ inputs.run-codeql }}
19+
uses: advanced-security/filter-sarif@v1
20+
with:
21+
patterns: |
22+
-**/third_party/**
23+
-**/scripts/**
24+
input: "sarif-results/${{ inputs.language }}.sarif"
25+
output: "sarif-results/${{ inputs.language }}.sarif"
26+
27+
- name: Upload SARIF
28+
if: ${{ inputs.run-codeql }}
29+
uses: github/codeql-action/upload-sarif@v2
30+
with:
31+
sarif_file: "sarif-results/${{ inputs.language }}.sarif"
32+
- name: Upload loc as a Build Artifact
33+
if: ${{ inputs.run-codeql }}
34+
uses: actions/upload-artifact@v2.2.0
35+
with:
36+
name: sarif-results
37+
path: sarif-results
38+
retention-days: 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Setup size reports
2+
description: Setup size reports
3+
inputs:
4+
gh-context:
5+
description: "GH Context"
6+
required: true
7+
8+
runs:
9+
using: "composite"
10+
steps:
11+
- name: Set up environment for size reports
12+
shell: bash
13+
env:
14+
GH_CONTEXT: ${{ inputs.gh-context }}
15+
run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Upload bootstrap logs
2+
description: Upload bootstrap logs
3+
inputs:
4+
bootstrap-log-name:
5+
description: "Bootstrap log name"
6+
required: false
7+
default: bootstrap-logs
8+
runs:
9+
using: "composite"
10+
steps:
11+
- name: Uploading bootstrap logs
12+
uses: actions/upload-artifact@v3
13+
if: ${{ always() && !env.ACT }}
14+
with:
15+
name: ${{ inputs.bootstrap-log-name }}
16+
path: |
17+
.environment/gn_out/.ninja_log
18+
.environment/pigweed-venv/*.log
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: upload-size-reports
2+
description: upload-size-reports
3+
inputs:
4+
platform-name:
5+
description: "Platform name Name"
6+
required: true
7+
8+
runs:
9+
using: "composite"
10+
steps:
11+
- name: Uploading Size Reports
12+
uses: actions/upload-artifact@v3
13+
if: ${{ !env.ACT }}
14+
with:
15+
name: Size,${{ inputs.platform-name }}-Examples,${{ env.GH_EVENT_PR }},${{ env.GH_EVENT_HASH }},${{ env.GH_EVENT_PARENT }},${{ github.event_name }}
16+
path: |
17+
/tmp/bloat_reports/

.github/workflows/bloat_check.yaml

+2-9
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,8 @@ jobs:
3636
image: connectedhomeip/chip-build:0.7.3
3737

3838
steps:
39-
- uses: Wandalen/wretry.action@v1.3.0
40-
name: Checkout
41-
with:
42-
action: actions/checkout@v3.5.2
43-
with: |
44-
token: ${{ github.token }}
45-
attempt_limit: 3
46-
attempt_delay: 2000
47-
39+
- name: Checkout
40+
uses: actions/checkout@v3
4841
- name: Report
4942
run: |
5043
scripts/tools/memory/gh_report.py \

0 commit comments

Comments
 (0)