-
-
Notifications
You must be signed in to change notification settings - Fork 393
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
Use goreleaser to build the full binary matrix #311
Merged
Merged
Changes from 9 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
0eff33d
first draft
masci d32ebcb
use crossbuild as base image
masci c26058d
add drone step
masci b3a8cfe
gix image name and build condition
masci 850e7ea
split pipelines
masci a36e350
fix typo
masci f5b6c24
add how to contribute
masci 43776e3
fetch tags
masci 69338e0
exclude known tags
masci 7839d4f
Update CONTRIBUTING.md
masci 5e3fd36
Update CONTRIBUTING.md
masci 3140365
Update CONTRIBUTING.md
masci File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ coverage_*.txt | |
__pycache__ | ||
venv | ||
.pytest_cache | ||
/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# Global section | ||
checksum: | ||
name_template: 'checksums.txt' | ||
|
||
snapshot: | ||
name_template: "{{ .Tag }}-next" | ||
|
||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^[skip changelog]' | ||
|
||
# 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 }} | ||
- | ||
# ARM | ||
id: arduino_cli_arm | ||
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 }} | ||
- "-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 }} | ||
- "-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 }} | ||
- "-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: | ||
- README.md | ||
- LICENSE.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
# How to contribute | ||
|
||
First of all, thanks for contributing! | ||
|
||
This document provides some basic guidelines for contributing to this repository. To propose | ||
improvements or fix a bug, feel free to submit a PR. | ||
|
||
## Legal requirements | ||
|
||
Before we can accept your contributions you have to sign the [Contributor License Agreement][0] | ||
|
||
## Prerequisites | ||
|
||
To build the Arduino CLI from sources you need the following tools to be available in your local | ||
enviroment: | ||
|
||
* [Go][1] version 1.12 or later | ||
* [Taskfile][2] to help you run the most common tasks from the command line | ||
|
||
If you want to run integration tests you will also need: | ||
|
||
* A serial port with an Arduino device attached | ||
* A working [Python][3] environment, version 3.5 or later | ||
|
||
## Building the source code | ||
|
||
From the project folder root, just run: | ||
|
||
```shell | ||
task build | ||
``` | ||
|
||
The project uses Go modules so dependencies will be downloaded automatically, you should end with | ||
an `arduino-cli` executable in the same folder. | ||
|
||
## Running the tests | ||
|
||
There are several checks and test suites in place to ensure the code works as expected but also it | ||
is written in a way that's consistent across the whole codebase. Such tests can be run one after | ||
another by running the command: | ||
|
||
```shell | ||
task test | ||
``` | ||
|
||
If you want to only run unit tests and skip other checks, you can run: | ||
|
||
```shell | ||
task test-unit | ||
``` | ||
|
||
Similarly, if you're only interested in running integration tests, you can do (be sure to read the | ||
part dedicated to integration tests if something doesn't work): | ||
|
||
```shell | ||
task test-integration | ||
``` | ||
|
||
### Integration tests | ||
|
||
Being a command line interface, Arduino CLI is heavily interactive and it has to stay consistent | ||
in accepting the user input and providing the expected output and proper exit codes. On top of this, | ||
many Arduino CLI features involve communicating with external devices, most likely through a serial | ||
port, so unit tests can only put our confidence that the code is working so far. | ||
|
||
For these reasons, in addition to regular unit tests the project has a suite of integration tests | ||
that actually run Arduino CLI in a different process and assess the options are correctly | ||
understood and the output is what we expect. | ||
|
||
To run the full suite of integration tests you need an Arduino device attached to a serial port and | ||
a working Python environment. Chances are that you already have Python installed in your system, if | ||
this is not the case you can [download][3] the official distribution or use the package manager | ||
provided by your Operating System. | ||
|
||
Some dependencies need to be installed before running the tests and to avoid polluting your global | ||
Python enviroment with dependencies that might be only used by the Arduino CLI, you can use a | ||
[virtual environment][4]. There are many ways to manage virtual environments, for example you can | ||
use a productivity tool called [hatch][5]. First you need to install it (you might need to `sudo` | ||
the following command): | ||
|
||
```shell | ||
pip3 install --user hatch | ||
``` | ||
|
||
Then you can create a virtual environment to be used while working on Arduino CLI: | ||
|
||
```shell | ||
hatch env arduino-cli | ||
``` | ||
|
||
At this point the virtual environment was created and you need to make it active every time you | ||
open a new terminal session with the following command: | ||
|
||
```shell | ||
hatch shell arduino-cli | ||
``` | ||
|
||
From now on, every package installed by Python will be confined to the `arduino-cli` virtual | ||
environment, so you can proceed installing the dependencies required with: | ||
|
||
```shell | ||
pip install -r test/requirements.txt | ||
``` | ||
|
||
If the last step was successfull, you should be able to run the tests with: | ||
masci marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```shell | ||
task test-integration | ||
``` | ||
|
||
## Pull Requests | ||
|
||
In order to ease code reviews and have your contributions merged faster, here is a list of items | ||
you can check before submitting a PR: | ||
|
||
* Create small PRs that are narrowly focused on addressing a single concern. | ||
* PR titles indirectly become part of the CHANGELOG so it's crucial to provide a good | ||
record of **what** change is being made in the title; **why** it was made will go in the | ||
PR description, along with a link to a GitHub issue if it exists. | ||
* write tests for the code you wrote. | ||
masci marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* open your PR against the `master` branch. | ||
masci marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* Maintain **clean commit history** and use **meaningful commit messages**. | ||
PRs with messy commit history are difficult to review and require a lot of work to be merged. | ||
* Your PR must pass all CI tests before we will merge it. If you're seeing an error and don't think | ||
it's your fault, it may not be! The reviewer will help you if there are test failures that seem | ||
not related to the change you are making. | ||
|
||
## Additional settings | ||
|
||
If you need to push a commit that's only shipping documentation changes or example files, thus a | ||
complete no-op for the test suite, please start the commit message with the string **[skip ci]** | ||
to skip the build and give that slot to someone else who does need it. | ||
|
||
If your PR doesn't need to be included in the changelog, please start the PR title with the string | ||
**[skip changelog]** | ||
|
||
[0]: https://cla-assistant.io/arduino/arduino-cli | ||
[1]: https://golang.org/doc/install | ||
[2]: https://taskfile.dev/#/installation | ||
[3]: https://www.python.org/downloads/ | ||
[4]: https://docs.python.org/3/tutorial/venv.html | ||
[5]: https://github.com/ofek/hatch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
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.12.7 | ||
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 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we going to use cla-assistant for it, isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, already in place, included Github integration