Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 079bb6c

Browse files
authoredJan 22, 2021
[skip changelog] Update release process (#1148)
* [skip changelog] Ditch goreleaser in favor of a new release process * [skip changelog] Fix version output test * [skip changelog] Fix some workflows issues * [skip changelog] Fix panic when running integration tests * [skip changelog] Remove extra chars from package name prefix
1 parent d996b15 commit 079bb6c

19 files changed

+294
-188
lines changed
 

‎.github/workflows/i18n-nightly-push.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
uses: Arduino/actions/setup-taskfile@master
2525
with:
2626
repo-token: ${{ secrets.GITHUB_TOKEN }}
27+
version: 3.x
2728

2829
- name: Run task i18n:push
2930
run: task i18n:push

‎.github/workflows/i18n-weekly-pull.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
uses: Arduino/actions/setup-taskfile@master
2929
with:
3030
repo-token: ${{ secrets.GITHUB_TOKEN }}
31+
version: 3.x
3132

3233
- name: Run task i18n:pull
3334
run: task i18n:pull

‎.github/workflows/link-validation.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
uses: Arduino/actions/setup-taskfile@master
2121
with:
2222
repo-token: ${{ secrets.GITHUB_TOKEN }}
23+
version: 3.x
2324

2425
- name: Install Go
2526
uses: actions/setup-go@v2

‎.github/workflows/nightly.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,22 @@ jobs:
1212
if: github.repository == 'arduino/arduino-cli'
1313
runs-on: ubuntu-latest
1414

15-
container:
16-
image: arduino/arduino-cli:builder-1
17-
volumes:
18-
# cache go dependencies across pipeline's steps
19-
- ${{ github.workspace }}/go:/go
20-
2115
steps:
2216
- name: checkout
2317
uses: actions/checkout@v1
2418
with:
2519
fetch-depth: 0
2620

27-
- name: build
21+
- name: Install Taskfile
22+
uses: arduino/actions/setup-taskfile@master
23+
with:
24+
repo-token: ${{ secrets.GITHUB_TOKEN }}
25+
version: 3.x
26+
27+
- name: Build
2828
env:
29-
PACKAGE_NAME_PREFIX: ${{ github.workflow }}
30-
run: goreleaser --snapshot
29+
NIGHTLY: true
30+
run: task dist:all
3131

3232
- name: Upload artifacts
3333
uses: actions/upload-artifact@v2
@@ -77,14 +77,14 @@ jobs:
7777
- name: Re-package binary and update checksum
7878
# This step performs the following:
7979
# 1. Repackage the signed binary replaced in place by Gon (ignoring the output zip file)
80-
# 2. Recalculate package checksum and replace it in the goreleaser nnnnnn-checksums.txt file
80+
# 2. Recalculate package checksum and replace it in the nnnnnn-checksums.txt file
8181
run: |
8282
# GitHub's upload/download-artifact@v1 actions don't preserve file permissions,
8383
# so we need to add execution permission back until @v2 actions are released.
84-
chmod +x dist/arduino_cli_osx_darwin_amd64/arduino-cli
84+
chmod +x dist/arduino-cli_osx_darwin_amd64/arduino-cli
8585
PACKAGE_FILENAME="$(basename dist/arduino-cli_${{ github.workflow }}-*_macOS_64bit.tar.gz)"
8686
tar -czvf dist/$PACKAGE_FILENAME \
87-
-C dist/arduino_cli_osx_darwin_amd64/ arduino-cli \
87+
-C dist/arduino-cli_osx_darwin_amd64/ arduino-cli \
8888
-C ../../ LICENSE.txt
8989
CLI_CHECKSUM=$(shasum -a 256 dist/$PACKAGE_FILENAME | cut -d " " -f 1)
9090
perl -pi -w -e "s/.*${PACKAGE_FILENAME}/${CLI_CHECKSUM} ${PACKAGE_FILENAME}/g;" dist/*-checksums.txt

‎.github/workflows/publish-docs.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
uses: Arduino/actions/setup-taskfile@master
4848
with:
4949
repo-token: ${{ secrets.GITHUB_TOKEN }}
50+
version: 3.x
5051

5152
- name: Setup Go
5253
uses: actions/setup-go@v2

‎.github/workflows/python-lint.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
uses: Arduino/actions/setup-taskfile@master
2424
with:
2525
repo-token: ${{ secrets.GITHUB_TOKEN }}
26+
version: 3.x
2627

2728
- name: Activate Python
2829
uses: actions/setup-python@v1

‎.github/workflows/release.yaml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,28 @@ jobs:
99
create-release-artifacts:
1010
runs-on: ubuntu-latest
1111

12-
container:
13-
image: arduino/arduino-cli:builder-1
14-
volumes:
15-
# cache go dependencies across pipeline's steps
16-
- ${{ github.workspace }}/go:/go
17-
1812
steps:
1913
- name: Checkout
2014
uses: actions/checkout@v1
2115
with:
2216
fetch-depth: 0
2317

18+
- name: Create changelog
19+
uses: arduino/create-changelog@1.2.0
20+
with:
21+
tag-regex: '^[0-9]+\.[0-9]+\.[0-9]+$'
22+
filter-regex: '^\[(skip|changelog)[ ,-](skip|changelog)\].*'
23+
case-insensitive-regex: true
24+
changelog-file-path: "dist/CHANGELOG.md"
25+
26+
- name: Install Taskfile
27+
uses: arduino/actions/setup-taskfile@master
28+
with:
29+
repo-token: ${{ secrets.GITHUB_TOKEN }}
30+
version: 3.x
31+
2432
- name: Build
25-
run: goreleaser
33+
run: task dist:all
2634

2735
- name: Upload artifacts
2836
uses: actions/upload-artifact@v2
@@ -72,14 +80,14 @@ jobs:
7280
- name: Re-package binary and update checksum
7381
# This step performs the following:
7482
# 1. Repackage the signed binary replaced in place by Gon (ignoring the output zip file)
75-
# 2. Recalculate package checksum and replace it in the goreleaser nnnnnn-checksums.txt file
83+
# 2. Recalculate package checksum and replace it in the nnnnnn-checksums.txt file
7684
run: |
7785
# GitHub's upload/download-artifact@v1 actions don't preserve file permissions,
7886
# so we need to add execution permission back until @v2 actions are released.
79-
chmod +x dist/arduino_cli_osx_darwin_amd64/arduino-cli
87+
chmod +x dist/arduino-cli_osx_darwin_amd64/arduino-cli
8088
TAG=${GITHUB_REF/refs\/tags\//}
8189
tar -czvf dist/arduino-cli_${TAG}_macOS_64bit.tar.gz \
82-
-C dist/arduino_cli_osx_darwin_amd64/ arduino-cli \
90+
-C dist/arduino-cli_osx_darwin_amd64/ arduino-cli \
8391
-C ../../ LICENSE.txt
8492
CLI_CHECKSUM=$(shasum -a 256 dist/arduino-cli_${TAG}_macOS_64bit.tar.gz | cut -d " " -f 1)
8593
perl -pi -w -e "s/.*arduino-cli_${TAG}_macOS_64bit.tar.gz/${CLI_CHECKSUM} arduino-cli_${TAG}_macOS_64bit.tar.gz/g;" dist/*-checksums.txt

‎.github/workflows/test.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ jobs:
3939
uses: Arduino/actions/setup-taskfile@master
4040
with:
4141
repo-token: ${{ secrets.GITHUB_TOKEN }}
42+
version: 3.x
4243

4344
- name: Install Python
4445
uses: actions/setup-python@v1
@@ -105,28 +106,27 @@ jobs:
105106
runs-on: ubuntu-latest
106107
needs: test-matrix
107108

108-
container:
109-
image: arduino/arduino-cli:builder-1
110-
volumes:
111-
# cache go dependencies across pipeline's steps
112-
- ${{ github.workspace }}/go:/go
113-
114109
steps:
115110
- name: checkout
116111
uses: actions/checkout@v1
117112
with:
118113
fetch-depth: 0
119114

120-
- name: build
121-
shell: bash
115+
- name: Install Taskfile
116+
uses: arduino/actions/setup-taskfile@master
117+
with:
118+
repo-token: ${{ secrets.GITHUB_TOKEN }}
119+
version: 3.x
120+
121+
- name: Build
122122
run: |
123123
PACKAGE_NAME_PREFIX="${{ github.workflow }}"
124124
if [ "${{ github.event_name }}" = "pull_request" ]; then
125125
PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.event.number }}"
126126
fi
127-
PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.sha }}"
127+
PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.sha }}-"
128128
export PACKAGE_NAME_PREFIX
129-
goreleaser --snapshot
129+
task dist:all
130130
131131
# Uploads all architectures as separate artifacts
132132
- name: Upload Linux 32 bit artifact

‎.github/workflows/validate-docs.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
uses: Arduino/actions/setup-taskfile@master
3535
with:
3636
repo-token: ${{ secrets.GITHUB_TOKEN }}
37+
version: 3.x
3738

3839
- name: Setup Go
3940
uses: actions/setup-go@v2

‎.github/workflows/verify-formatting.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
uses: Arduino/actions/setup-taskfile@master
2929
with:
3030
repo-token: ${{ secrets.GITHUB_TOKEN }}
31+
version: 3.x
3132

3233
- name: Verify formatting of all files
3334
run: task docs:check config:check

‎.goreleaser.yml

Lines changed: 0 additions & 123 deletions
This file was deleted.

‎DistTasks.yml

Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
version: "3"
2+
3+
# This taskfile is ideally meant to be project agnostic and could be dropped in
4+
# on other Go projects with minimal or no changes.
5+
#
6+
# To use it simply add the following lines to your main taskfile:
7+
# includes:
8+
# dist: ./DistTasks.yml
9+
#
10+
# The following variables must be declared in the including taskfile for the
11+
# build process to work correctly:
12+
# * DIST_DIR: the folder that will contain the final binaries and packages
13+
# * PROJECT_NAME: the name of the project, used in package name
14+
# * VERSION: the version of the project, used in package name and checksum file
15+
# * LD_FLAGS: flags used at build time
16+
#
17+
# The project MUST contain a LICENSE.txt file in the root folder or packaging will fail.
18+
19+
tasks:
20+
all:
21+
desc: Build for distribution for all platforms
22+
cmds:
23+
- task: Windows_32bit
24+
- task: Windows_64bit
25+
- task: Linux_32bit
26+
- task: Linux_64bit
27+
- task: Linux_ARMv6
28+
- task: Linux_ARMv7
29+
- task: Linux_ARM64
30+
- task: macOS_64bit
31+
32+
Windows_32bit:
33+
desc: Builds Windows 32 bit binaries
34+
dir: "{{ .DIST_DIR }}"
35+
cmds:
36+
- |
37+
docker run -v `pwd`/..:/home/build -w /home/build \
38+
-e CGO_ENABLED=1 \
39+
{{ .CONTAINER }}:{{ .CONTAINER_TAG }} \
40+
--build-cmd "{{ .BUILD_COMMAND }}" \
41+
-p "{{ .BUILD_PLATFORM }}"
42+
43+
zip {{ .PACKAGE_NAME}} {{ .PLATFORM_DIR }}/{{ .PROJECT_NAME }}.exe ../LICENSE.txt -j
44+
sha256sum {{ .PACKAGE_NAME }} >> {{ .CHECKSUM_FILE }}
45+
46+
vars:
47+
PLATFORM_DIR: "{{ .PROJECT_NAME }}_windows_386"
48+
BUILD_COMMAND: "go build -o {{ .DIST_DIR }}/{{ .PLATFORM_DIR }}/{{ .PROJECT_NAME }}.exe {{ .LDFLAGS }}"
49+
BUILD_PLATFORM: "windows/386"
50+
CONTAINER_TAG: "{{ .GO_VERSION }}-main"
51+
PACKAGE_PLATFORM: "Windows_32bit"
52+
PACKAGE_NAME: "{{ .PROJECT_NAME }}_{{ .VERSION }}_{{ .PACKAGE_PLATFORM }}.zip"
53+
54+
Windows_64bit:
55+
desc: Builds Windows 64 bit binaries
56+
dir: "{{ .DIST_DIR }}"
57+
cmds:
58+
- |
59+
docker run -v `pwd`/..:/home/build -w /home/build \
60+
-e CGO_ENABLED=1 \
61+
{{ .CONTAINER }}:{{ .CONTAINER_TAG }} \
62+
--build-cmd "{{ .BUILD_COMMAND }}" \
63+
-p "{{ .BUILD_PLATFORM }}"
64+
65+
zip {{ .PACKAGE_NAME}} {{ .PLATFORM_DIR }}/{{ .PROJECT_NAME }}.exe ../LICENSE.txt -j
66+
sha256sum {{ .PACKAGE_NAME }} >> {{ .CHECKSUM_FILE }}
67+
68+
vars:
69+
PLATFORM_DIR: "{{ .PROJECT_NAME }}_windows_amd64"
70+
BUILD_COMMAND: "go build -o {{ .DIST_DIR }}/{{ .PLATFORM_DIR }}/{{ .PROJECT_NAME }}.exe {{ .LDFLAGS }}"
71+
BUILD_PLATFORM: "windows/amd64"
72+
CONTAINER_TAG: "{{ .GO_VERSION }}-main"
73+
PACKAGE_PLATFORM: "Windows_64bit"
74+
PACKAGE_NAME: "{{ .PROJECT_NAME }}_{{ .VERSION }}_{{ .PACKAGE_PLATFORM }}.zip"
75+
76+
Linux_32bit:
77+
desc: Builds Linux 32 bit binaries
78+
dir: "{{ .DIST_DIR }}"
79+
cmds:
80+
- |
81+
docker run -v `pwd`/..:/home/build -w /home/build \
82+
-e CGO_ENABLED=1 \
83+
{{ .CONTAINER }}:{{ .CONTAINER_TAG }} \
84+
--build-cmd "{{ .BUILD_COMMAND }}" \
85+
-p "{{ .BUILD_PLATFORM }}"
86+
87+
tar cz -C {{ .PLATFORM_DIR }} {{ .PROJECT_NAME }} -C ../.. LICENSE.txt -f {{ .PACKAGE_NAME }}
88+
sha256sum {{ .PACKAGE_NAME }} >> {{ .CHECKSUM_FILE }}
89+
90+
vars:
91+
PLATFORM_DIR: "{{ .PROJECT_NAME }}_linux_amd32"
92+
BUILD_COMMAND: "go build -o {{ .DIST_DIR }}/{{ .PLATFORM_DIR }}/{{ .PROJECT_NAME }} {{ .LDFLAGS }}"
93+
BUILD_PLATFORM: "linux/386"
94+
CONTAINER_TAG: "{{ .GO_VERSION }}-main"
95+
PACKAGE_PLATFORM: "Linux_32bit"
96+
PACKAGE_NAME: "{{ .PROJECT_NAME }}_{{ .VERSION }}_{{ .PACKAGE_PLATFORM }}.tar.gz"
97+
98+
Linux_64bit:
99+
desc: Builds Linux 64 bit binaries
100+
dir: "{{ .DIST_DIR }}"
101+
cmds:
102+
- |
103+
docker run -v `pwd`/..:/home/build -w /home/build \
104+
-e CGO_ENABLED=1 \
105+
{{ .CONTAINER }}:{{ .CONTAINER_TAG }} \
106+
--build-cmd "{{ .BUILD_COMMAND }}" \
107+
-p "{{ .BUILD_PLATFORM }}"
108+
109+
tar cz -C {{ .PLATFORM_DIR }} {{ .PROJECT_NAME }} -C ../.. LICENSE.txt -f {{ .PACKAGE_NAME }}
110+
sha256sum {{ .PACKAGE_NAME }} >> {{ .CHECKSUM_FILE }}
111+
112+
vars:
113+
PLATFORM_DIR: "{{ .PROJECT_NAME }}_linux_amd64"
114+
BUILD_COMMAND: "go build -o {{ .DIST_DIR }}/{{ .PLATFORM_DIR }}/{{ .PROJECT_NAME }} {{ .LDFLAGS }}"
115+
BUILD_PLATFORM: "linux/amd64"
116+
CONTAINER_TAG: "{{ .GO_VERSION }}-main"
117+
PACKAGE_PLATFORM: "Linux_64bit"
118+
PACKAGE_NAME: "{{ .PROJECT_NAME }}_{{ .VERSION }}_{{ .PACKAGE_PLATFORM }}.tar.gz"
119+
120+
Linux_ARMv7:
121+
desc: Builds Linux ARMv7 binaries
122+
dir: "{{ .DIST_DIR }}"
123+
cmds:
124+
- |
125+
docker run -v `pwd`/..:/home/build -w /home/build \
126+
-e CGO_ENABLED=1 \
127+
{{ .CONTAINER }}:{{ .CONTAINER_TAG }} \
128+
--build-cmd "{{ .BUILD_COMMAND }}" \
129+
-p "{{ .BUILD_PLATFORM }}"
130+
131+
tar cz -C {{ .PLATFORM_DIR }} {{ .PROJECT_NAME }} -C ../.. LICENSE.txt -f {{ .PACKAGE_NAME }}
132+
sha256sum {{ .PACKAGE_NAME }} >> {{ .CHECKSUM_FILE }}
133+
134+
vars:
135+
PLATFORM_DIR: "{{ .PROJECT_NAME }}_linux_arm_7"
136+
BUILD_COMMAND: "go build -o {{ .DIST_DIR }}/{{ .PLATFORM_DIR }}/{{ .PROJECT_NAME }} {{ .LDFLAGS }}"
137+
BUILD_PLATFORM: "linux/armv7"
138+
CONTAINER_TAG: "{{ .GO_VERSION }}-arm"
139+
PACKAGE_PLATFORM: "Linux_ARMv7"
140+
PACKAGE_NAME: "{{ .PROJECT_NAME }}_{{ .VERSION }}_{{ .PACKAGE_PLATFORM }}.tar.gz"
141+
142+
Linux_ARMv6:
143+
desc: Builds Linux ARMv6 binaries
144+
dir: "{{ .DIST_DIR }}"
145+
cmds:
146+
- |
147+
docker run -v `pwd`/..:/home/build -w /home/build \
148+
-e CGO_ENABLED=1 \
149+
{{ .CONTAINER }}:{{ .CONTAINER_TAG }} \
150+
--build-cmd "{{ .BUILD_COMMAND }}" \
151+
-p "{{ .BUILD_PLATFORM }}"
152+
153+
tar cz -C {{ .PLATFORM_DIR }} {{ .PROJECT_NAME }} -C ../.. LICENSE.txt -f {{ .PACKAGE_NAME }}
154+
sha256sum {{ .PACKAGE_NAME }} >> {{ .CHECKSUM_FILE }}
155+
156+
vars:
157+
PLATFORM_DIR: "{{ .PROJECT_NAME }}_linux_arm_6"
158+
BUILD_COMMAND: "go build -o {{ .DIST_DIR }}/{{ .PLATFORM_DIR }}/{{ .PROJECT_NAME }} {{ .LDFLAGS }}"
159+
BUILD_PLATFORM: "linux/armv6"
160+
CONTAINER_TAG: "{{ .GO_VERSION }}-arm"
161+
PACKAGE_PLATFORM: "Linux_ARMv6"
162+
PACKAGE_NAME: "{{ .PROJECT_NAME }}_{{ .VERSION }}_{{ .PACKAGE_PLATFORM }}.tar.gz"
163+
164+
Linux_ARM64:
165+
desc: Builds Linux ARM64 binaries
166+
dir: "{{ .DIST_DIR }}"
167+
cmds:
168+
- |
169+
docker run -v `pwd`/..:/home/build -w /home/build \
170+
-e CGO_ENABLED=1 \
171+
{{ .CONTAINER }}:{{ .CONTAINER_TAG }} \
172+
--build-cmd "{{ .BUILD_COMMAND }}" \
173+
-p "{{ .BUILD_PLATFORM }}"
174+
175+
tar cz -C {{ .PLATFORM_DIR }} {{ .PROJECT_NAME }} -C ../.. LICENSE.txt -f {{ .PACKAGE_NAME }}
176+
sha256sum {{ .PACKAGE_NAME }} >> {{ .CHECKSUM_FILE }}
177+
178+
vars:
179+
PLATFORM_DIR: "{{ .PROJECT_NAME }}_linux_arm_6"
180+
BUILD_COMMAND: "go build -o {{ .DIST_DIR }}/{{ .PLATFORM_DIR }}/{{ .PROJECT_NAME }} {{ .LDFLAGS }}"
181+
BUILD_PLATFORM: "linux/arm64"
182+
CONTAINER_TAG: "{{ .GO_VERSION }}-arm"
183+
PACKAGE_PLATFORM: "Linux_ARM64"
184+
PACKAGE_NAME: "{{ .PROJECT_NAME }}_{{ .VERSION }}_{{ .PACKAGE_PLATFORM }}.tar.gz"
185+
186+
macOS_64bit:
187+
desc: Builds Mac OS X 64 bit binaries
188+
dir: "{{ .DIST_DIR }}"
189+
cmds:
190+
- |
191+
docker run -v `pwd`/..:/home/build -w /home/build \
192+
-e CGO_ENABLED=1 \
193+
{{ .CONTAINER }}:{{ .CONTAINER_TAG }} \
194+
--build-cmd "{{ .BUILD_COMMAND }}" \
195+
-p "{{ .BUILD_PLATFORM }}"
196+
197+
tar cz -C {{ .PLATFORM_DIR }} {{ .PROJECT_NAME }} -C ../.. LICENSE.txt -f {{ .PACKAGE_NAME }}
198+
sha256sum {{ .PACKAGE_NAME }} >> {{ .CHECKSUM_FILE }}
199+
200+
vars:
201+
PLATFORM_DIR: "{{ .PROJECT_NAME }}_osx_darwin_amd64"
202+
BUILD_COMMAND: "go build -o {{ .DIST_DIR }}/{{ .PLATFORM_DIR }}/{{ .PROJECT_NAME }} {{ .LDFLAGS }}"
203+
BUILD_PLATFORM: "darwin/amd64"
204+
CONTAINER_TAG: "{{ .GO_VERSION }}-darwin"
205+
PACKAGE_PLATFORM: "macOS_64bit"
206+
PACKAGE_NAME: "{{ .PROJECT_NAME }}_{{ .VERSION }}_{{ .PACKAGE_PLATFORM }}.tar.gz"
207+
208+
vars:
209+
CONTAINER: "docker.elastic.co/beats-dev/golang-crossbuild"
210+
GO_VERSION: "1.14.7"
211+
CHECKSUM_FILE: "{{ .VERSION }}-checksums.txt"

‎Dockerfiles/builder/Dockerfile

Lines changed: 0 additions & 16 deletions
This file was deleted.

‎Taskfile.yml

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
version: "2"
1+
version: "3"
2+
3+
includes:
4+
dist: ./DistTasks.yml
25

36
tasks:
47
docs:gen:commands:
@@ -196,25 +199,39 @@ tasks:
196199
- git diff --exit-code ./i18n/data &> /dev/null || (cd ./i18n && rice embed-go)
197200

198201
vars:
202+
PROJECT_NAME: "arduino-cli"
203+
DIST_DIR: "dist"
199204
# all modules of this project except for "legacy/..." module
200205
DEFAULT_TARGETS:
201206
sh: echo `go list ./... | grep -v legacy | tr '\n' ' '`
202207
# build vars
203208
COMMIT:
204-
sh: echo ${TRAVIS_COMMIT:-`git log -n 1 --format=%h`}
209+
sh: echo "$(git log -n 1 --format=%h)"
205210
TIMESTAMP:
206211
sh: echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
212+
TIMESTAMP_SHORT:
213+
sh: echo "{{now | date "20060102"}}"
214+
TAG:
215+
sh: echo "`git tag --points-at=HEAD 2> /dev/null`"
216+
VERSION: "{{ if .NIGHTLY }}nightly-{{ .TIMESTAMP_SHORT }}{{ else if .TAG }}{{ .TAG }}{{ else }}{{ .PACKAGE_NAME_PREFIX }}git-snapshot{{ end }}"
207217
LDFLAGS: >
208-
-ldflags '-X github.com/arduino/arduino-cli/version.commit={{.COMMIT}}
209-
-X github.com/arduino/arduino-cli/version.date={{.TIMESTAMP}}'
218+
-ldflags
219+
'
220+
-X github.com/arduino/arduino-cli/version.versionString={{.VERSION}}
221+
-X github.com/arduino/arduino-cli/version.commit={{ .COMMIT }}
222+
-X github.com/arduino/arduino-cli/version.date={{.TIMESTAMP}}
223+
'
210224
# test vars
211225
GOFLAGS: "-timeout 10m -v -coverpkg=./... -covermode=atomic"
212-
TEST_VERSIONSTRING: "0.0.0-test.preview"
226+
TEST_VERSION: "0.0.0-test.preview"
213227
TEST_COMMIT: "deadbeef"
214228
TEST_LDFLAGS: >
215-
-ldflags '-X github.com/arduino/arduino-cli/version.versionString={{.TEST_VERSIONSTRING}}
229+
-ldflags
230+
'
231+
-X github.com/arduino/arduino-cli/version.versionString={{.TEST_VERSION}}
216232
-X github.com/arduino/arduino-cli/version.commit={{.TEST_COMMIT}}
217-
-X github.com/arduino/arduino-cli/version.date={{.TIMESTAMP}}'
233+
-X github.com/arduino/arduino-cli/version.date={{.TIMESTAMP}}
234+
'
218235
# check-lint vars
219236
GOLINTBIN:
220237
sh: go list -f {{"{{"}}".Target{{"}}"}}" golang.org/x/lint/golint

‎docs/installation.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,14 @@ If you’re familiar with Golang or if you want to contribute to the project, yo
106106
locally with your Go toolchain. Please refer to the [CONTRIBUTING] document for setup instructions.
107107

108108
If you don’t have a working Golang environment or if you want to build `arduino-cli` targeting different platforms, you
109-
can use Docker to get a binary directly from sources. From the project folder run:
109+
can use [Task][task-site] to get a binary directly from sources. From the project folder run:
110110

111111
```sh
112-
docker run -v $PWD:/arduino-cli -w /arduino-cli -e PACKAGE_NAME_PREFIX='snapshot' arduino/arduino-cli:builder-1 goreleaser --rm-dist --snapshot --skip-publish
112+
task dist:all
113113
```
114114

115115
Once the build is over, you will find a `./dist/` folder containing the packages built out of the current source tree.
116116

117117
[git for windows]: https://gitforwindows.org/
118118
[contributing]: CONTRIBUTING.md
119+
[task-site]: https://taskfile.dev/#/installation

‎gon.config.hcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
source = ["dist/arduino_cli_osx_darwin_amd64/arduino-cli"]
1+
source = ["dist/arduino-cli_osx_darwin_amd64/arduino-cli"]
22
bundle_id = "cc.arduino.arduino-cli"
33

44
sign {

‎poetry.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ authors = []
88
python = "^3.8"
99
pytest = "6.0.2"
1010
simplejson = "3.17.0"
11-
semver = "2.9.0"
11+
semver = "2.13.0"
1212
pyserial = "3.4"
1313
pyyaml = "5.3"
1414
prometheus-client = "0.7.1"

‎test/test_main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ def test_version(run_command):
3737
assert result.ok
3838
parsed_out = json.loads(result.stdout)
3939
assert parsed_out.get("Application", False) == "arduino-cli"
40-
assert isinstance(semver.parse(parsed_out.get("VersionString", False)), dict)
40+
version = parsed_out.get("VersionString", False)
41+
assert semver.VersionInfo.isvalid(version=version) or "git-snapshot" in version or "nightly" in version
4142
assert isinstance(parsed_out.get("Commit", False), str)
4243

4344

0 commit comments

Comments
 (0)
Please sign in to comment.