Skip to content

Commit 1febffe

Browse files
committed
Test artifact creation
Fix workflow trigger Always run Change name
1 parent 7bb7270 commit 1febffe

File tree

3 files changed

+56
-5
lines changed

3 files changed

+56
-5
lines changed

.github/scripts/on-push.sh

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
set -e
44

5-
export ARDUINO_BUILD_DIR="$HOME/.arduino/build.tmp"
6-
75
function build(){
86
local target=$1
97
local fqbn=$2

.github/workflows/pre-commit.yml

+45-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,34 @@
11
name: Pre-commit check
22

33
on:
4+
workflow_dispatch:
45
pull_request:
56
types: [opened, reopened, synchronize, labeled]
7+
workflow_run:
8+
workflows: ["ESP32 Arduino CI"]
9+
types: [completed]
10+
11+
concurrency:
12+
group: pre-commit-${{github.event.pull_request.number || github.ref}}
13+
cancel-in-progress: true
614

715
jobs:
16+
save-workflow-id:
17+
if: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' }}
18+
name: Save compilation workflow ID
19+
runs-on: ubuntu-latest
20+
outputs:
21+
workflow_id: ${{ steps.save-workflow-id.outputs.workflow_id }}
22+
steps:
23+
- name: Save workflow ID
24+
id: save-workflow-id
25+
run: echo "workflow_id=${{ github.event.workflow_run.id }}" >> $GITHUB_OUTPUT
26+
827
lint:
9-
if: |
10-
contains(github.event.pull_request.labels.*.name, 'Status: Pending Merge')
11-
name: Checking if any fixes are needed
28+
if: always()
29+
#if: ${{ always() && contains(github.event.pull_request.labels.*.name, 'Status: Pending Merge') }}
30+
needs: save-workflow-id
31+
name: Run pre-commit hooks
1232
runs-on: ubuntu-latest
1333
steps:
1434
- name: Checkout latest commit
@@ -35,6 +55,28 @@ jobs:
3555
~/.cache/pip
3656
key: pre-commit|${{ env.PY_HASH }}|${{ hashFiles('.pre-commit-config.yaml', '.github/workflows/pre-commit.yml') }}
3757

58+
- name: Download compilation artifacts
59+
uses: actions/download-artifact@v4
60+
if: ${{ needs.save-workflow-id.outputs.workflow_id != '' }}
61+
with:
62+
pattern: build-job-*
63+
merge-multiple: true
64+
path: ~/.arduino/tests/
65+
run-id: ${{ needs.save-workflow-id.outputs.workflow_id }}
66+
github-token: ${{ secrets.GITHUB_TOKEN }}
67+
68+
- name: Merge compile commands
69+
if: ${{ needs.save-workflow-id.outputs.workflow_id != '' }}
70+
run: |
71+
find ~/.arduino/tests/ -iname "compile_commands.json" | xargs jq -s 'map(.[])' > ~/compile_commands.json
72+
73+
- name: Upload compile commands
74+
if: ${{ needs.save-workflow-id.outputs.workflow_id != '' }}
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: compile_commands
78+
path: ~/compile_commands.json
79+
3880
- name: Install python dependencies
3981
run: python -m pip install pre-commit docutils
4082

.github/workflows/push.yml

+11
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,17 @@ jobs:
4848
- name: Build Sketches
4949
run: bash ./.github/scripts/on-push.sh ${{ matrix.chunk }} 15
5050

51+
- name: Upload artifact
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: build-job-${{ matrix.chunk }}
55+
path: |
56+
~/.arduino/tests/**/*.h
57+
~/.arduino/tests/**/*.cpp
58+
~/.arduino/tests/**/*.bin
59+
~/.arduino/tests/**/compile_commands.json
60+
if-no-files-found: error
61+
5162
# Windows and MacOS
5263
build-arduino-win-mac:
5364
name: Arduino on ${{ matrix.os }}

0 commit comments

Comments
 (0)