Skip to content

Commit b43fa3f

Browse files
Merge pull request #4 from arduino-libraries/aliphys/AddGHActions
[AE-158] Add Github Actions [draft]
2 parents cd08ac3 + 2818806 commit b43fa3f

File tree

8 files changed

+909
-0
lines changed

8 files changed

+909
-0
lines changed

Diff for: .github/dependabot.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# See: https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#about-the-dependabotyml-file
2+
version: 2
3+
4+
updates:
5+
# Configure check for outdated GitHub Actions actions in workflows.
6+
# See: https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-dependabot
7+
- package-ecosystem: github-actions
8+
directory: / # Check the repository's workflows under /.github/workflows/
9+
labels:
10+
- "topic: infrastructure"
11+
schedule:
12+
interval: daily

Diff for: .github/workflows/check-arduino.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Check Arduino
2+
3+
# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows
4+
on:
5+
push:
6+
pull_request:
7+
schedule:
8+
# Run every Tuesday at 8 AM UTC to catch breakage caused by new rules added to Arduino Lint.
9+
- cron: "0 8 * * TUE"
10+
workflow_dispatch:
11+
repository_dispatch:
12+
13+
jobs:
14+
lint:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v3
20+
21+
- name: Arduino Lint
22+
uses: arduino/arduino-lint-action@v1
23+
with:
24+
compliance: specification
25+
library-manager: submit
26+
# Always use this setting for official repositories. Remove for 3rd party projects.
27+
official: true
28+
project-type: library

Diff for: .github/workflows/compile-examples.yml

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Source: https://github.com/per1234/.github/blob/main/workflow-templates/compile-examples-private.md
2+
name: Compile Examples
3+
4+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
5+
on:
6+
push:
7+
paths:
8+
- ".github/workflows/compile-examples-private.ya?ml"
9+
- "library.properties"
10+
- "examples/**"
11+
- "src/**"
12+
pull_request:
13+
paths:
14+
- ".github/workflows/compile-examples-private.ya?ml"
15+
- "library.properties"
16+
- "examples/**"
17+
- "src/**"
18+
schedule:
19+
# Run every Tuesday at 8 AM UTC to catch breakage caused by changes to external resources (libraries, platforms).
20+
- cron: "0 8 * * TUE"
21+
workflow_dispatch:
22+
repository_dispatch:
23+
24+
env:
25+
SKETCHES_REPORTS_PATH: sketches-reports
26+
SKETCHES_REPORTS_ARTIFACT_NAME: sketches-reports
27+
28+
jobs:
29+
build:
30+
name: ${{ matrix.board.fqbn }}
31+
runs-on: ubuntu-latest
32+
permissions:
33+
contents: read
34+
pull-requests: read
35+
36+
strategy:
37+
fail-fast: false
38+
39+
matrix:
40+
board:
41+
- fqbn: arduino:mbed_portenta:envie_m7
42+
platforms: |
43+
- name: arduino:mbed_portenta
44+
- fqbn: arduino:renesas_portenta:portenta_c33
45+
platforms: |
46+
- name: arduino:renesas_portenta
47+
- fqbn: arduino:mbed_opta:opta
48+
platforms: |
49+
- name: arduino:mbed_opta
50+
51+
52+
steps:
53+
- name: Checkout repository
54+
uses: actions/checkout@v3
55+
56+
- name: Compile examples
57+
uses: arduino/compile-sketches@v1
58+
with:
59+
github-token: ${{ secrets.GITHUB_TOKEN }}
60+
fqbn: ${{ matrix.board.fqbn }}
61+
platforms: ${{ matrix.board.platforms }}
62+
libraries: |
63+
# Install the library from the local path.
64+
- source-path: ./
65+
- name: Arduino_USBHostMbed5
66+
- source-path: https://github.com/arduino-libraries/Arduino_POSIXStorage
67+
# Additional library dependencies can be listed here.
68+
# See: https://github.com/arduino/compile-sketches#libraries
69+
sketch-paths: |
70+
- examples
71+
enable-deltas-report: true
72+
sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }}
73+
74+
- name: Save sketches report as workflow artifact
75+
uses: actions/upload-artifact@v3
76+
with:
77+
if-no-files-found: error
78+
path: ${{ env.SKETCHES_REPORTS_PATH }}
79+
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}
80+
81+
report-size-deltas:
82+
needs: build
83+
# Run even if some compilations failed.
84+
if: always() && github.event_name == 'pull_request'
85+
runs-on: ubuntu-latest
86+
permissions:
87+
pull-requests: write
88+
89+
steps:
90+
- name: Download sketches reports artifact
91+
id: download-artifact
92+
continue-on-error: true # If compilation failed for all boards then there are no artifacts
93+
uses: actions/download-artifact@v3
94+
with:
95+
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }}
96+
path: ${{ env.SKETCHES_REPORTS_PATH }}
97+
98+
- name: Comment size deltas report to PR
99+
uses: arduino/report-size-deltas@v1
100+
# If actions/download-artifact failed, there are no artifacts to report from.
101+
if: steps.download-artifact.outcome == 'success'
102+
with:
103+
sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }}

Diff for: .github/workflows/spell-check.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Source: https://github.com/per1234/.github/blob/main/workflow-templates/spell-check.md
2+
name: Spell Check
3+
4+
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
5+
on:
6+
push:
7+
pull_request:
8+
schedule:
9+
# Run every Tuesday at 8 AM UTC to catch new misspelling detections resulting from dictionary updates.
10+
- cron: "0 8 * * TUE"
11+
workflow_dispatch:
12+
repository_dispatch:
13+
14+
jobs:
15+
spellcheck:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v3
23+
24+
- name: Spell check
25+
uses: codespell-project/actions-codespell@v2

Diff for: .github/workflows/sync-labels.yml

+144
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/sync-labels.md
2+
name: Sync Labels
3+
4+
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
5+
on:
6+
push:
7+
paths:
8+
- ".github/workflows/sync-labels.ya?ml"
9+
- ".github/label-configuration-files/*.ya?ml"
10+
pull_request:
11+
paths:
12+
- ".github/workflows/sync-labels.ya?ml"
13+
- ".github/label-configuration-files/*.ya?ml"
14+
schedule:
15+
# Run daily at 8 AM UTC to sync with changes to shared label configurations.
16+
- cron: "0 8 * * *"
17+
workflow_dispatch:
18+
repository_dispatch:
19+
20+
env:
21+
CONFIGURATIONS_FOLDER: .github/label-configuration-files
22+
CONFIGURATIONS_ARTIFACT: label-configuration-files
23+
24+
jobs:
25+
check:
26+
runs-on: ubuntu-latest
27+
permissions:
28+
contents: read
29+
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v3
33+
34+
- name: Download JSON schema for labels configuration file
35+
id: download-schema
36+
uses: carlosperate/download-file-action@v2
37+
with:
38+
file-url: https://raw.githubusercontent.com/arduino/tooling-project-assets/main/workflow-templates/assets/sync-labels/arduino-tooling-gh-label-configuration-schema.json
39+
location: ${{ runner.temp }}/label-configuration-schema
40+
41+
- name: Install JSON schema validator
42+
run: |
43+
sudo npm install \
44+
--global \
45+
ajv-cli \
46+
ajv-formats
47+
48+
- name: Validate local labels configuration
49+
run: |
50+
# See: https://github.com/ajv-validator/ajv-cli#readme
51+
ajv validate \
52+
--all-errors \
53+
-c ajv-formats \
54+
-s "${{ steps.download-schema.outputs.file-path }}" \
55+
-d "${{ env.CONFIGURATIONS_FOLDER }}/*.{yml,yaml}"
56+
57+
download:
58+
needs: check
59+
runs-on: ubuntu-latest
60+
permissions: {}
61+
62+
strategy:
63+
matrix:
64+
filename:
65+
# Filenames of the shared configurations to apply to the repository in addition to the local configuration.
66+
# https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/sync-labels
67+
- universal.yml
68+
69+
steps:
70+
- name: Download
71+
uses: carlosperate/download-file-action@v2
72+
with:
73+
file-url: https://raw.githubusercontent.com/arduino/tooling-project-assets/main/workflow-templates/assets/sync-labels/${{ matrix.filename }}
74+
75+
- name: Pass configuration files to next job via workflow artifact
76+
uses: actions/upload-artifact@v3
77+
with:
78+
path: |
79+
*.yaml
80+
*.yml
81+
if-no-files-found: error
82+
name: ${{ env.CONFIGURATIONS_ARTIFACT }}
83+
84+
sync:
85+
needs: download
86+
runs-on: ubuntu-latest
87+
permissions:
88+
contents: read
89+
issues: write
90+
91+
steps:
92+
- name: Set environment variables
93+
run: |
94+
# See: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable
95+
echo "MERGED_CONFIGURATION_PATH=${{ runner.temp }}/labels.yml" >> "$GITHUB_ENV"
96+
97+
- name: Determine whether to dry run
98+
id: dry-run
99+
if: >
100+
github.event_name == 'pull_request' ||
101+
(
102+
(
103+
github.event_name == 'push' ||
104+
github.event_name == 'workflow_dispatch'
105+
) &&
106+
github.ref != format('refs/heads/{0}', github.event.repository.default_branch)
107+
)
108+
run: |
109+
# Use of this flag in the github-label-sync command will cause it to only check the validity of the
110+
# configuration.
111+
echo "flag=--dry-run" >> $GITHUB_OUTPUT
112+
113+
- name: Checkout repository
114+
uses: actions/checkout@v3
115+
116+
- name: Download configuration files artifact
117+
uses: actions/download-artifact@v3
118+
with:
119+
name: ${{ env.CONFIGURATIONS_ARTIFACT }}
120+
path: ${{ env.CONFIGURATIONS_FOLDER }}
121+
122+
- name: Remove unneeded artifact
123+
uses: geekyeggo/delete-artifact@v2
124+
with:
125+
name: ${{ env.CONFIGURATIONS_ARTIFACT }}
126+
127+
- name: Merge label configuration files
128+
run: |
129+
# Merge all configuration files
130+
shopt -s extglob
131+
cat "${{ env.CONFIGURATIONS_FOLDER }}"/*.@(yml|yaml) > "${{ env.MERGED_CONFIGURATION_PATH }}"
132+
133+
- name: Install github-label-sync
134+
run: sudo npm install --global github-label-sync
135+
136+
- name: Sync labels
137+
env:
138+
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
139+
run: |
140+
# See: https://github.com/Financial-Times/github-label-sync
141+
github-label-sync \
142+
--labels "${{ env.MERGED_CONFIGURATION_PATH }}" \
143+
${{ steps.dry-run.outputs.flag }} \
144+
${{ github.repository }}

Diff for: examples/tests/test_qspi_usb_sd/test_c33

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
<<<<<<< Updated upstream
3+
arduino-cli compile -b arduino:renesas_portenta:portenta_c33 --library "../../Arduino_POSIXStorage" --library "/home/c.dragomir/ArduinoWorkspace/Arduino_UnifiedStorage"
4+
=======
5+
arduino-cli compile -b arduino:renesas_portenta:portenta_c33 --library "/home/c.dragomir/ArduinoWorkspace/Repos/POSIXStorage" --library "/home/c.dragomir/ArduinoWorkspace/Repos/Arduino_UnifiedStorage"
6+
>>>>>>> Stashed changes
7+
arduino-cli upload -b arduino:renesas_portenta:portenta_c33

Diff for: examples/tests/test_qspi_usb_sd/test_h7

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
<<<<<<< Updated upstream
3+
arduino-cli compile -b arduino:mbed_portenta:envie_m7 --library "../../Arduino_POSIXStorage" --library "/home/c.dragomir/ArduinoWorkspace/Arduino_UnifiedStorage"
4+
arduino-cli upload -b arduino:mbed_portenta:envie_m7
5+
=======
6+
arduino-cli compile -b arduino:mbed_portenta:envie_m7 --library "../../../POSIXStorage" --library "../../../Arduino_UnifiedStorage"
7+
8+
>>>>>>> Stashed changes

0 commit comments

Comments
 (0)