Skip to content

Commit 27531bd

Browse files
dido18lucarin91MatteoPologruto
authored
chore: add ci workflows (#3)
--------- Co-authored-by: lucarin91 <[email protected]> Co-authored-by: MatteoPologruto <[email protected]>
1 parent f463bcf commit 27531bd

File tree

12 files changed

+4995
-245006
lines changed

12 files changed

+4995
-245006
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
### Motivation
2+
3+
<!-- Why this pull request? -->
4+
5+
### Change description
6+
7+
<!-- What does your code do? -->
8+
9+
### Additional Notes
10+
11+
<!-- Link any useful metadata: Jira task, GitHub issue, ... -->
12+
13+
### Reviewer checklist
14+
15+
- [ ] PR addresses a single concern.
16+
- [ ] PR title and description are properly filled.
17+
- [ ] Changes will be merged in `main`.
18+
- [ ] Changes are covered by tests.
19+
- [ ] Logging is meaningful in case of troubleshooting.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Block Merge if "do-not-merge" Label Exists
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- labeled
8+
- unlabeled
9+
- synchronize # important for when new commits are pushed
10+
11+
jobs:
12+
check-do-not-merge-label:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Check for "do-not-merge" label
16+
if: contains(github.event.pull_request.labels.*.name, 'do-not-merge')
17+
run: |
18+
echo "This Pull Request has the 'do-not-merge' label. Merging is blocked."
19+
echo "Please remove the 'do-not-merge' label to enable merging."
20+
exit 1 # This will cause the workflow to fail

.github/workflows/checks.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Run Checks
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
# In the same branch only 1 workflow per time can run. In case we're not in the
10+
# main branch we cancel previous running workflow
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
14+
15+
permissions:
16+
contents: read
17+
# Used by the buf to create a comment with a brief summary of failing tets
18+
pull-requests: write
19+
20+
jobs:
21+
run-checks:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- uses: dprint/[email protected]
27+
with:
28+
dprint-version: 0.48.0
29+
30+
- uses: golangci/golangci-lint-action@v8
31+
with:
32+
version: v2.4.0
33+
args: --timeout 300s
34+
35+
- name: Check go mod
36+
run: |
37+
go mod tidy
38+
git diff --color --exit-code

.github/workflows/go-test.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Run Go Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
go-test-internal:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: install dependencies
14+
run: |
15+
sudo apt-get update
16+
sudo apt-get install -y android-tools-adb
17+
18+
- name: Checkout code
19+
uses: actions/checkout@v3
20+
21+
- name: Set up Go
22+
uses: actions/setup-go@v5
23+
with:
24+
go-version-file: go.mod
25+
26+
- name: Run `internal` tests
27+
run: go tool task test:internal
28+
29+
go-test-pkg:
30+
runs-on: ${{ matrix.os }}
31+
strategy:
32+
matrix:
33+
os: [ubuntu-latest, windows-latest]
34+
35+
steps:
36+
- name: install dependencies [Linux]
37+
if: runner.os == 'Linux'
38+
run: |
39+
sudo apt-get update
40+
sudo apt-get install -y android-tools-adb
41+
42+
- name: Checkout code
43+
uses: actions/checkout@v3
44+
45+
- name: Set up Go
46+
uses: actions/setup-go@v5
47+
with:
48+
go-version-file: go.mod
49+
50+
- name: Run `pkg` tests
51+
run: go tool task test:pkg

.github/workflows/release.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Release arduino-app-cli
2+
3+
on:
4+
push:
5+
tags:
6+
- "v[0-9]+.[0-9]+.[0-9]+*"
7+
8+
env:
9+
PROJECT_NAME: "arduino-app-cli"
10+
GITHUB_TOKEN: ${{ secrets.ARDUINOBOT_TOKEN }}
11+
GITHUB_USERNAME: ArduinoBot
12+
13+
jobs:
14+
build:
15+
strategy:
16+
matrix:
17+
os: [ubuntu-22.04]
18+
arch: [amd64, arm64]
19+
20+
runs-on: ${{ matrix.os }}
21+
22+
steps:
23+
- name: Set env vars
24+
run: |
25+
echo "TAG_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
26+
echo "creating tag ${TAG_VERSION}"
27+
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 0
32+
33+
- name: Configure Git for private repo cloning
34+
run: |
35+
git config --global url."https://${{ env.GITHUB_USERNAME }}:${{ env.GITHUB_TOKEN }}@github.com".insteadOf "https://github.com"
36+
37+
- name: Set up Go
38+
uses: actions/setup-go@v5
39+
with:
40+
go-version-file: go.mod
41+
42+
- name: Build deb
43+
run: |
44+
go tool task build-deb VERSION=${TAG_VERSION} ARCH=${{ matrix.arch }} RELEASE="true"
45+
46+
- name: Create Github Release and upload artifacts
47+
uses: ncipollo/release-action@v1
48+
with:
49+
token: ${{ secrets.GITHUB_TOKEN }}
50+
draft: false
51+
prerelease: true
52+
artifacts: build/*.deb
53+
allowUpdates: true

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,7 @@ build/
3333

3434
/arduino-app-cli
3535
/apps
36-
# temporary staging directories
36+
37+
# debian packaging files
3738
/debian/arduino-app-cli/home/arduino/.local/share/arduino-app-cli/examples
39+
/debian/arduino-app-cli/usr/share/doc/arduino-app-cli/copyright

.licensed.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ cache_path: .licenses
66
apps:
77
- source_path: ./cmd/arduino-app-cli
88

9-
109
reviewed:
1110
go:
1211
# TODO: remove it after releasing this https://github.com/arduino/go-win32-utils/pull/10

0 commit comments

Comments
 (0)