From 97580efe21e15f76be2d86e567ef9a0f0382c886 Mon Sep 17 00:00:00 2001 From: umbynos Date: Fri, 8 Jan 2021 15:42:41 +0100 Subject: [PATCH 01/10] change path for s3 sync --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4ca98a0b1..d7cbe2a03 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,7 @@ on: - "[0-9]+.[0-9]+.[0-9]+*" env: - TARGET: "/CreateAgent/" + TARGET: "/CreateAgent/Stable" AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_REGION: "us-east-1" # or https://github.com/aws/aws-cli/issues/5623 From 270993dae628251cc479dbd33255ed066124f4e7 Mon Sep 17 00:00:00 2001 From: umbynos Date: Fri, 8 Jan 2021 15:58:42 +0100 Subject: [PATCH 02/10] add old path for autoupdate (we cannot autoupdate config.ini) --- .github/workflows/release.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d7cbe2a03..eba871139 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,6 +7,7 @@ on: env: TARGET: "/CreateAgent/Stable" + OLD_TARGET: "/CreateBridge/" # compatibility with older releases (we can't change config.ini) AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_REGION: "us-east-1" # or https://github.com/aws/aws-cli/issues/5623 @@ -132,7 +133,9 @@ jobs: if: matrix.arch == '-386' && steps.prerelease.outputs.IS_PRE != 'true' - name: Upload autoupdate files to Arduino downloads servers - run: aws s3 sync public/ s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }} + run: | + aws s3 sync public/ s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }} + aws s3 sync public/ s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.OLD_TARGET }} if: steps.prerelease.outputs.IS_PRE != 'true' # config.ini is required by the executable when it's run From be3310e89201671a2a03e577bd239420b4c65a70 Mon Sep 17 00:00:00 2001 From: umbynos Date: Fri, 8 Jan 2021 15:59:47 +0100 Subject: [PATCH 03/10] update (and remove "Bridge") from config.ini --- config.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.ini b/config.ini index 85ebd29d6..960e5f3d3 100644 --- a/config.ini +++ b/config.ini @@ -2,7 +2,7 @@ gc = std # Type of garbage collection. std = Normal garbage collection allowing hostname = unknown-hostname # Override the hostname we get from the OS regex = usb|acm|com # Regular expression to filter serial port list v = true # show debug logging -appName = CreateBridge +appName = CreateAgent/Stable updateUrl = https://downloads.arduino.cc/ origins = https://local.arduino.cc:8000 #httpProxy = http://your.proxy:port # Proxy server for HTTP requests From 0743bd7830d041e605eda1a3aeab7127726ef31f Mon Sep 17 00:00:00 2001 From: umbynos Date: Fri, 8 Jan 2021 18:43:33 +0100 Subject: [PATCH 04/10] fix naming: every os has also arch and general improvements --- .github/workflows/release.yml | 65 ++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 28 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eba871139..081b589bd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,6 +23,7 @@ jobs: matrix: include: - operating-system: ubuntu-18.04 + arch: -amd64 - operating-system: windows-2019 arch: -386 ext: ".exe" @@ -30,6 +31,7 @@ jobs: arch: -amd64 ext: ".exe" - operating-system: macos-10.15 + arch: -amd64 defaults: run: @@ -151,16 +153,20 @@ jobs: # The code-sign-mac-executable job will download the macos artifact from the previous job, sign e notarize the binary and re-upload it. code-sign-mac-executable: needs: build - runs-on: macos-10.15 - env: - RUNS_ON: macos-10.15 # used to parametrize filenames + strategy: + matrix: # to allow support for future architectures + include: + - os: macos-10.15 + arch: -amd64 + + runs-on: ${{ matrix.os }} steps: - name: Download artifact uses: actions/download-artifact@v2 with: - name: arduino-create-agent-${{ env.RUNS_ON }} - path: arduino-create-agent-${{ env.RUNS_ON }} + name: arduino-create-agent-${{ matrix.os }}${{ matrix.arch }} + path: arduino-create-agent - name: Import Code-Signing Certificates run: | @@ -180,7 +186,7 @@ jobs: # gon does not allow env variables in config file (https://github.com/mitchellh/gon/issues/20) run: | cat > gon.config.hcl < gon.config_installer.hcl < Date: Fri, 8 Jan 2021 18:44:43 +0100 Subject: [PATCH 05/10] add check on win --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 081b589bd..b03ce71fb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -132,7 +132,7 @@ jobs: - name: Create autoupdate files for win32 run: go-selfupdate -platform windows${{ matrix.arch }} arduino-create-agent${{ matrix.ext }} ${TAG_VERSION} - if: matrix.arch == '-386' && steps.prerelease.outputs.IS_PRE != 'true' + if: matrix.arch == '-386' && matrix.operating-system == 'windows-2019' && steps.prerelease.outputs.IS_PRE != 'true' - name: Upload autoupdate files to Arduino downloads servers run: | From 0096f959dc9bcb6e18338a1d7778d9841e840eab Mon Sep 17 00:00:00 2001 From: umbynos Date: Fri, 8 Jan 2021 18:46:20 +0100 Subject: [PATCH 06/10] fix typo --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b03ce71fb..7cee93db3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -430,7 +430,7 @@ jobs: uses: crazy-max/ghaction-virustotal@v2 with: vt_api_key: ${{ secrets.VIRUSTOTAL_API_KEY }} - update_release_body: false # `true` won't work becasue trigger type is not release + update_release_body: false # `true` won't work because trigger type is not release files: | release/*.exe arduino-create-agent-windows-2019-386/arduino-create-agent.exe From 88060bf3fff12169023716f06f79ea4f101241a0 Mon Sep 17 00:00:00 2001 From: umbynos Date: Fri, 8 Jan 2021 18:47:09 +0100 Subject: [PATCH 07/10] remove useless --include "*" (default behavior when syncing a dir) --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7cee93db3..0e76d760c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -467,5 +467,5 @@ jobs: file: release/* - name: Upload release files on Arduino downloads servers - run: aws s3 sync release/ s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }} --include "*" + run: aws s3 sync release/ s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }} if: steps.prerelease.outputs.IS_PRE != 'true' From 6b26a52c95ff5da39b12a65aa5923d974eb7b217 Mon Sep 17 00:00:00 2001 From: umbynos Date: Fri, 8 Jan 2021 19:00:45 +0100 Subject: [PATCH 08/10] use arrays in matrix && rename operating-system to os --- .github/workflows/release.yml | 65 ++++++++++++++++------------------- 1 file changed, 30 insertions(+), 35 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0e76d760c..01ef180f8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,23 +21,20 @@ jobs: build: strategy: matrix: + os: [ubuntu-18.04, windows-2019, macos-10.15] + arch: [-amd64] include: - - operating-system: ubuntu-18.04 - arch: -amd64 - - operating-system: windows-2019 + - os: windows-2019 arch: -386 ext: ".exe" - - operating-system: windows-2019 - arch: -amd64 + - os: windows-2019 ext: ".exe" - - operating-system: macos-10.15 - arch: -amd64 defaults: run: shell: bash - runs-on: ${{ matrix.operating-system }} + runs-on: ${{ matrix.os }} steps: - name: Set env vars @@ -67,7 +64,7 @@ jobs: # dependencies used for compiling the GUI - name: Install Dependencies (Linux) run: sudo apt update && sudo apt install -y --no-install-recommends build-essential libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev - if: matrix.operating-system == 'ubuntu-18.04' + if: matrix.os == 'ubuntu-18.04' - name: Install Go deps # Since 10/23/2019 pwsh is the default shell @@ -92,18 +89,18 @@ jobs: - name: Build the Agent for linux run: task build - if: matrix.operating-system == 'ubuntu-18.04' + if: matrix.os == 'ubuntu-18.04' # build the agent without GUI support (no tray icon) - name: Build the Agent-cli run: task build-cli - if: matrix.operating-system == 'ubuntu-18.04' + if: matrix.os == 'ubuntu-18.04' # the manifest is required by windows GUI apps, otherwise the binary will crash with: "Unable to create main window: TTM_ADDTOOL failed" (for reference https://github.com/lxn/walk/issues/28) # rsrc will produce a *.syso file that should get automatically recognized by go build command and linked into an executable. - name: Download tool to embed manifest in win binary run: go get github.com/akavel/rsrc - if: matrix.operating-system == 'windows-2019' + if: matrix.os == 'windows-2019' # building the agent for win requires a different task because of an extra flag - name: Build the Agent for win32 @@ -111,11 +108,11 @@ jobs: GOARCH: 386 # 32bit architecture (for support) GO386: 387 # support old instruction sets without MMX (used in the Pentium 4) (will be deprecated in GO > 1.15 https://golang.org/doc/go1.15) run: task build-win - if: matrix.operating-system == 'windows-2019' && matrix.arch == '-386' + if: matrix.os == 'windows-2019' && matrix.arch == '-386' - name: Build the Agent for win64 run: task build-win # GOARCH=amd64 by default on the runners - if: matrix.operating-system == 'windows-2019' && matrix.arch == '-amd64' + if: matrix.os == 'windows-2019' && matrix.arch == '-amd64' - name: Build the Agent for macos env: @@ -123,7 +120,7 @@ jobs: CGO_CFLAGS: -mmacosx-version-min=10.11 CGO_LDFLAGS: -mmacosx-version-min=10.11 run: task build - if: matrix.operating-system == 'macos-10.15' + if: matrix.os == 'macos-10.15' # this will create `public/` dir with compressed full bin (/-.gz) and a json file - name: Create autoupdate files @@ -132,7 +129,7 @@ jobs: - name: Create autoupdate files for win32 run: go-selfupdate -platform windows${{ matrix.arch }} arduino-create-agent${{ matrix.ext }} ${TAG_VERSION} - if: matrix.arch == '-386' && matrix.operating-system == 'windows-2019' && steps.prerelease.outputs.IS_PRE != 'true' + if: matrix.arch == '-386' && matrix.os == 'windows-2019' && steps.prerelease.outputs.IS_PRE != 'true' - name: Upload autoupdate files to Arduino downloads servers run: | @@ -144,7 +141,7 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v2 with: - name: arduino-create-agent-${{ matrix.operating-system }}${{ matrix.arch }} + name: arduino-create-agent-${{ matrix.os }}${{ matrix.arch }} path: | arduino-create-agent* config.ini @@ -155,9 +152,8 @@ jobs: needs: build strategy: matrix: # to allow support for future architectures - include: - - os: macos-10.15 - arch: -amd64 + os: [macos-10.15] + arch: [-amd64] runs-on: ${{ matrix.os }} @@ -237,27 +233,26 @@ jobs: strategy: fail-fast: false # if one os is failing continue nonetheless matrix: # used to generate installers for different OS and not for runs-on + os: [ubuntu-18.04, windows-2019, macos-10.15] + arch: [-amd64] include: - - operating-system: ubuntu-18.04 - arch: -amd64 + - os: ubuntu-18.04 install-builder-name: linux executable-path: artifacts/linux-amd64/ - - operating-system: windows-2019 + - os: windows-2019 arch: -386 browser: edge install-builder-name: windows executable-path: artifacts/windows/ extension: .exe installer-extension: .exe - - operating-system: windows-2019 - arch: -amd64 + - os: windows-2019 browser: edge install-builder-name: windows executable-path: artifacts/windows/ extension: .exe installer-extension: .exe - - operating-system: macos-10.15 - arch: -amd64 + - os: macos-10.15 browser: safari install-builder-name: osx executable-path: 'skel/ArduinoCreateAgent.app/Contents/MacOS/' @@ -276,31 +271,31 @@ jobs: - name: Download artifact uses: actions/download-artifact@v2 with: - name: arduino-create-agent-${{ matrix.operating-system }}${{ matrix.arch }} + name: arduino-create-agent-${{ matrix.os }}${{ matrix.arch }} path: ${{ matrix.executable-path }} # path expected by installbuilder # zip artifacts do not mantain executable permission - name: Make executable run: chmod -v +x ${{ matrix.executable-path }}arduino-create-agent* - if: matrix.operating-system == 'ubuntu-18.04' || matrix.operating-system == 'macos-10.15' + if: matrix.os == 'ubuntu-18.04' || matrix.os == 'macos-10.15' - name: Rename executable to Arduino_Create_Agent run: mv -v ${{ matrix.executable-path }}arduino-create-agent${{ matrix.extension }} ${{ matrix.executable-path }}Arduino_Create_Agent${{ matrix.extension }} - name: Rename executable to Arduino_Create_Agent_cli run: mv -v ${{ matrix.executable-path }}arduino-create-agent_cli${{ matrix.extension }} ${{ matrix.executable-path }}Arduino_Create_Agent_cli${{ matrix.extension }} - if: matrix.operating-system == 'ubuntu-18.04' + if: matrix.os == 'ubuntu-18.04' - name: Save InstallBuilder license to file run: echo "${{ secrets.INSTALLER_LICENSE }}" > /tmp/license.xml - name: Save Win signing certificate to file run: echo "${{ secrets.INSTALLER_CERT_WINDOWS_PFX }}" | base64 --decode > ${{ env.INSTALLER_CERT_WINDOWS_PFX}} - if: matrix.operating-system == 'windows-2019' + if: matrix.os == 'windows-2019' - name: Save macos signing certificate to file run: echo "${{ secrets.INSTALLER_CERT_MAC_P12 }}" | base64 --decode > ${{ env.INSTALLER_CERT_MAC_P12 }} - if: matrix.operating-system == 'macos-10.15' + if: matrix.os == 'macos-10.15' # win(edge),mac(safari) -> CERT_INSTALL and win,mac:(ff,chrome) -> CHOICE_CERT_INSTALL # installbuilder reads the env vars with certs paths and use it to sign the installer. @@ -312,7 +307,7 @@ jobs: cp -vr ArduinoCreateAgent-${GITHUB_REF##*/}-${{ matrix.install-builder-name }}-installer-CC${{matrix.installer-extension}} ArduinoCreateAgent-${GITHUB_REF##*/}-${{ matrix.install-builder-name }}${{ matrix.arch }}-installer-chrome${{matrix.installer-extension}} mv -v ArduinoCreateAgent-${GITHUB_REF##*/}-${{ matrix.install-builder-name }}-installer-CC${{matrix.installer-extension}} ArduinoCreateAgent-${GITHUB_REF##*/}-${{ matrix.install-builder-name }}${{ matrix.arch }}-installer-firefox${{matrix.installer-extension}} rm -r ArduinoCreateAgent-${GITHUB_REF##*/}-${{ matrix.install-builder-name }}-installer-C* - if: matrix.operating-system == 'windows-2019' || matrix.operating-system == 'macos-10.15' + if: matrix.os == 'windows-2019' || matrix.os == 'macos-10.15' # linux - name: Launch Bitrock installbuilder-20 with NO_CERT_INSTALL @@ -322,7 +317,7 @@ jobs: mv -v ArduinoCreateAgent-${GITHUB_REF##*/}-linux-x64-installer-CS.run ArduinoCreateAgent-${GITHUB_REF##*/}-${{ matrix.install-builder-name }}${{ matrix.arch }}-installer-firefox.run cp -v ArduinoCreateAgent-${GITHUB_REF##*/}-linux-x64-installer-CS.tar.gz ArduinoCreateAgent-${GITHUB_REF##*/}-${{ matrix.install-builder-name }}${{ matrix.arch }}-installer-chrome.tar.gz mv -v ArduinoCreateAgent-${GITHUB_REF##*/}-linux-x64-installer-CS.tar.gz ArduinoCreateAgent-${GITHUB_REF##*/}-${{ matrix.install-builder-name }}${{ matrix.arch }}-installer-firefox.tar.gz - if: matrix.operating-system == 'ubuntu-18.04' + if: matrix.os == 'ubuntu-18.04' - name: Upload artifacts uses: actions/upload-artifact@v2 @@ -337,7 +332,7 @@ jobs: strategy: matrix: browser: [safari, firefox, chrome] - arch: -amd64 + arch: [-amd64] runs-on: macos-10.15 steps: From 9a2aeb3f993be82d5b6d30af306b970f7fabc0d5 Mon Sep 17 00:00:00 2001 From: umbynos Date: Mon, 11 Jan 2021 16:10:36 +0100 Subject: [PATCH 09/10] add step to update version file --- .github/workflows/release.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 01ef180f8..f47612008 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,6 +8,7 @@ on: env: TARGET: "/CreateAgent/Stable" OLD_TARGET: "/CreateBridge/" # compatibility with older releases (we can't change config.ini) + VERSION_TARGET: "arduino-create-static/agent-metadata/" AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_REGION: "us-east-1" # or https://github.com/aws/aws-cli/issues/5623 @@ -464,3 +465,9 @@ jobs: - name: Upload release files on Arduino downloads servers run: aws s3 sync release/ s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }} if: steps.prerelease.outputs.IS_PRE != 'true' + + - name: Update version file (used by frontend to trigger autoupdate and create filename) + run: | + echo {\"Version\": \"${GITHUB_REF##*/}\"} > /tmp/agent-version.json + aws s3 sync /tmp/agent-version.json s3://${{ env.VERSION_TARGET }} + if: steps.prerelease.outputs.IS_PRE != 'true' From 7eed314167b4d5703af10e7bc16c8e91e5ba00f8 Mon Sep 17 00:00:00 2001 From: umbynos Date: Mon, 11 Jan 2021 16:28:31 +0100 Subject: [PATCH 10/10] uniform test.yml --- .github/workflows/test.yml | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 27f78908a..5fa3091ff 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,18 +7,17 @@ jobs: test-matrix: strategy: matrix: + os: [ubuntu-18.04, windows-2019, macos-10.15] + arch: [-amd64] include: - - operating-system: ubuntu-18.04 - - operating-system: windows-2019 + - os: windows-2019 arch: -386 - - operating-system: windows-2019 - arch: -amd64 - - operating-system: macos-10.15 + defaults: run: shell: bash - runs-on: ${{ matrix.operating-system }} + runs-on: ${{ matrix.os }} steps: - name: Disable EOL conversions @@ -35,7 +34,7 @@ jobs: # dependencies used for compiling the GUI - name: Install Dependencies (Linux) run: sudo apt update && sudo apt install -y --no-install-recommends build-essential libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev - if: matrix.operating-system == 'ubuntu-18.04' + if: matrix.os == 'ubuntu-18.04' - name: Install Go deps # Since 10/23/2019 pwsh is the default shell @@ -59,18 +58,18 @@ jobs: - name: Build the Agent for linux run: task build - if: matrix.operating-system == 'ubuntu-18.04' + if: matrix.os == 'ubuntu-18.04' # build the agent without GUI support (no tray icon) - name: Build the Agent-cli run: task build-cli - if: matrix.operating-system == 'ubuntu-18.04' + if: matrix.os == 'ubuntu-18.04' # the manifest is required by windows GUI apps, otherwise the binary will crash with: "Unable to create main window: TTM_ADDTOOL failed" (for reference https://github.com/lxn/walk/issues/28) # rsrc will produce a *.syso file that should get automatically recognized by go build command and linked into an executable. - name: Download tool to embed manifest in win binary run: go get github.com/akavel/rsrc - if: matrix.operating-system == 'windows-2019' + if: matrix.os == 'windows-2019' # building the agent for win requires a different task because of an extra flag - name: Build the Agent for win32 @@ -78,11 +77,11 @@ jobs: GOARCH: 386 # 32bit architecture (for support) GO386: 387 # support old instruction sets without MMX (used in the Pentium 4) (will be deprecated in GO > 1.15 https://golang.org/doc/go1.15) run: task build-win - if: matrix.operating-system == 'windows-2019' && matrix.arch == '-386' + if: matrix.os == 'windows-2019' && matrix.arch == '-386' - name: Build the Agent for win64 run: task build-win # GOARCH=amd64 by default on the runners - if: matrix.operating-system == 'windows-2019' && matrix.arch == '-amd64' + if: matrix.os == 'windows-2019' && matrix.arch == '-amd64' - name: Build the Agent for macos env: @@ -90,13 +89,13 @@ jobs: CGO_CFLAGS: -mmacosx-version-min=10.11 CGO_LDFLAGS: -mmacosx-version-min=10.11 run: task build - if: matrix.operating-system == 'macos-10.15' + if: matrix.os == 'macos-10.15' # config.ini is required by the executable when it's run - name: Upload artifacts uses: actions/upload-artifact@v2 with: - name: arduino-create-agent-${{ matrix.operating-system }}${{ matrix.arch }} + name: arduino-create-agent-${{ matrix.os }}${{ matrix.arch }} path: | arduino-create-agent* config.ini