-
Notifications
You must be signed in to change notification settings - Fork 2
chore: add ci and scripts #1
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 7 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
0faa021
chore: add ci and scripts
lucarin91 70d6483
make dprint happy
lucarin91 444d4a2
typo
lucarin91 d67a4a1
fix go.sum
lucarin91 d7cbde4
add deb notice check
lucarin91 a7a077b
fixup! add deb notice check
lucarin91 ae6b5bf
remove codeowners for now
lucarin91 cd06dd1
Update Taskfile.yml
lucarin91 01b6a9c
Update Taskfile.yml
lucarin91 7121686
Update Taskfile.yml
lucarin91 3f27b14
apply code review suggestions
lucarin91 f20345a
Merge branch 'add-github-workflow' of github.com:arduino/arduino-rout…
lucarin91 5d4d49c
update licenses
lucarin91 b533391
fixup! update licenses
lucarin91 76e57f8
use task in go.mod
lucarin91 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,22 @@ | ||
| # EditorConfig is awesome: https://EditorConfig.org | ||
|
|
||
| # top-most EditorConfig file | ||
| root = true | ||
|
|
||
| # Default configuration for all files | ||
| [*] | ||
| end_of_line = lf | ||
| insert_final_newline = true | ||
| trim_trailing_whitespace = true | ||
| indent_style = space | ||
| indent_size = 2 | ||
|
|
||
| # Use utf-8 charset for modern languages | ||
| [*.{js,py,go}] | ||
| charset = utf-8 | ||
|
|
||
| # Use tab indentation for Go and Makefiles | ||
| [{*.go,go.*,Makefile}] | ||
| indent_style = tab | ||
| indent_size = 4 | ||
|
|
||
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,19 @@ | ||
| ### Motivation | ||
|
|
||
| <!-- Why this pull request? --> | ||
|
|
||
| ### Change description | ||
|
|
||
| <!-- What does your code do? --> | ||
|
|
||
| ### Additional Notes | ||
|
|
||
| <!-- Link any useful metadata: Jira task, GitHub issue, ... --> | ||
|
|
||
| ### Reviewer checklist | ||
|
|
||
| - [ ] PR addresses a single concern. | ||
| - [ ] PR title and description are properly filled. | ||
| - [ ] Changes will be merged in `main`. | ||
| - [ ] Changes are covered by tests. | ||
| - [ ] Logging is meaningful in case of troubleshooting. |
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,20 @@ | ||
| name: Block Merge if "do-not-merge" Label Exists | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: | ||
| - opened | ||
| - labeled | ||
| - unlabeled | ||
| - synchronize # important for when new commits are pushed | ||
|
|
||
| jobs: | ||
| check-do-not-merge-label: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check for "do-not-merge" label | ||
| if: contains(github.event.pull_request.labels.*.name, 'do-not-merge') | ||
| run: | | ||
| echo "This Pull Request has the 'do-not-merge' label. Merging is blocked." | ||
| echo "Please remove the 'do-not-merge' label to enable merging." | ||
| exit 1 # This will cause the workflow to fail |
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,155 @@ | ||
| # Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-go-dependencies-task.md | ||
| name: Check Go Dependencies | ||
|
|
||
| # See: https://docs.github.com/actions/reference/workflows-and-actions/events-that-trigger-workflows | ||
| on: | ||
| create: | ||
| push: | ||
| paths: | ||
| - ".github/workflows/check-go-dependencies-task.ya?ml" | ||
| - ".licenses/**" | ||
| - ".licensed.json" | ||
| - ".licensed.ya?ml" | ||
| - "Taskfile.ya?ml" | ||
| - "**/.gitmodules" | ||
| - "**/go.mod" | ||
| - "**/go.sum" | ||
| pull_request: | ||
| paths: | ||
| - ".github/workflows/check-go-dependencies-task.ya?ml" | ||
| - ".licenses/**" | ||
| - ".licensed.json" | ||
| - ".licensed.ya?ml" | ||
| - "Taskfile.ya?ml" | ||
| - "**/.gitmodules" | ||
| - "**/go.mod" | ||
| - "**/go.sum" | ||
| schedule: | ||
| # Run periodically to catch breakage caused by external changes. | ||
| - cron: "0 8 * * WED" | ||
| workflow_dispatch: | ||
| repository_dispatch: | ||
|
|
||
| jobs: | ||
| run-determination: | ||
| runs-on: ubuntu-latest | ||
| permissions: {} | ||
| outputs: | ||
| result: ${{ steps.determination.outputs.result }} | ||
| steps: | ||
| - name: Determine if the rest of the workflow should run | ||
| id: determination | ||
| run: | | ||
| RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x" | ||
| # The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead. | ||
| if [[ | ||
| "${{ github.event_name }}" != "create" || | ||
| "${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX | ||
| ]]; then | ||
| # Run the other jobs. | ||
| RESULT="true" | ||
| else | ||
| # There is no need to run the other jobs. | ||
| RESULT="false" | ||
| fi | ||
|
|
||
| echo "result=$RESULT" >>$GITHUB_OUTPUT | ||
|
|
||
| check-cache: | ||
| needs: run-determination | ||
| if: needs.run-determination.outputs.result == 'true' | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v5 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| # This is required to allow licensee/setup-licensed to install Licensed via Ruby gem. | ||
| - name: Install Ruby | ||
| uses: ruby/setup-ruby@v1 | ||
| with: | ||
| ruby-version: ruby # Install latest version | ||
|
|
||
| - name: Install licensed | ||
| uses: licensee/[email protected] | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| version: 5.x | ||
|
|
||
| - name: Install Go | ||
| uses: actions/setup-go@v6 | ||
| with: | ||
| go-version-file: go.mod | ||
|
|
||
| - name: Update dependencies license metadata cache | ||
| run: | | ||
| go tool \ | ||
| github.com/go-task/task/v3/cmd/task \ | ||
| --silent \ | ||
| general:cache-dep-licenses | ||
|
|
||
| - name: Check for outdated cache | ||
| id: diff | ||
| run: | | ||
| git add . | ||
| if | ||
| ! git diff \ | ||
| --cached \ | ||
| --color \ | ||
| --exit-code | ||
| then | ||
| echo | ||
| echo "::error::Dependency license metadata out of sync. See: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-go-dependencies-task.md#metadata-cache" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Some might find it convenient to have CI generate the cache rather than setting up for it locally | ||
| - name: Upload cache to workflow artifact | ||
| if: failure() && steps.diff.outcome == 'failure' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| if-no-files-found: error | ||
| include-hidden-files: true | ||
| name: dep-licenses-cache | ||
| path: .licenses/ | ||
|
|
||
| check-deps: | ||
| needs: run-determination | ||
| if: needs.run-determination.outputs.result == 'true' | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v5 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| # This is required to allow licensee/setup-licensed to install Licensed via Ruby gem. | ||
| - name: Install Ruby | ||
| uses: ruby/setup-ruby@v1 | ||
| with: | ||
| ruby-version: ruby # Install latest version | ||
|
|
||
| - name: Install licensed | ||
| uses: licensee/[email protected] | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| version: 5.x | ||
|
|
||
| - name: Install Go | ||
| uses: actions/setup-go@v6 | ||
| with: | ||
| go-version-file: go.mod | ||
|
|
||
| - name: Check for dependencies with unapproved licenses | ||
| run: | | ||
| go tool \ | ||
| github.com/go-task/task/v3/cmd/task \ | ||
| --silent \ | ||
| general:check-dep-licenses |
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,60 @@ | ||
| name: Run Checks | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| # In the same branch only 1 workflow per time can run. In case we're not in the | ||
| # main branch we cancel previous running workflow | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | ||
|
|
||
| permissions: | ||
| contents: read | ||
| # Used by the buf to create a comment with a brief summary of failing tets | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| run-checks: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: dprint/[email protected] | ||
| with: | ||
| dprint-version: 0.48.0 | ||
|
|
||
| - uses: golangci/golangci-lint-action@v8 | ||
| with: | ||
| version: v2.4.0 | ||
| args: --timeout 300s | ||
|
|
||
| - name: Check go mod | ||
| run: | | ||
| go mod tidy | ||
| git diff --color --exit-code | ||
|
|
||
| - name: Install Task | ||
| uses: arduino/setup-task@v2 | ||
| with: | ||
| version: 3.x | ||
| repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| # This is required to allow licensee/setup-licensed to install Licensed via Ruby gem. | ||
| - name: Install Ruby | ||
| uses: ruby/setup-ruby@v1 | ||
| with: | ||
| ruby-version: ruby # Install latest version | ||
| - name: Install licensed | ||
| uses: licensee/[email protected] | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| version: 5.x | ||
|
|
||
| - name: Run deb copyright check | ||
| run: | | ||
| task update-deb-copyright | ||
| git diff --color --exit-code |
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,31 @@ | ||
| name: Run Go Tests | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| env: | ||
| GO_VERSION: "1.25.1" | ||
|
|
||
| jobs: | ||
| go-test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Install Task | ||
| uses: arduino/setup-task@v2 | ||
| with: | ||
| version: 3.x | ||
| repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: ${{ env.GO_VERSION }} | ||
|
|
||
| - name: Run tests | ||
| run: task test |
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,56 @@ | ||
| name: Release arduino-app | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - "*" # Trigger on all tags | ||
|
|
||
| env: | ||
| GO_VERSION: "1.25.1" | ||
| PROJECT_NAME: "arduino-router" | ||
| GITHUB_TOKEN: ${{ secrets.ARDUINOBOT_TOKEN }} | ||
| GITHUB_USERNAME: ArduinoBot | ||
|
|
||
| jobs: | ||
| build: | ||
| strategy: | ||
| matrix: | ||
| os: [ubuntu-22.04] | ||
| arch: [amd64, arm64] | ||
|
|
||
| runs-on: ${{ matrix.os }} | ||
|
|
||
| steps: | ||
| - name: Set env vars | ||
| run: | | ||
| echo "TAG_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV | ||
| echo "creating tag ${TAG_VERSION}" | ||
|
|
||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: ${{ env.GO_VERSION }} | ||
|
|
||
| - name: Install Task | ||
| uses: arduino/setup-task@v2 | ||
| with: | ||
| version: 3.x | ||
| repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Build deb | ||
| run: | | ||
| task build-deb VERSION=${TAG_VERSION} ARCH=${{ matrix.arch }} RELEASE="true" | ||
|
|
||
| - name: Create Github Release and upload artifacts | ||
| uses: ncipollo/release-action@v1 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| draft: false | ||
| prerelease: true | ||
| artifacts: build/*.tar.gz,build/*.deb | ||
| allowUpdates: true |
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.