Skip to content

Commit

Permalink
Use actions to cut down on repeated workflow code (#27486)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
woody-apple authored and pull[bot] committed Jul 20, 2023
1 parent b567dee commit 4197768
Show file tree
Hide file tree
Showing 49 changed files with 541 additions and 1,766 deletions.
17 changes: 17 additions & 0 deletions .github/actions/bootstrap-cache/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Bootstrap cache
description: Bootstrap cache
runs:
using: "composite"
steps:
- uses: Wandalen/wretry.action@v1.3.0
name: Bootstrap cache
continue-on-error: true
with:
action: buildjet/cache@v3
attempt_limit: 3
attempt_delay: 2000
with: |
key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }}
path: |
.environment
build_overrides/pigweed_environment.gni
8 changes: 8 additions & 0 deletions .github/actions/bootstrap/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: Bootstrap
description: Bootstrap
runs:
using: "composite"
steps:
- name: Bootstrap
shell: bash
run: bash scripts/bootstrap.sh
30 changes: 30 additions & 0 deletions .github/actions/checkout-submodules-and-bootstrap/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Checkout submodules & Bootstrap
description: Checkout submodules & Bootstrap
inputs:
platform:
description: "Platform name"
required: true
extra-submodule-parameters:
description: "extra submodule parameters"
required: false
default: ""
bootstrap-log-name:
description: "Bootstrap log name"
required: false
default: bootstrap-logs
runs:
using: "composite"
steps:
- name: Checkout submodules
uses: ./.github/actions/checkout-submodules
with:
platform: ${{ inputs.platform }}
extra-parameters: ${{ inputs.extra-submodule-parameters }}
- name: Bootstrap Cache
uses: ./.github/actions/bootstrap-cache
- name: Bootstrap
uses: ./.github/actions/bootstrap
- name: Upload Bootstrap Logs
uses: ./.github/actions/upload-bootstrap-logs
with:
platform: ${{ inputs.bootstrap-log-name }}
16 changes: 16 additions & 0 deletions .github/actions/checkout-submodules/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Checkout submodules
description: Checkout submodules
inputs:
extra-parameters:
description: "extra parameters"
required: false
default: ""
platform:
description: "Platform name"
required: true
runs:
using: "composite"
steps:
- name: Checkout submodules
shell: bash
run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform ${{ inputs.platform }} ${{ inputs.extra-parameters }}
38 changes: 38 additions & 0 deletions .github/actions/perform-codeql-analysis/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Run CodeQL Analysis
description: Run and upload CodeQL Analysis
inputs:
language:
description: "language for codeql analysis"
required: true
runs:
using: "composite"
steps:
- name: Perform CodeQL Analysis
if: ${{ inputs.run-codeql }}
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{ inputs.language }}"
upload: False
output: sarif-results
- name: filter-sarif
if: ${{ inputs.run-codeql }}
uses: advanced-security/filter-sarif@v1
with:
patterns: |
-**/third_party/**
-**/scripts/**
input: "sarif-results/${{ inputs.language }}.sarif"
output: "sarif-results/${{ inputs.language }}.sarif"

- name: Upload SARIF
if: ${{ inputs.run-codeql }}
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: "sarif-results/${{ inputs.language }}.sarif"
- name: Upload loc as a Build Artifact
if: ${{ inputs.run-codeql }}
uses: actions/upload-artifact@v2.2.0
with:
name: sarif-results
path: sarif-results
retention-days: 1
15 changes: 15 additions & 0 deletions .github/actions/setup-size-reports/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Setup size reports
description: Setup size reports
inputs:
gh-context:
description: "GH Context"
required: true

runs:
using: "composite"
steps:
- name: Set up environment for size reports
shell: bash
env:
GH_CONTEXT: ${{ inputs.gh-context }}
run: scripts/tools/memory/gh_sizes_environment.py "${GH_CONTEXT}"
18 changes: 18 additions & 0 deletions .github/actions/upload-bootstrap-logs/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Upload bootstrap logs
description: Upload bootstrap logs
inputs:
bootstrap-log-name:
description: "Bootstrap log name"
required: false
default: bootstrap-logs
runs:
using: "composite"
steps:
- name: Uploading bootstrap logs
uses: actions/upload-artifact@v3
if: ${{ always() && !env.ACT }}
with:
name: ${{ inputs.bootstrap-log-name }}
path: |
.environment/gn_out/.ninja_log
.environment/pigweed-venv/*.log
17 changes: 17 additions & 0 deletions .github/actions/upload-size-reports/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: upload-size-reports
description: upload-size-reports
inputs:
platform-name:
description: "Platform name Name"
required: true

runs:
using: "composite"
steps:
- name: Uploading Size Reports
uses: actions/upload-artifact@v3
if: ${{ !env.ACT }}
with:
name: Size,${{ inputs.platform-name }}-Examples,${{ env.GH_EVENT_PR }},${{ env.GH_EVENT_HASH }},${{ env.GH_EVENT_PARENT }},${{ github.event_name }}
path: |
/tmp/bloat_reports/
11 changes: 2 additions & 9 deletions .github/workflows/bloat_check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,8 @@ jobs:
image: connectedhomeip/chip-build:0.7.3

steps:
- uses: Wandalen/wretry.action@v1.3.0
name: Checkout
with:
action: actions/checkout@v3.5.2
with: |
token: ${{ github.token }}
attempt_limit: 3
attempt_delay: 2000

- name: Checkout
uses: actions/checkout@v3
- name: Report
run: |
scripts/tools/memory/gh_report.py \
Expand Down
Loading

0 comments on commit 4197768

Please sign in to comment.