Unverified Commit 079bb6c6 authored by Silvano Cerza's avatar Silvano Cerza Committed by GitHub

[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
parent d996b156
...@@ -24,6 +24,7 @@ jobs: ...@@ -24,6 +24,7 @@ jobs:
uses: Arduino/actions/setup-taskfile@master uses: Arduino/actions/setup-taskfile@master
with: with:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x
- name: Run task i18n:push - name: Run task i18n:push
run: task i18n:push run: task i18n:push
......
...@@ -28,6 +28,7 @@ jobs: ...@@ -28,6 +28,7 @@ jobs:
uses: Arduino/actions/setup-taskfile@master uses: Arduino/actions/setup-taskfile@master
with: with:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x
- name: Run task i18n:pull - name: Run task i18n:pull
run: task i18n:pull run: task i18n:pull
......
...@@ -20,6 +20,7 @@ jobs: ...@@ -20,6 +20,7 @@ jobs:
uses: Arduino/actions/setup-taskfile@master uses: Arduino/actions/setup-taskfile@master
with: with:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x
- name: Install Go - name: Install Go
uses: actions/setup-go@v2 uses: actions/setup-go@v2
......
...@@ -12,22 +12,22 @@ jobs: ...@@ -12,22 +12,22 @@ jobs:
if: github.repository == 'arduino/arduino-cli' if: github.repository == 'arduino/arduino-cli'
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: arduino/arduino-cli:builder-1
volumes:
# cache go dependencies across pipeline's steps
- ${{ github.workspace }}/go:/go
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v1 uses: actions/checkout@v1
with: with:
fetch-depth: 0 fetch-depth: 0
- name: build - name: Install Taskfile
uses: arduino/actions/setup-taskfile@master
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x
- name: Build
env: env:
PACKAGE_NAME_PREFIX: ${{ github.workflow }} NIGHTLY: true
run: goreleaser --snapshot run: task dist:all
- name: Upload artifacts - name: Upload artifacts
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
...@@ -77,14 +77,14 @@ jobs: ...@@ -77,14 +77,14 @@ jobs:
- name: Re-package binary and update checksum - name: Re-package binary and update checksum
# This step performs the following: # This step performs the following:
# 1. Repackage the signed binary replaced in place by Gon (ignoring the output zip file) # 1. Repackage the signed binary replaced in place by Gon (ignoring the output zip file)
# 2. Recalculate package checksum and replace it in the goreleaser nnnnnn-checksums.txt file # 2. Recalculate package checksum and replace it in the nnnnnn-checksums.txt file
run: | run: |
# GitHub's upload/download-artifact@v1 actions don't preserve file permissions, # GitHub's upload/download-artifact@v1 actions don't preserve file permissions,
# so we need to add execution permission back until @v2 actions are released. # so we need to add execution permission back until @v2 actions are released.
chmod +x dist/arduino_cli_osx_darwin_amd64/arduino-cli chmod +x dist/arduino-cli_osx_darwin_amd64/arduino-cli
PACKAGE_FILENAME="$(basename dist/arduino-cli_${{ github.workflow }}-*_macOS_64bit.tar.gz)" PACKAGE_FILENAME="$(basename dist/arduino-cli_${{ github.workflow }}-*_macOS_64bit.tar.gz)"
tar -czvf dist/$PACKAGE_FILENAME \ tar -czvf dist/$PACKAGE_FILENAME \
-C dist/arduino_cli_osx_darwin_amd64/ arduino-cli \ -C dist/arduino-cli_osx_darwin_amd64/ arduino-cli \
-C ../../ LICENSE.txt -C ../../ LICENSE.txt
CLI_CHECKSUM=$(shasum -a 256 dist/$PACKAGE_FILENAME | cut -d " " -f 1) CLI_CHECKSUM=$(shasum -a 256 dist/$PACKAGE_FILENAME | cut -d " " -f 1)
perl -pi -w -e "s/.*${PACKAGE_FILENAME}/${CLI_CHECKSUM} ${PACKAGE_FILENAME}/g;" dist/*-checksums.txt perl -pi -w -e "s/.*${PACKAGE_FILENAME}/${CLI_CHECKSUM} ${PACKAGE_FILENAME}/g;" dist/*-checksums.txt
......
...@@ -47,6 +47,7 @@ jobs: ...@@ -47,6 +47,7 @@ jobs:
uses: Arduino/actions/setup-taskfile@master uses: Arduino/actions/setup-taskfile@master
with: with:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x
- name: Setup Go - name: Setup Go
uses: actions/setup-go@v2 uses: actions/setup-go@v2
......
...@@ -23,6 +23,7 @@ jobs: ...@@ -23,6 +23,7 @@ jobs:
uses: Arduino/actions/setup-taskfile@master uses: Arduino/actions/setup-taskfile@master
with: with:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x
- name: Activate Python - name: Activate Python
uses: actions/setup-python@v1 uses: actions/setup-python@v1
......
...@@ -9,20 +9,28 @@ jobs: ...@@ -9,20 +9,28 @@ jobs:
create-release-artifacts: create-release-artifacts:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: arduino/arduino-cli:builder-1
volumes:
# cache go dependencies across pipeline's steps
- ${{ github.workspace }}/go:/go
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v1 uses: actions/checkout@v1
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Create changelog
uses: arduino/create-changelog@1.2.0
with:
tag-regex: '^[0-9]+\.[0-9]+\.[0-9]+$'
filter-regex: '^\[(skip|changelog)[ ,-](skip|changelog)\].*'
case-insensitive-regex: true
changelog-file-path: "dist/CHANGELOG.md"
- name: Install Taskfile
uses: arduino/actions/setup-taskfile@master
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x
- name: Build - name: Build
run: goreleaser run: task dist:all
- name: Upload artifacts - name: Upload artifacts
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
...@@ -72,14 +80,14 @@ jobs: ...@@ -72,14 +80,14 @@ jobs:
- name: Re-package binary and update checksum - name: Re-package binary and update checksum
# This step performs the following: # This step performs the following:
# 1. Repackage the signed binary replaced in place by Gon (ignoring the output zip file) # 1. Repackage the signed binary replaced in place by Gon (ignoring the output zip file)
# 2. Recalculate package checksum and replace it in the goreleaser nnnnnn-checksums.txt file # 2. Recalculate package checksum and replace it in the nnnnnn-checksums.txt file
run: | run: |
# GitHub's upload/download-artifact@v1 actions don't preserve file permissions, # GitHub's upload/download-artifact@v1 actions don't preserve file permissions,
# so we need to add execution permission back until @v2 actions are released. # so we need to add execution permission back until @v2 actions are released.
chmod +x dist/arduino_cli_osx_darwin_amd64/arduino-cli chmod +x dist/arduino-cli_osx_darwin_amd64/arduino-cli
TAG=${GITHUB_REF/refs\/tags\//} TAG=${GITHUB_REF/refs\/tags\//}
tar -czvf dist/arduino-cli_${TAG}_macOS_64bit.tar.gz \ tar -czvf dist/arduino-cli_${TAG}_macOS_64bit.tar.gz \
-C dist/arduino_cli_osx_darwin_amd64/ arduino-cli \ -C dist/arduino-cli_osx_darwin_amd64/ arduino-cli \
-C ../../ LICENSE.txt -C ../../ LICENSE.txt
CLI_CHECKSUM=$(shasum -a 256 dist/arduino-cli_${TAG}_macOS_64bit.tar.gz | cut -d " " -f 1) CLI_CHECKSUM=$(shasum -a 256 dist/arduino-cli_${TAG}_macOS_64bit.tar.gz | cut -d " " -f 1)
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 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
......
...@@ -39,6 +39,7 @@ jobs: ...@@ -39,6 +39,7 @@ jobs:
uses: Arduino/actions/setup-taskfile@master uses: Arduino/actions/setup-taskfile@master
with: with:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x
- name: Install Python - name: Install Python
uses: actions/setup-python@v1 uses: actions/setup-python@v1
...@@ -105,28 +106,27 @@ jobs: ...@@ -105,28 +106,27 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: test-matrix needs: test-matrix
container:
image: arduino/arduino-cli:builder-1
volumes:
# cache go dependencies across pipeline's steps
- ${{ github.workspace }}/go:/go
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v1 uses: actions/checkout@v1
with: with:
fetch-depth: 0 fetch-depth: 0
- name: build - name: Install Taskfile
shell: bash uses: arduino/actions/setup-taskfile@master
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x
- name: Build
run: | run: |
PACKAGE_NAME_PREFIX="${{ github.workflow }}" PACKAGE_NAME_PREFIX="${{ github.workflow }}"
if [ "${{ github.event_name }}" = "pull_request" ]; then if [ "${{ github.event_name }}" = "pull_request" ]; then
PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.event.number }}" PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.event.number }}"
fi fi
PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.sha }}" PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.sha }}-"
export PACKAGE_NAME_PREFIX export PACKAGE_NAME_PREFIX
goreleaser --snapshot task dist:all
# Uploads all architectures as separate artifacts # Uploads all architectures as separate artifacts
- name: Upload Linux 32 bit artifact - name: Upload Linux 32 bit artifact
......
...@@ -34,6 +34,7 @@ jobs: ...@@ -34,6 +34,7 @@ jobs:
uses: Arduino/actions/setup-taskfile@master uses: Arduino/actions/setup-taskfile@master
with: with:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x
- name: Setup Go - name: Setup Go
uses: actions/setup-go@v2 uses: actions/setup-go@v2
......
...@@ -28,6 +28,7 @@ jobs: ...@@ -28,6 +28,7 @@ jobs:
uses: Arduino/actions/setup-taskfile@master uses: Arduino/actions/setup-taskfile@master
with: with:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x
- name: Verify formatting of all files - name: Verify formatting of all files
run: task docs:check config:check run: task docs:check config:check
# Global section
checksum:
name_template: '{{ .Tag }}-{{ time "20060102" }}-checksums.txt'
snapshot:
name_template: '{{ .Env.PACKAGE_NAME_PREFIX }}-{{ time "20060102" }}'
release:
disable: true
changelog:
filters:
exclude:
# [skip changelog], [skip-changelog], [changelog skip], [changelog-skip]
- '^(?i)\[(skip|changelog)[ ,-](skip|changelog)\].*'
# [skip ci], [skip-ci], [ci skip], [ci-skip]
- '^(?i)\[(skip|ci)[ ,-](skip|ci)\].*'
# We have multiple builds in order to fine tune
# cross compilations.
builds:
- # OSX
id: arduino_cli_osx
binary: arduino-cli
env:
- CGO_ENABLED=1
- CXXFLAGS="-mmacosx-version-min=10.10"
- CC=/usr/x86_64-apple-darwin14/bin/cc
goos:
- darwin
goarch:
- amd64
ldflags:
- -s -w
- -X github.com/arduino/arduino-cli/version.versionString={{.Tag}}
- -X github.com/arduino/arduino-cli/version.commit={{ .ShortCommit }}
- -X github.com/arduino/arduino-cli/version.date={{.Date}}
- # ARM
id: arduino_cli_arm
binary: arduino-cli
env:
- CGO_ENABLED=1
- CC=/usr/arm-linux-gnueabi/bin/cc
goos:
- linux
goarch:
- arm
goarm:
- 6
ldflags:
- -s -w
- -X github.com/arduino/arduino-cli/version.versionString={{.Tag}}
- -X github.com/arduino/arduino-cli/version.commit={{ .ShortCommit }}
- -X github.com/arduino/arduino-cli/version.date={{.Date}}
- "-extldflags '-static'"
- # ARMv7
id: arduino_cli_armv7
binary: arduino-cli
env:
- CGO_ENABLED=1
- CC=/usr/arm-linux-gnueabihf/bin/cc
goos:
- linux
goarch:
- arm
goarm:
- 7
ldflags:
- -s -w
- -X github.com/arduino/arduino-cli/version.versionString={{.Tag}}
- -X github.com/arduino/arduino-cli/version.commit={{ .ShortCommit }}
- -X github.com/arduino/arduino-cli/version.date={{.Date}}
- "-extldflags '-static'"
- # ARM64
id: arduino_cli_arm64
binary: arduino-cli
env:
- CGO_ENABLED=1
- CC=/usr/aarch64-linux-gnu/bin/cc
goos:
- linux
goarch:
- arm64
ldflags:
- -s -w
- -X github.com/arduino/arduino-cli/version.versionString={{.Tag}}
- -X github.com/arduino/arduino-cli/version.commit={{ .ShortCommit }}
- -X github.com/arduino/arduino-cli/version.date={{.Date}}
- "-extldflags '-static'"
- # All the other platforms
id: arduino_cli
binary: arduino-cli
env:
- CGO_ENABLED=0
goos:
- linux
- windows
goarch:
- amd64
- 386
ldflags:
- -s -w
- -X github.com/arduino/arduino-cli/version.versionString={{.Tag}}
- -X github.com/arduino/arduino-cli/version.commit={{ .ShortCommit }}
- -X github.com/arduino/arduino-cli/version.date={{.Date}}
- "-extldflags '-static'"
archives:
- id: "arduino_cli"
format: tar.gz
format_overrides:
- goos: windows
format: zip
replacements:
amd64: 64bit
darwin: macOS
386: 32bit
arm: ARM
arm64: ARM64
linux: Linux
windows: Windows
files:
- LICENSE.txt
version: "3"
# This taskfile is ideally meant to be project agnostic and could be dropped in
# on other Go projects with minimal or no changes.
#
# To use it simply add the following lines to your main taskfile:
# includes:
# dist: ./DistTasks.yml
#
# The following variables must be declared in the including taskfile for the
# build process to work correctly:
# * DIST_DIR: the folder that will contain the final binaries and packages
# * PROJECT_NAME: the name of the project, used in package name
# * VERSION: the version of the project, used in package name and checksum file
# * LD_FLAGS: flags used at build time
#
# The project MUST contain a LICENSE.txt file in the root folder or packaging will fail.
tasks:
all:
desc: Build for distribution for all platforms
cmds:
- task: Windows_32bit
- task: Windows_64bit
- task: Linux_32bit
- task: Linux_64bit
- task: Linux_ARMv6
- task: Linux_ARMv7
- task: Linux_ARM64
- task: macOS_64bit
Windows_32bit:
desc: Builds Windows 32 bit binaries
dir: "{{ .DIST_DIR }}"
cmds:
- |
docker run -v `pwd`/..:/home/build -w /home/build \
-e CGO_ENABLED=1 \
{{ .CONTAINER }}:{{ .CONTAINER_TAG }} \
--build-cmd "{{ .BUILD_COMMAND }}" \
-p "{{ .BUILD_PLATFORM }}"
zip {{ .PACKAGE_NAME}} {{ .PLATFORM_DIR }}/{{ .PROJECT_NAME }}.exe ../LICENSE.txt -j
sha256sum {{ .PACKAGE_NAME }} >> {{ .CHECKSUM_FILE }}
vars:
PLATFORM_DIR: "{{ .PROJECT_NAME }}_windows_386"
BUILD_COMMAND: "go build -o {{ .DIST_DIR }}/{{ .PLATFORM_DIR }}/{{ .PROJECT_NAME }}.exe {{ .LDFLAGS }}"
BUILD_PLATFORM: "windows/386"
CONTAINER_TAG: "{{ .GO_VERSION }}-main"
PACKAGE_PLATFORM: "Windows_32bit"
PACKAGE_NAME: "{{ .PROJECT_NAME }}_{{ .VERSION }}_{{ .PACKAGE_PLATFORM }}.zip"
Windows_64bit:
desc: Builds Windows 64 bit binaries
dir: "{{ .DIST_DIR }}"
cmds:
- |
docker run -v `pwd`/..:/home/build -w /home/build \
-e CGO_ENABLED=1 \
{{ .CONTAINER }}:{{ .CONTAINER_TAG }} \
--build-cmd "{{ .BUILD_COMMAND }}" \
-p "{{ .BUILD_PLATFORM }}"
zip {{ .PACKAGE_NAME}} {{ .PLATFORM_DIR }}/{{ .PROJECT_NAME }}.exe ../LICENSE.txt -j
sha256sum {{ .PACKAGE_NAME }} >> {{ .CHECKSUM_FILE }}
vars:
PLATFORM_DIR: "{{ .PROJECT_NAME }}_windows_amd64"
BUILD_COMMAND: "go build -o {{ .DIST_DIR }}/{{ .PLATFORM_DIR }}/{{ .PROJECT_NAME }}.exe {{ .LDFLAGS }}"
BUILD_PLATFORM: "windows/amd64"
CONTAINER_TAG: "{{ .GO_VERSION }}-main"
PACKAGE_PLATFORM: "Windows_64bit"
PACKAGE_NAME: "{{ .PROJECT_NAME }}_{{ .VERSION }}_{{ .PACKAGE_PLATFORM }}.zip"
Linux_32bit:
desc: Builds Linux 32 bit binaries
dir: "{{ .DIST_DIR }}"
cmds:
- |
docker run -v `pwd`/..:/home/build -w /home/build \
-e CGO_ENABLED=1 \
{{ .CONTAINER }}:{{ .CONTAINER_TAG }} \
--build-cmd "{{ .BUILD_COMMAND }}" \
-p "{{ .BUILD_PLATFORM }}"
tar cz -C {{ .PLATFORM_DIR }} {{ .PROJECT_NAME }} -C ../.. LICENSE.txt -f {{ .PACKAGE_NAME }}
sha256sum {{ .PACKAGE_NAME }} >> {{ .CHECKSUM_FILE }}
vars:
PLATFORM_DIR: "{{ .PROJECT_NAME }}_linux_amd32"
BUILD_COMMAND: "go build -o {{ .DIST_DIR }}/{{ .PLATFORM_DIR }}/{{ .PROJECT_NAME }} {{ .LDFLAGS }}"
BUILD_PLATFORM: "linux/386"
CONTAINER_TAG: "{{ .GO_VERSION }}-main"
PACKAGE_PLATFORM: "Linux_32bit"
PACKAGE_NAME: "{{ .PROJECT_NAME }}_{{ .VERSION }}_{{ .PACKAGE_PLATFORM }}.tar.gz"
Linux_64bit:
desc: Builds Linux 64 bit binaries
dir: "{{ .DIST_DIR }}"
cmds:
- |
docker run -v `pwd`/..:/home/build -w /home/build \
-e CGO_ENABLED=1 \
{{ .CONTAINER }}:{{ .CONTAINER_TAG }} \
--build-cmd "{{ .BUILD_COMMAND }}" \
-p "{{ .BUILD_PLATFORM }}"
tar cz -C {{ .PLATFORM_DIR }} {{ .PROJECT_NAME }} -C ../.. LICENSE.txt -f {{ .PACKAGE_NAME }}
sha256sum {{ .PACKAGE_NAME }} >> {{ .CHECKSUM_FILE }}
vars:
PLATFORM_DIR: "{{ .PROJECT_NAME }}_linux_amd64"
BUILD_COMMAND: "go build -o {{ .DIST_DIR }}/{{ .PLATFORM_DIR }}/{{ .PROJECT_NAME }} {{ .LDFLAGS }}"
BUILD_PLATFORM: "linux/amd64"
CONTAINER_TAG: "{{ .GO_VERSION }}-main"
PACKAGE_PLATFORM: "Linux_64bit"
PACKAGE_NAME: "{{ .PROJECT_NAME }}_{{ .VERSION }}_{{ .PACKAGE_PLATFORM }}.tar.gz"
Linux_ARMv7:
desc: Builds Linux ARMv7 binaries
dir: "{{ .DIST_DIR }}"
cmds:
- |
docker run -v `pwd`/..:/home/build -w /home/build \
-e CGO_ENABLED=1 \
{{ .CONTAINER }}:{{ .CONTAINER_TAG }} \
--build-cmd "{{ .BUILD_COMMAND }}" \
-p "{{ .BUILD_PLATFORM }}"
tar cz -C {{ .PLATFORM_DIR }} {{ .PROJECT_NAME }} -C ../.. LICENSE.txt -f {{ .PACKAGE_NAME }}
sha256sum {{ .PACKAGE_NAME }} >> {{ .CHECKSUM_FILE }}
vars:
PLATFORM_DIR: "{{ .PROJECT_NAME }}_linux_arm_7"
BUILD_COMMAND: "go build -o {{ .DIST_DIR }}/{{ .PLATFORM_DIR }}/{{ .PROJECT_NAME }} {{ .LDFLAGS }}"
BUILD_PLATFORM: "linux/armv7"
CONTAINER_TAG: "{{ .GO_VERSION }}-arm"
PACKAGE_PLATFORM: "Linux_ARMv7"
PACKAGE_NAME: "{{ .PROJECT_NAME }}_{{ .VERSION }}_{{ .PACKAGE_PLATFORM }}.tar.gz"
Linux_ARMv6:
desc: Builds Linux ARMv6 binaries
dir: "{{ .DIST_DIR }}"
cmds:
- |
docker run -v `pwd`/..:/home/build -w /home/build \
-e CGO_ENABLED=1 \
{{ .CONTAINER }}:{{ .CONTAINER_TAG }} \
--build-cmd "{{ .BUILD_COMMAND }}" \
-p "{{ .BUILD_PLATFORM }}"
tar cz -C {{ .PLATFORM_DIR }} {{ .PROJECT_NAME }} -C ../.. LICENSE.txt -f {{ .PACKAGE_NAME }}
sha256sum {{ .PACKAGE_NAME }} >> {{ .CHECKSUM_FILE }}
vars:
PLATFORM_DIR: "{{ .PROJECT_NAME }}_linux_arm_6"
BUILD_COMMAND: "go build -o {{ .DIST_DIR }}/{{ .PLATFORM_DIR }}/{{ .PROJECT_NAME }} {{ .LDFLAGS }}"
BUILD_PLATFORM: "linux/armv6"
CONTAINER_TAG: "{{ .GO_VERSION }}-arm"
PACKAGE_PLATFORM: "Linux_ARMv6"
PACKAGE_NAME: "{{ .PROJECT_NAME }}_{{ .VERSION }}_{{ .PACKAGE_PLATFORM }}.tar.gz"
Linux_ARM64:
desc: Builds Linux ARM64 binaries
dir: "{{ .DIST_DIR }}"
cmds:
- |
docker run -v `pwd`/..:/home/build -w /home/build \
-e CGO_ENABLED=1 \
{{ .CONTAINER }}:{{ .CONTAINER_TAG }} \
--build-cmd "{{ .BUILD_COMMAND }}" \
-p "{{ .BUILD_PLATFORM }}"
tar cz -C {{ .PLATFORM_DIR }} {{ .PROJECT_NAME }} -C ../.. LICENSE.txt -f {{ .PACKAGE_NAME }}
sha256sum {{ .PACKAGE_NAME }} >> {{ .CHECKSUM_FILE }}
vars:
PLATFORM_DIR: "{{ .PROJECT_NAME }}_linux_arm_6"
BUILD_COMMAND: "go build -o {{ .DIST_DIR }}/{{ .PLATFORM_DIR }}/{{ .PROJECT_NAME }} {{ .LDFLAGS }}"
BUILD_PLATFORM: "linux/arm64"
CONTAINER_TAG: "{{ .GO_VERSION }}-arm"
PACKAGE_PLATFORM: "Linux_ARM64"
PACKAGE_NAME: "{{ .PROJECT_NAME }}_{{ .VERSION }}_{{ .PACKAGE_PLATFORM }}.tar.gz"
macOS_64bit:
desc: Builds Mac OS X 64 bit binaries
dir: "{{ .DIST_DIR }}"
cmds:
- |
docker run -v `pwd`/..:/home/build -w /home/build \
-e CGO_ENABLED=1 \
{{ .CONTAINER }}:{{ .CONTAINER_TAG }} \
--build-cmd "{{ .BUILD_COMMAND }}" \
-p "{{ .BUILD_PLATFORM }}"
tar cz -C {{ .PLATFORM_DIR }} {{ .PROJECT_NAME }} -C ../.. LICENSE.txt -f {{ .PACKAGE_NAME }}
sha256sum {{ .PACKAGE_NAME }} >> {{ .CHECKSUM_FILE }}
vars:
PLATFORM_DIR: "{{ .PROJECT_NAME }}_osx_darwin_amd64"
BUILD_COMMAND: "go build -o {{ .DIST_DIR }}/{{ .PLATFORM_DIR }}/{{ .PROJECT_NAME }} {{ .LDFLAGS }}"
BUILD_PLATFORM: "darwin/amd64"
CONTAINER_TAG: "{{ .GO_VERSION }}-darwin"
PACKAGE_PLATFORM: "macOS_64bit"
PACKAGE_NAME: "{{ .PROJECT_NAME }}_{{ .VERSION }}_{{ .PACKAGE_PLATFORM }}.tar.gz"
vars:
CONTAINER: "docker.elastic.co/beats-dev/golang-crossbuild"
GO_VERSION: "1.14.7"
CHECKSUM_FILE: "{{ .VERSION }}-checksums.txt"
FROM multiarch/crossbuild
ENV PATH $PATH:/usr/local/go/bin
# Install tooling
ENV GORELEASER_VER 0.113.0
ENV GORELEASER_SHA 2379beebb6369b75ccead7f7a43269de700b51821feae3857701d106ed72bd63
ENV GOVER 1.14
RUN set -ex \
&& curl -o goreleaser.tar.gz -LO https://github.com/goreleaser/goreleaser/releases/download/v${GORELEASER_VER}/goreleaser_Linux_x86_64.tar.gz \
&& echo "$GORELEASER_SHA goreleaser.tar.gz" | sha256sum -c - || exit 1 \
&& tar -xzf goreleaser.tar.gz -C /usr/bin/ goreleaser \
&& rm goreleaser.tar.gz \
&& curl -LO https://dl.google.com/go/go${GOVER}.linux-amd64.tar.gz \
&& tar -C /usr/local -xzf go${GOVER}.linux-amd64.tar.gz \
&& rm go${GOVER}.linux-amd64.tar.gz
version: "2" version: "3"
includes:
dist: ./DistTasks.yml
tasks: tasks:
docs:gen:commands: docs:gen:commands:
...@@ -196,25 +199,39 @@ tasks: ...@@ -196,25 +199,39 @@ tasks:
- git diff --exit-code ./i18n/data &> /dev/null || (cd ./i18n && rice embed-go) - git diff --exit-code ./i18n/data &> /dev/null || (cd ./i18n && rice embed-go)
vars: vars:
PROJECT_NAME: "arduino-cli"
DIST_DIR: "dist"
# all modules of this project except for "legacy/..." module # all modules of this project except for "legacy/..." module
DEFAULT_TARGETS: DEFAULT_TARGETS:
sh: echo `go list ./... | grep -v legacy | tr '\n' ' '` sh: echo `go list ./... | grep -v legacy | tr '\n' ' '`
# build vars # build vars
COMMIT: COMMIT:
sh: echo ${TRAVIS_COMMIT:-`git log -n 1 --format=%h`} sh: echo "$(git log -n 1 --format=%h)"
TIMESTAMP: TIMESTAMP:
sh: echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" sh: echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
TIMESTAMP_SHORT:
sh: echo "{{now | date "20060102"}}"
TAG:
sh: echo "`git tag --points-at=HEAD 2> /dev/null`"
VERSION: "{{ if .NIGHTLY }}nightly-{{ .TIMESTAMP_SHORT }}{{ else if .TAG }}{{ .TAG }}{{ else }}{{ .PACKAGE_NAME_PREFIX }}git-snapshot{{ end }}"
LDFLAGS: > LDFLAGS: >
-ldflags '-X github.com/arduino/arduino-cli/version.commit={{.COMMIT}} -ldflags
-X github.com/arduino/arduino-cli/version.date={{.TIMESTAMP}}' '
-X github.com/arduino/arduino-cli/version.versionString={{.VERSION}}
-X github.com/arduino/arduino-cli/version.commit={{ .COMMIT }}
-X github.com/arduino/arduino-cli/version.date={{.TIMESTAMP}}
'
# test vars # test vars
GOFLAGS: "-timeout 10m -v -coverpkg=./... -covermode=atomic" GOFLAGS: "-timeout 10m -v -coverpkg=./... -covermode=atomic"
TEST_VERSIONSTRING: "0.0.0-test.preview" TEST_VERSION: "0.0.0-test.preview"
TEST_COMMIT: "deadbeef" TEST_COMMIT: "deadbeef"
TEST_LDFLAGS: > TEST_LDFLAGS: >
-ldflags '-X github.com/arduino/arduino-cli/version.versionString={{.TEST_VERSIONSTRING}} -ldflags
'
-X github.com/arduino/arduino-cli/version.versionString={{.TEST_VERSION}}
-X github.com/arduino/arduino-cli/version.commit={{.TEST_COMMIT}} -X github.com/arduino/arduino-cli/version.commit={{.TEST_COMMIT}}
-X github.com/arduino/arduino-cli/version.date={{.TIMESTAMP}}' -X github.com/arduino/arduino-cli/version.date={{.TIMESTAMP}}
'
# check-lint vars # check-lint vars
GOLINTBIN: GOLINTBIN:
sh: go list -f {{"{{"}}".Target{{"}}"}}" golang.org/x/lint/golint sh: go list -f {{"{{"}}".Target{{"}}"}}" golang.org/x/lint/golint
......
...@@ -106,13 +106,14 @@ If you’re familiar with Golang or if you want to contribute to the project, yo ...@@ -106,13 +106,14 @@ If you’re familiar with Golang or if you want to contribute to the project, yo
locally with your Go toolchain. Please refer to the [CONTRIBUTING] document for setup instructions. locally with your Go toolchain. Please refer to the [CONTRIBUTING] document for setup instructions.
If you don’t have a working Golang environment or if you want to build `arduino-cli` targeting different platforms, you If you don’t have a working Golang environment or if you want to build `arduino-cli` targeting different platforms, you
can use Docker to get a binary directly from sources. From the project folder run: can use [Task][task-site] to get a binary directly from sources. From the project folder run:
```sh ```sh
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 task dist:all
``` ```
Once the build is over, you will find a `./dist/` folder containing the packages built out of the current source tree. Once the build is over, you will find a `./dist/` folder containing the packages built out of the current source tree.
[git for windows]: https://gitforwindows.org/ [git for windows]: https://gitforwindows.org/
[contributing]: CONTRIBUTING.md [contributing]: CONTRIBUTING.md
[task-site]: https://taskfile.dev/#/installation
source = ["dist/arduino_cli_osx_darwin_amd64/arduino-cli"] source = ["dist/arduino-cli_osx_darwin_amd64/arduino-cli"]
bundle_id = "cc.arduino.arduino-cli" bundle_id = "cc.arduino.arduino-cli"
sign { sign {
......
...@@ -381,11 +381,11 @@ socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"] ...@@ -381,11 +381,11 @@ socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"]
[[package]] [[package]]
name = "semver" name = "semver"
version = "2.9.0" version = "2.13.0"
description = "Python helper for Semantic Versioning (http://semver.org/)" description = "Python helper for Semantic Versioning (http://semver.org/)"
category = "main" category = "main"
optional = false optional = false
python-versions = "*" python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
[[package]] [[package]]
name = "simplejson" name = "simplejson"
...@@ -455,7 +455,7 @@ watchdog = ["watchdog"] ...@@ -455,7 +455,7 @@ watchdog = ["watchdog"]
[metadata] [metadata]
lock-version = "1.1" lock-version = "1.1"
python-versions = "^3.8" python-versions = "^3.8"
content-hash = "366ed44051d9d750af552310f355cb4fd48eee3169bd011ef5c5fb61852e82d0" content-hash = "a987a9f86a55ef8203013e0da6ce71788ff7cf6e96ea44b76c8f1e1b00a17dc2"
[metadata.files] [metadata.files]
apipkg = [ apipkg = [
...@@ -631,8 +631,8 @@ requests = [ ...@@ -631,8 +631,8 @@ requests = [
{file = "requests-2.22.0.tar.gz", hash = "sha256:11e007a8a2aa0323f5a921e9e6a2d7e4e67d9877e85773fba9ba6419025cbeb4"}, {file = "requests-2.22.0.tar.gz", hash = "sha256:11e007a8a2aa0323f5a921e9e6a2d7e4e67d9877e85773fba9ba6419025cbeb4"},
] ]
semver = [ semver = [
{file = "semver-2.9.0-py2.py3-none-any.whl", hash = "sha256:aa1c6be3bf23e346e00c509a7ee87735a7e0fd6b404cf066037cfeab2c770320"}, {file = "semver-2.13.0-py2.py3-none-any.whl", hash = "sha256:ced8b23dceb22134307c1b8abfa523da14198793d9787ac838e70e29e77458d4"},
{file = "semver-2.9.0.tar.gz", hash = "sha256:ed1edeaa0c27f68feb74f09f715077fd07b728446dc2bb7fc470fc0f737873a0"}, {file = "semver-2.13.0.tar.gz", hash = "sha256:fa0fe2722ee1c3f57eac478820c3a5ae2f624af8264cbdf9000c980ff7f75e3f"},
] ]
simplejson = [ simplejson = [
{file = "simplejson-3.17.0-cp27-cp27m-macosx_10_13_x86_64.whl", hash = "sha256:87d349517b572964350cc1adc5a31b493bbcee284505e81637d0174b2758ba17"}, {file = "simplejson-3.17.0-cp27-cp27m-macosx_10_13_x86_64.whl", hash = "sha256:87d349517b572964350cc1adc5a31b493bbcee284505e81637d0174b2758ba17"},
......
...@@ -8,7 +8,7 @@ authors = [] ...@@ -8,7 +8,7 @@ authors = []
python = "^3.8" python = "^3.8"
pytest = "6.0.2" pytest = "6.0.2"
simplejson = "3.17.0" simplejson = "3.17.0"
semver = "2.9.0" semver = "2.13.0"
pyserial = "3.4" pyserial = "3.4"
pyyaml = "5.3" pyyaml = "5.3"
prometheus-client = "0.7.1" prometheus-client = "0.7.1"
......
...@@ -37,7 +37,8 @@ def test_version(run_command): ...@@ -37,7 +37,8 @@ def test_version(run_command):
assert result.ok assert result.ok
parsed_out = json.loads(result.stdout) parsed_out = json.loads(result.stdout)
assert parsed_out.get("Application", False) == "arduino-cli" assert parsed_out.get("Application", False) == "arduino-cli"
assert isinstance(semver.parse(parsed_out.get("VersionString", False)), dict) version = parsed_out.get("VersionString", False)
assert semver.VersionInfo.isvalid(version=version) or "git-snapshot" in version or "nightly" in version
assert isinstance(parsed_out.get("Commit", False), str) assert isinstance(parsed_out.get("Commit", False), str)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment