-
Notifications
You must be signed in to change notification settings - Fork 0
chore: add ci, scripts, and config files #2
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 13 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
dce3350
add ci and scripts
lucarin91 f59da7b
add task to go.mod
lucarin91 a6bbbe1
remove codeowner
lucarin91 2a52967
update licenses config
lucarin91 a82272c
Update .editorconfig
lucarin91 e9cea9f
Update .editorconfig
lucarin91 2d32bd5
Update dprint.json
lucarin91 37d75e5
Update dprint.json
lucarin91 3041752
Update dprint.json
lucarin91 0db61e5
Update Taskfile.yml
lucarin91 2a76633
Update Taskfile.yml
lucarin91 178ed6e
Update Taskfile.yml
lucarin91 2efb8c0
remove license version
lucarin91 1ae1e3a
add review license
lucarin91 eca4106
Update .github/workflows/release.yml
lucarin91 948b2c2
update dprint
lucarin91 4179ed7
add license
lucarin91 f0c28c0
update linter version on ci
lucarin91 644fc6c
Merge remote-tracking branch 'origin/main' into add-ci-stuff
lucarin91 b234e3f
make fmt happy
lucarin91 7875f16
Update .github/workflows/release.yml
lucarin91 08f326b
Update .licensed.yml
lucarin91 648d4e1
Remove reviewed dependencies from .licensed.yml
dido18 e7effbb
Remove obsolete dependency license files for updater
dido18 ceb9b6f
Remove hardcoded Go version and use go.mod for versioning in workflows
dido18 705d045
fixup! Remove hardcoded Go version and use go.mod for versioning in w…
lucarin91 1f77d10
fixup! fixup! Remove hardcoded Go version and use go.mod for versioni…
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 | ||
| [*.{go}] | ||
| charset = utf-8 | ||
|
|
||
| # Use tab indentation for Go and Makefiles | ||
| [{*.go,go.*}] | ||
| 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,44 @@ | ||
| 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 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,57 @@ | ||
| name: Release releaser | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - "*" # Trigger on all tags | ||
lucarin91 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| env: | ||
| GO_VERSION: "1.25.1" | ||
| PROJECT_NAME: "releaser" | ||
| GITHUB_TOKEN: ${{ secrets.ARDUINOBOT_TOKEN }} | ||
| GITHUB_USERNAME: ArduinoBot | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-22.04 | ||
lucarin91 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| steps: | ||
| - name: Extract version | ||
| shell: bash | ||
| run: | | ||
| VERSION="${GITHUB_REF##*/}" | ||
| echo "VERSION=${VERSION}" >> $GITHUB_ENV | ||
| echo "RELEASE_NAME=${{ env.PROJECT_NAME }}-${VERSION}-linux-amd64" >> $GITHUB_ENV | ||
| env: | ||
| GITHUB_REF: ${{ github.ref }} | ||
|
|
||
| - 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: Build Binary | ||
| env: | ||
| GOARCH: ${{ matrix.arch }} | ||
| GOOS: ${{ matrix.os }} | ||
| run: | | ||
| mkdir -p build/ | ||
| go build -v -ldflags "-X 'main.version=${{ env.VERSION }}'" \ | ||
| -o ./build/ \ | ||
| ./cmd/${{ env.PROJECT_NAME }} | ||
|
|
||
| - name: Prepare Build Artifacts | ||
| run: | | ||
| tar -czf ./build/${{ env.RELEASE_NAME }}.tar.gz -C ./build ${{ env.PROJECT_NAME }} | ||
|
|
||
| - name: Upload artifacts index | ||
| uses: ncipollo/release-action@v1 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| draft: false | ||
| prerelease: true | ||
| artifacts: build/${{ env.RELEASE_NAME }}.tar.gz | ||
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,3 @@ | ||
| .bin/ | ||
|
|
||
| build/ |
Oops, something went wrong.
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.