Skip to content

Commit

Permalink
Merge pull request #291 from per1234/update-infra
Browse files Browse the repository at this point in the history
Sync infrastructure assets from upstream "templates"
  • Loading branch information
per1234 authored Jun 13, 2024
2 parents 9cbdcb8 + bc8c3bd commit abab3f2
Show file tree
Hide file tree
Showing 16 changed files with 142 additions and 69 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/check-action-metadata-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ on:
jobs:
run-determination:
runs-on: ubuntu-latest
permissions: {}
outputs:
result: ${{ steps.determination.outputs.result }}
steps:
Expand All @@ -56,6 +57,8 @@ jobs:
needs: run-determination
if: needs.run-determination.outputs.result == 'true'
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout repository
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/check-files-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
jobs:
run-determination:
runs-on: ubuntu-latest
permissions: {}
outputs:
result: ${{ steps.determination.outputs.result }}
steps:
Expand All @@ -40,6 +41,8 @@ jobs:
needs: run-determination
if: needs.run-determination.outputs.result == 'true'
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout repository
Expand All @@ -58,6 +61,8 @@ jobs:
needs: run-determination
if: needs.run-determination.outputs.result == 'true'
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout repository
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/check-general-formatting-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
jobs:
run-determination:
runs-on: ubuntu-latest
permissions: {}
outputs:
result: ${{ steps.determination.outputs.result }}
steps:
Expand All @@ -40,6 +41,8 @@ jobs:
needs: run-determination
if: needs.run-determination.outputs.result == 'true'
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Set environment variables
Expand Down
33 changes: 23 additions & 10 deletions .github/workflows/check-license.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-license.md
name: Check License

env:
EXPECTED_LICENSE_FILENAME: LICENSE.txt
# SPDX identifier: https://spdx.org/licenses/
EXPECTED_LICENSE_TYPE: GPL-3.0

# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
on:
create:
Expand Down Expand Up @@ -35,6 +30,7 @@ on:
jobs:
run-determination:
runs-on: ubuntu-latest
permissions: {}
outputs:
result: ${{ steps.determination.outputs.result }}
steps:
Expand All @@ -57,9 +53,22 @@ jobs:
echo "result=$RESULT" >> $GITHUB_OUTPUT
check-license:
name: ${{ matrix.check-license.path }}
needs: run-determination
if: needs.run-determination.outputs.result == 'true'
runs-on: ubuntu-latest
permissions:
contents: read

strategy:
fail-fast: false

matrix:
check-license:
- path: ./
expected-filename: LICENSE.txt
# SPDX identifier: https://spdx.org/licenses/
expected-type: GPL-3.0

steps:
- name: Checkout repository
Expand All @@ -73,23 +82,27 @@ jobs:
- name: Install licensee
run: gem install licensee

- name: Check license file
- name: Check license file for ${{ matrix.check-license.path }}
run: |
EXIT_STATUS=0
# Go into folder path
cd ./${{ matrix.check-license.path }}
# See: https://github.com/licensee/licensee
LICENSEE_OUTPUT="$(licensee detect --json --confidence=100)"
DETECTED_LICENSE_FILE="$(echo "$LICENSEE_OUTPUT" | jq .matched_files[0].filename | tr --delete '\r')"
echo "Detected license file: $DETECTED_LICENSE_FILE"
if [ "$DETECTED_LICENSE_FILE" != "\"${EXPECTED_LICENSE_FILENAME}\"" ]; then
echo "::error file=${DETECTED_LICENSE_FILE}::detected license file $DETECTED_LICENSE_FILE doesn't match expected: $EXPECTED_LICENSE_FILENAME"
if [ "$DETECTED_LICENSE_FILE" != "\"${{ matrix.check-license.expected-filename }}\"" ]; then
echo "::error file=${DETECTED_LICENSE_FILE}::detected license file $DETECTED_LICENSE_FILE doesn't match expected: ${{ matrix.check-license.expected-filename }}"
EXIT_STATUS=1
fi
DETECTED_LICENSE_TYPE="$(echo "$LICENSEE_OUTPUT" | jq .matched_files[0].matched_license | tr --delete '\r')"
echo "Detected license type: $DETECTED_LICENSE_TYPE"
if [ "$DETECTED_LICENSE_TYPE" != "\"${EXPECTED_LICENSE_TYPE}\"" ]; then
echo "::error file=${DETECTED_LICENSE_FILE}::detected license type $DETECTED_LICENSE_TYPE doesn't match expected \"${EXPECTED_LICENSE_TYPE}\""
if [ "$DETECTED_LICENSE_TYPE" != "\"${{ matrix.check-license.expected-type }}\"" ]; then
echo "::error file=${DETECTED_LICENSE_FILE}::detected license type $DETECTED_LICENSE_TYPE doesn't match expected \"${{ matrix.check-license.expected-type }}\""
EXIT_STATUS=1
fi
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/check-markdown-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ on:
jobs:
run-determination:
runs-on: ubuntu-latest
permissions: {}
outputs:
result: ${{ steps.determination.outputs.result }}
steps:
Expand All @@ -66,6 +67,8 @@ jobs:
needs: run-determination
if: needs.run-determination.outputs.result == 'true'
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout repository
Expand All @@ -92,6 +95,8 @@ jobs:
needs: run-determination
if: needs.run-determination.outputs.result == 'true'
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout repository
Expand Down
28 changes: 22 additions & 6 deletions .github/workflows/check-npm-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ on:
workflow_dispatch:
repository_dispatch:

permissions:
contents: read

jobs:
run-determination:
runs-on: ubuntu-latest
permissions: {}
outputs:
result: ${{ steps.determination.outputs.result }}
steps:
Expand All @@ -54,9 +52,18 @@ jobs:
echo "result=$RESULT" >> $GITHUB_OUTPUT
validate:
name: validate (${{ matrix.project.path }})
needs: run-determination
if: needs.run-determination.outputs.result == 'true'
runs-on: ubuntu-latest
permissions:
contents: read

strategy:
fail-fast: false
matrix:
project:
- path: .

steps:
- name: Checkout repository
Expand All @@ -74,12 +81,21 @@ jobs:
version: 3.x

- name: Validate package.json
run: task --silent npm:validate
run: task --silent npm:validate PROJECT_PATH="${{ matrix.project.path }}"

check-sync:
name: check-sync (${{ matrix.project.path }})
needs: run-determination
if: needs.run-determination.outputs.result == 'true'
runs-on: ubuntu-latest
permissions:
contents: read

strategy:
fail-fast: false
matrix:
project:
- path: .

steps:
- name: Checkout repository
Expand All @@ -97,7 +113,7 @@ jobs:
version: 3.x

- name: Install npm dependencies
run: task npm:install-deps
run: task npm:install-deps PROJECT_PATH="${{ matrix.project.path }}"

- name: Check package-lock.json
run: git diff --color --exit-code package-lock.json
run: git diff --color --exit-code "${{ matrix.project.path }}/package-lock.json"
3 changes: 3 additions & 0 deletions .github/workflows/check-prettier-formatting-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ on:
jobs:
run-determination:
runs-on: ubuntu-latest
permissions: {}
outputs:
result: ${{ steps.determination.outputs.result }}
steps:
Expand All @@ -234,6 +235,8 @@ jobs:
needs: run-determination
if: needs.run-determination.outputs.result == 'true'
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout repository
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/check-python-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ on:
jobs:
run-determination:
runs-on: ubuntu-latest
permissions: {}
outputs:
result: ${{ steps.determination.outputs.result }}
steps:
Expand All @@ -60,6 +61,8 @@ jobs:
needs: run-determination
if: needs.run-determination.outputs.result == 'true'
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout repository
Expand Down Expand Up @@ -92,6 +95,8 @@ jobs:
needs: run-determination
if: needs.run-determination.outputs.result == 'true'
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout repository
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/check-taskfiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ on:
jobs:
run-determination:
runs-on: ubuntu-latest
permissions: {}
outputs:
result: ${{ steps.determination.outputs.result }}
steps:
Expand All @@ -55,6 +56,8 @@ jobs:
needs: run-determination
if: needs.run-determination.outputs.result == 'true'
runs-on: ubuntu-latest
permissions:
contents: read

strategy:
fail-fast: false
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/check-toc-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ on:
jobs:
run-determination:
runs-on: ubuntu-latest
permissions: {}
outputs:
result: ${{ steps.determination.outputs.result }}
steps:
Expand All @@ -55,6 +56,8 @@ jobs:
needs: run-determination
if: needs.run-determination.outputs.result == 'true'
runs-on: ubuntu-latest
permissions:
contents: read

strategy:
fail-fast: false
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/check-workflows-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ on:
jobs:
validate:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout repository
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/check-yaml-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ on:
jobs:
run-determination:
runs-on: ubuntu-latest
permissions: {}
outputs:
result: ${{ steps.determination.outputs.result }}
steps:
Expand All @@ -73,6 +74,8 @@ jobs:
needs: run-determination
if: needs.run-determination.outputs.result == 'true'
runs-on: ubuntu-latest
permissions:
contents: read

strategy:
fail-fast: false
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/spell-check-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
jobs:
run-determination:
runs-on: ubuntu-latest
permissions: {}
outputs:
result: ${{ steps.determination.outputs.result }}
steps:
Expand All @@ -40,6 +41,8 @@ jobs:
needs: run-determination
if: needs.run-determination.outputs.result == 'true'
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout repository
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/sync-labels-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ on:
jobs:
check:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout repository
Expand Down Expand Up @@ -65,6 +67,7 @@ jobs:
download:
needs: check
runs-on: ubuntu-latest
permissions: {}

strategy:
matrix:
Expand Down Expand Up @@ -92,6 +95,9 @@ jobs:
sync:
needs: download
runs-on: ubuntu-latest
permissions:
contents: read
issues: write

steps:
- name: Set environment variables
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test-python-poetry-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
runs-on: ubuntu-latest
outputs:
result: ${{ steps.determination.outputs.result }}
permissions: {}
steps:
- name: Determine if the rest of the workflow should run
id: determination
Expand All @@ -64,6 +65,8 @@ jobs:
needs: run-determination
if: needs.run-determination.outputs.result == 'true'
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout repository
Expand Down
Loading

0 comments on commit abab3f2

Please sign in to comment.