-
Notifications
You must be signed in to change notification settings - Fork 3
[AE-158] Add Github Actions [draft] #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking βSign up for GitHubβ, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b6c2943
Add .yml files
aliphys d61aa97
Move tests into examples folder (Rule LD003)
aliphys dc9b055
Add Opta as board items
aliphys 9934b7c
Load `Arduino_POSIXStorage` library before compile
aliphys 1d4910b
Update spell check workflow
aliphys 8cd1bf4
Updated sync-labels workflow
aliphys 3382b68
Update .github/dependabot.yml
aliphys 2818806
Update .github/workflows/compile-examples.yml
aliphys File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# See: https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#about-the-dependabotyml-file | ||
version: 2 | ||
|
||
updates: | ||
# Configure check for outdated GitHub Actions actions in workflows. | ||
# See: https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-dependabot | ||
- package-ecosystem: github-actions | ||
directory: / # Check the repository's workflows under /.github/workflows/ | ||
labels: | ||
- "topic: infrastructure" | ||
schedule: | ||
interval: daily |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Check Arduino | ||
|
||
# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows | ||
on: | ||
push: | ||
pull_request: | ||
schedule: | ||
# Run every Tuesday at 8 AM UTC to catch breakage caused by new rules added to Arduino Lint. | ||
- cron: "0 8 * * TUE" | ||
workflow_dispatch: | ||
repository_dispatch: | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Arduino Lint | ||
uses: arduino/arduino-lint-action@v1 | ||
with: | ||
compliance: specification | ||
library-manager: submit | ||
# Always use this setting for official repositories. Remove for 3rd party projects. | ||
official: true | ||
project-type: library |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
# Source: https://github.com/per1234/.github/blob/main/workflow-templates/compile-examples-private.md | ||
name: Compile Examples | ||
|
||
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows | ||
on: | ||
push: | ||
paths: | ||
- ".github/workflows/compile-examples-private.ya?ml" | ||
- "library.properties" | ||
- "examples/**" | ||
- "src/**" | ||
pull_request: | ||
paths: | ||
- ".github/workflows/compile-examples-private.ya?ml" | ||
- "library.properties" | ||
- "examples/**" | ||
- "src/**" | ||
schedule: | ||
# Run every Tuesday at 8 AM UTC to catch breakage caused by changes to external resources (libraries, platforms). | ||
- cron: "0 8 * * TUE" | ||
workflow_dispatch: | ||
repository_dispatch: | ||
|
||
env: | ||
SKETCHES_REPORTS_PATH: sketches-reports | ||
SKETCHES_REPORTS_ARTIFACT_NAME: sketches-reports | ||
|
||
jobs: | ||
build: | ||
name: ${{ matrix.board.fqbn }} | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
pull-requests: read | ||
|
||
strategy: | ||
fail-fast: false | ||
|
||
matrix: | ||
board: | ||
- fqbn: arduino:mbed_portenta:envie_m7 | ||
platforms: | | ||
- name: arduino:mbed_portenta | ||
- fqbn: arduino:renesas_portenta:portenta_c33 | ||
platforms: | | ||
- name: arduino:renesas_portenta | ||
- fqbn: arduino:mbed_opta:opta | ||
platforms: | | ||
- name: arduino:mbed_opta | ||
|
||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Compile examples | ||
uses: arduino/compile-sketches@v1 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
fqbn: ${{ matrix.board.fqbn }} | ||
platforms: ${{ matrix.board.platforms }} | ||
libraries: | | ||
# Install the library from the local path. | ||
- source-path: ./ | ||
- name: Arduino_USBHostMbed5 | ||
- source-path: https://github.com/arduino-libraries/Arduino_POSIXStorage | ||
# Additional library dependencies can be listed here. | ||
# See: https://github.com/arduino/compile-sketches#libraries | ||
sketch-paths: | | ||
- examples | ||
enable-deltas-report: true | ||
sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }} | ||
|
||
- name: Save sketches report as workflow artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
if-no-files-found: error | ||
path: ${{ env.SKETCHES_REPORTS_PATH }} | ||
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }} | ||
|
||
report-size-deltas: | ||
needs: build | ||
# Run even if some compilations failed. | ||
if: always() && github.event_name == 'pull_request' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
|
||
steps: | ||
- name: Download sketches reports artifact | ||
id: download-artifact | ||
continue-on-error: true # If compilation failed for all boards then there are no artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ env.SKETCHES_REPORTS_ARTIFACT_NAME }} | ||
path: ${{ env.SKETCHES_REPORTS_PATH }} | ||
|
||
- name: Comment size deltas report to PR | ||
uses: arduino/report-size-deltas@v1 | ||
# If actions/download-artifact failed, there are no artifacts to report from. | ||
if: steps.download-artifact.outcome == 'success' | ||
with: | ||
sketches-reports-source: ${{ env.SKETCHES_REPORTS_PATH }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Source: https://github.com/per1234/.github/blob/main/workflow-templates/spell-check.md | ||
name: Spell Check | ||
aliphys marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows | ||
on: | ||
push: | ||
pull_request: | ||
schedule: | ||
# Run every Tuesday at 8 AM UTC to catch new misspelling detections resulting from dictionary updates. | ||
- cron: "0 8 * * TUE" | ||
workflow_dispatch: | ||
repository_dispatch: | ||
|
||
jobs: | ||
spellcheck: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Spell check | ||
uses: codespell-project/actions-codespell@v2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/sync-labels.md | ||
aliphys marked this conversation as resolved.
Show resolved
Hide resolved
|
||
name: Sync Labels | ||
|
||
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows | ||
on: | ||
push: | ||
paths: | ||
- ".github/workflows/sync-labels.ya?ml" | ||
- ".github/label-configuration-files/*.ya?ml" | ||
pull_request: | ||
paths: | ||
- ".github/workflows/sync-labels.ya?ml" | ||
- ".github/label-configuration-files/*.ya?ml" | ||
schedule: | ||
# Run daily at 8 AM UTC to sync with changes to shared label configurations. | ||
- cron: "0 8 * * *" | ||
workflow_dispatch: | ||
repository_dispatch: | ||
|
||
env: | ||
CONFIGURATIONS_FOLDER: .github/label-configuration-files | ||
CONFIGURATIONS_ARTIFACT: label-configuration-files | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Download JSON schema for labels configuration file | ||
id: download-schema | ||
uses: carlosperate/download-file-action@v2 | ||
with: | ||
file-url: https://raw.githubusercontent.com/arduino/tooling-project-assets/main/workflow-templates/assets/sync-labels/arduino-tooling-gh-label-configuration-schema.json | ||
location: ${{ runner.temp }}/label-configuration-schema | ||
|
||
- name: Install JSON schema validator | ||
run: | | ||
sudo npm install \ | ||
--global \ | ||
ajv-cli \ | ||
ajv-formats | ||
|
||
- name: Validate local labels configuration | ||
run: | | ||
# See: https://github.com/ajv-validator/ajv-cli#readme | ||
ajv validate \ | ||
--all-errors \ | ||
-c ajv-formats \ | ||
-s "${{ steps.download-schema.outputs.file-path }}" \ | ||
-d "${{ env.CONFIGURATIONS_FOLDER }}/*.{yml,yaml}" | ||
|
||
download: | ||
needs: check | ||
runs-on: ubuntu-latest | ||
permissions: {} | ||
|
||
strategy: | ||
matrix: | ||
filename: | ||
# Filenames of the shared configurations to apply to the repository in addition to the local configuration. | ||
# https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/sync-labels | ||
- universal.yml | ||
|
||
steps: | ||
- name: Download | ||
uses: carlosperate/download-file-action@v2 | ||
with: | ||
file-url: https://raw.githubusercontent.com/arduino/tooling-project-assets/main/workflow-templates/assets/sync-labels/${{ matrix.filename }} | ||
|
||
- name: Pass configuration files to next job via workflow artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
path: | | ||
*.yaml | ||
*.yml | ||
if-no-files-found: error | ||
name: ${{ env.CONFIGURATIONS_ARTIFACT }} | ||
|
||
sync: | ||
needs: download | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
issues: write | ||
|
||
steps: | ||
- name: Set environment variables | ||
run: | | ||
# See: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable | ||
echo "MERGED_CONFIGURATION_PATH=${{ runner.temp }}/labels.yml" >> "$GITHUB_ENV" | ||
|
||
- name: Determine whether to dry run | ||
id: dry-run | ||
if: > | ||
github.event_name == 'pull_request' || | ||
( | ||
( | ||
github.event_name == 'push' || | ||
github.event_name == 'workflow_dispatch' | ||
) && | ||
github.ref != format('refs/heads/{0}', github.event.repository.default_branch) | ||
) | ||
run: | | ||
# Use of this flag in the github-label-sync command will cause it to only check the validity of the | ||
# configuration. | ||
echo "flag=--dry-run" >> $GITHUB_OUTPUT | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Download configuration files artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ env.CONFIGURATIONS_ARTIFACT }} | ||
path: ${{ env.CONFIGURATIONS_FOLDER }} | ||
|
||
- name: Remove unneeded artifact | ||
uses: geekyeggo/delete-artifact@v2 | ||
with: | ||
name: ${{ env.CONFIGURATIONS_ARTIFACT }} | ||
|
||
- name: Merge label configuration files | ||
run: | | ||
# Merge all configuration files | ||
shopt -s extglob | ||
cat "${{ env.CONFIGURATIONS_FOLDER }}"/*.@(yml|yaml) > "${{ env.MERGED_CONFIGURATION_PATH }}" | ||
|
||
- name: Install github-label-sync | ||
run: sudo npm install --global github-label-sync | ||
|
||
- name: Sync labels | ||
env: | ||
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
# See: https://github.com/Financial-Times/github-label-sync | ||
github-label-sync \ | ||
--labels "${{ env.MERGED_CONFIGURATION_PATH }}" \ | ||
${{ steps.dry-run.outputs.flag }} \ | ||
${{ github.repository }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
<<<<<<< Updated upstream | ||
arduino-cli compile -b arduino:renesas_portenta:portenta_c33 --library "../../Arduino_POSIXStorage" --library "/home/c.dragomir/ArduinoWorkspace/Arduino_UnifiedStorage" | ||
======= | ||
arduino-cli compile -b arduino:renesas_portenta:portenta_c33 --library "/home/c.dragomir/ArduinoWorkspace/Repos/POSIXStorage" --library "/home/c.dragomir/ArduinoWorkspace/Repos/Arduino_UnifiedStorage" | ||
>>>>>>> Stashed changes | ||
arduino-cli upload -b arduino:renesas_portenta:portenta_c33 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
<<<<<<< Updated upstream | ||
arduino-cli compile -b arduino:mbed_portenta:envie_m7 --library "../../Arduino_POSIXStorage" --library "/home/c.dragomir/ArduinoWorkspace/Arduino_UnifiedStorage" | ||
arduino-cli upload -b arduino:mbed_portenta:envie_m7 | ||
======= | ||
arduino-cli compile -b arduino:mbed_portenta:envie_m7 --library "../../../POSIXStorage" --library "../../../Arduino_UnifiedStorage" | ||
|
||
>>>>>>> Stashed changes |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.