The Wayback Machine - https://web.archive.org/web/20210306015417/https://github.com/arduino/arduino-cli/pull/1148
Skip to content
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

[skip changelog] Update release process #1148

Merged
merged 5 commits into from Jan 22, 2021
Merged

Conversation

@silvanocerza
Copy link
Contributor

@silvanocerza silvanocerza commented Jan 21, 2021

Please check if the PR fulfills these requirements

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • The PR follows our contributing guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • UPGRADING.md has been updated with a migration guide (for breaking changes)
  • What kind of change does this PR introduce?

Updates the process used to create new builds and releases.

  • What is the current behavior?

We currently use goreleaser to create changelogs and new releases.

  • What is the new behavior?

We ditch goreleaser, we use Task and different Docker containers to create dist files for different platforms.

Nope.

  • Other information:

None.


See how to contribute

@silvanocerza silvanocerza requested review from per1234 and rsora Jan 21, 2021
@silvanocerza silvanocerza self-assigned this Jan 21, 2021
container:
image: arduino/arduino-cli:builder-1
volumes:
# cache go dependencies across pipeline's steps
- ${{ github.workspace }}/go:/go

Comment on lines -15 to -20

This comment has been minimized.

@per1234

per1234 Jan 22, 2021
Contributor

I think this also needs to be done for the test workflow:

--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -107,10 +107,4 @@ jobs:
     needs: test-matrix
 
-    container:
-      image: arduino/arduino-cli:builder-1
-      volumes:
-        # cache go dependencies across pipeline's steps
-        - ${{ github.workspace }}/go:/go
-
     steps:
       - name: checkout

This comment has been minimized.

@silvanocerza

silvanocerza Jan 22, 2021
Author Contributor

Yep, nice catch! Totally forgot about it.

sha256sum {{ .PACKAGE_NAME }} >> {{ .CHECKSUM_FILE }}
vars:
PLATFORM_DIR: "{{ .PROJECT_NAME }}_osx_darwin_amd64"

This comment has been minimized.

@per1234

per1234 Jan 22, 2021
Contributor

For some reason, the previous build process named this directory arduino_cli_osx_darwin_amd64 (note the underscore in arduino_cli). This PR sets the PROJECT_NAME variable to the correct arduino-cli (note the hyphen), but the macOS notarization system still expects the old folder name. So it must be updated accordingly:

diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml
index d944adc1..6d3bef35 100644
--- a/.github/workflows/nightly.yaml
+++ b/.github/workflows/nightly.yaml
@@ -85,6 +85,6 @@ jobs:
           # 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)"
           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
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index fbbb8454..614567d9 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -87,6 +87,6 @@ jobs:
           # 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\//}
           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
diff --git a/gon.config.hcl b/gon.config.hcl
index 9de9a781..dc9d8d50 100644
--- a/gon.config.hcl
+++ b/gon.config.hcl
@@ -1,2 +1,2 @@
-source = ["dist/arduino_cli_osx_darwin_amd64/arduino-cli"]
+source = ["dist/arduino-cli_osx_darwin_amd64/arduino-cli"]
 bundle_id = "cc.arduino.arduino-cli"

if [ "${{ github.event_name }}" = "pull_request" ]; then
PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.event.number }}"
fi
PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.sha }}"
export PACKAGE_NAME_PREFIX
Comment on lines 124 to 128

This comment has been minimized.

@per1234

per1234 Jan 22, 2021
Contributor

It's unfortunate to lose this. In my version of the release system, I had this in mind when I set it up so a custom version could be specified via an environment variable:

Any chance we could do something like that?

This comment has been minimized.

@silvanocerza

silvanocerza Jan 22, 2021
Author Contributor

What do you think of something like this?

diff --git a/Taskfile.yml b/Taskfile.yml
index a2c4f605..8f4d5faa 100755
--- a/Taskfile.yml
+++ b/Taskfile.yml
@@ -213,7 +213,7 @@ vars:
     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 }}snapshot{{ end }}"
+  VERSION: "{{ if .NIGHTLY }}nightly-{{ .TIMESTAMP_SHORT }}{{ else if .TAG }}{{ .TAG }}{{ else }}{{ .PACKAGE_NAME_PREFIX }}snapshot{{ end }}"
   LDFLAGS: >
     -ldflags
     '
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index 3c81dcf2..e1e1aef5 100644
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -125,7 +119,14 @@ jobs:
           version: 3.x
 
       - name: Build
-        run: task dist:all
+        run: |
+          PACKAGE_NAME_PREFIX="${{ github.workflow }}-"
+          if [ "${{ github.event_name }}" = "pull_request" ]; then
+            PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.event.number }}-"
+          fi
+          PACKAGE_NAME_PREFIX="$PACKAGE_NAME_PREFIX-${{ github.sha }}-"
+          export PACKAGE_NAME_PREFIX
+          task dist:all
 
       # Uploads all architectures as separate artifacts
       - name: Upload Linux 32 bit artifact

I remember removing this because it was kind of a pain to test but thinking about it I just have to change the test like this:

diff --git a/test/test_main.py b/test/test_main.py
index e9c1a092..6f171fa5 100644
--- a/test/test_main.py
+++ b/test/test_main.py
@@ -38,7 +38,7 @@ def test_version(run_command):
     parsed_out = json.loads(result.stdout)
     assert parsed_out.get("Application", False) == "arduino-cli"
     version = parsed_out.get("VersionString", False)
-    assert semver.VersionInfo.isvalid(version=version) or version == "snapshot" or "nightly" in version
+    assert semver.VersionInfo.isvalid(version=version) or "snapshot" in version or "nightly" in version
     assert isinstance(parsed_out.get("Commit", False), str)

This comment has been minimized.

@per1234

per1234 Jan 22, 2021
Contributor

Looks good!

@silvanocerza
Copy link
Contributor Author

@silvanocerza silvanocerza commented Jan 22, 2021

I just pushed another commit that changes the VERSION variable in the Taskfile.yml from snapshot to git-snapshot, we use that version string when running lib install using the --git-url or --zip-file flags to print the documentation version.

This is the snippet in question, it panics at line 69 since the split slice contains only one element. Fact is that we should not enter that if at all when running tests.

if installFlags.zipPath || installFlags.gitURL {
if !configuration.Settings.GetBool("library.enable_unsafe_install") {
documentationURL := "https://arduino.github.io/arduino-cli/latest/configuration/#configuration-keys"
if !strings.Contains(globals.VersionInfo.VersionString, "git") {
split := strings.Split(globals.VersionInfo.VersionString, ".")
documentationURL = fmt.Sprintf("https://arduino.github.io/arduino-cli/%s.%s/configuration/#configuration-keys", split[0], split[1])
}
feedback.Errorf("--git-url and --zip-path are disabled by default, for more information see: %v", documentationURL)
os.Exit(errorcodes.ErrGeneric)
}
feedback.Print("--git-url and --zip-path flags allow installing untrusted files, use it at your own risk.")
}
PACKAGE_NAME_PREFIX="${{ github.workflow }}-"
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 }}-"
Comment on lines 123 to 125

This comment has been minimized.

@per1234

per1234 Jan 22, 2021
Contributor

The - appended here are redundant. Note the double -- here:
https://github.com/arduino/arduino-cli/pull/1148/checks?check_run_id=1748258721#step:4:91

--build-cmd "go build -o dist/arduino-cli_windows_386/arduino-cli.exe -ldflags ' -X github.com/arduino/arduino-cli/version.versionString=test--1148--6a52a9a31b2b71bf80f20fa03205143adf07d4cf-git-snapshot -X github.com/arduino/arduino-cli/version.commit=e975be30 -X github.com/arduino/arduino-cli/version.date=2021-01-22T11:14:28Z '
$ ./arduino-cli version
arduino-cli.exe alpha Version: test--1148--6a52a9a31b2b71bf80f20fa03205143adf07d4cf-git-snapshot Commit: e975be30 Date: 2021-01-22T11:14:28Z

This comment has been minimized.

@silvanocerza

silvanocerza Jan 22, 2021
Author Contributor

Right, I'll remove it.

Copy link
Contributor

@per1234 per1234 left a comment

Great work Silvano! Very exciting to have a new build system in place.

I ran the "nightly" and "release" workflows in my fork with my Apple signing certificate and verified that the macOS signing/notarization system is all working fine.

@silvanocerza silvanocerza merged commit 079bb6c into master Jan 22, 2021
16 checks passed
16 checks passed
Lints Python code
Details
verify-links
Details
verify-links
Details
verify-formatting
Details
verify-formatting
Details
test-matrix (ubuntu-latest)
Details
test-matrix (ubuntu-latest)
Details
validate
Details
test-matrix (windows-latest)
Details
test-matrix (windows-latest)
Details
test-matrix (macOS-latest)
Details
test-matrix (macOS-latest)
Details
create-test-artifacts
Details
create-test-artifacts
Details
codecov/project 37.34% (target 30.00%)
Details
license/cla Contributor License Agreement is signed.
Details
@silvanocerza silvanocerza deleted the scerza/build-process branch Jan 22, 2021
silvanocerza added a commit that referenced this pull request Jan 27, 2021
* [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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants