Skip to content

Commit f556191

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

File tree

3 files changed

+64
-6
lines changed

3 files changed

+64
-6
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

+53-4
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ name: Pre-commit check
22

33
on:
44
pull_request:
5-
types: [opened, reopened, synchronize, labeled]
5+
types: [opened, synchronize, reopened, labeled]
6+
7+
concurrency:
8+
group: pre-commit-${{github.event.pull_request.number || github.ref}}
9+
cancel-in-progress: true
610

711
jobs:
812
lint:
9-
if: |
10-
contains(github.event.pull_request.labels.*.name, 'Status: Pending Merge')
11-
name: Checking if any fixes are needed
13+
if: always()
14+
#if: ${{ always() && contains(github.event.pull_request.labels.*.name, 'Status: Pending Merge') }}
15+
name: Run pre-commit hooks
1216
runs-on: ubuntu-latest
1317
steps:
1418
- name: Checkout latest commit
@@ -35,6 +39,51 @@ jobs:
3539
~/.cache/pip
3640
key: pre-commit|${{ env.PY_HASH }}|${{ hashFiles('.pre-commit-config.yaml', '.github/workflows/pre-commit.yml') }}
3741

42+
- name: Wait for other jobs to finish
43+
uses: lewagon/[email protected]
44+
with:
45+
ref: ${{ github.event.pull_request.head.sha }}
46+
repo-token: ${{ secrets.GITHUB_TOKEN }}
47+
wait-interval: 30
48+
check-regexp: '^Arduino [0-9]+ on ubuntu-latest$'
49+
50+
- name: Get workflow id
51+
id: save-workflow-id
52+
run: |
53+
echo "Original repo: ${{ github.event.pull_request.head.repo.full_name }}"
54+
RUNID=$(gh api repos/${{ github.event.pull_request.head.repo.full_name }}/commits/${{ github.event.pull_request.head.sha }}/check-runs | \
55+
jq -r '.check_runs[] | \
56+
select(.name == "Arduino 0 on ubuntu-latest") | |
57+
.html_url | \
58+
capture("/runs/(?<number>[0-9]+)/job") | \
59+
.number' | \
60+
sed 's/"//g' | \
61+
head -n 1)
62+
echo "RUNID=$RUNID" >> $GITHUB_ENV
63+
echo "Workflow id: $RUNID"
64+
65+
- name: Download compilation artifacts
66+
uses: actions/download-artifact@v4
67+
if: ${{ env.RUNID != '' }}
68+
with:
69+
pattern: build-job-*
70+
merge-multiple: true
71+
path: ~/.arduino/tests/
72+
run-id: ${{ env.RUNID }}
73+
github-token: ${{ secrets.GITHUB_TOKEN }}
74+
75+
- name: Merge compile commands
76+
if: ${{ env.RUNID != '' }}
77+
run: |
78+
find ~/.arduino/tests/ -iname "compile_commands.json" | xargs jq -s 'map(.[])' > ~/compile_commands.json
79+
80+
- name: Upload compile commands
81+
if: ${{ env.RUNID != '' }}
82+
uses: actions/upload-artifact@v4
83+
with:
84+
name: compile_commands
85+
path: ~/compile_commands.json
86+
3887
- name: Install python dependencies
3988
run: python -m pip install pre-commit docutils
4089

.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)