Skip to content

[skip changelog] Sync install script with template #1396

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

Merged
merged 2 commits into from
Aug 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ indent_size = 4
indent_style = space
indent_size = 2

[*.sh]
indent_style = tab
indent_size = 4
[*.{bash,sh}]
indent_size = 2
indent_style = space
46 changes: 24 additions & 22 deletions .github/tools/fetch_athena_stats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

set -euo pipefail

! read -r -d '' query << EOM
! read -r -d '' query <<EOM
select
replace(url_extract_path("d.url"), '/arduino-cli/arduino-cli_', '') as flavor,
count("id") as gauge
Expand All @@ -27,40 +27,42 @@ group by 1
EOM

queryExecutionId=$(
aws athena start-query-execution \
--query-string "${query}" \
--query-execution-context "Database=demo_books" \
--result-configuration "OutputLocation=${AWS_ATHENA_OUTPUT_LOCATION}" \
--region us-east-1 | jq -r ".QueryExecutionId"
aws athena start-query-execution \
--query-string "${query}" \
--query-execution-context "Database=demo_books" \
--result-configuration "OutputLocation=${AWS_ATHENA_OUTPUT_LOCATION}" \
--region us-east-1 | jq -r ".QueryExecutionId"
)

echo "QueryExecutionId is ${queryExecutionId}"
for i in $(seq 1 120); do
queryState=$( aws athena get-query-execution \
--query-execution-id "${queryExecutionId}" \
--region us-east-1 | jq -r ".QueryExecution.Status.State"
);
queryState=$(
aws athena get-query-execution \
--query-execution-id "${queryExecutionId}" \
--region us-east-1 | jq -r ".QueryExecution.Status.State"
)

if [[ "${queryState}" == "SUCCEEDED" ]]; then
break;
fi;
break
fi

echo "QueryExecutionId ${queryExecutionId} - state is ${queryState}"

if [[ "${queryState}" == "FAILED" ]]; then
exit 1;
fi;
exit 1
fi

sleep 2
done

echo "Query succeeded. Processing data"
queryResult=$( aws athena get-query-results \
--query-execution-id "${queryExecutionId}" \
--region us-east-1 | jq --compact-output
);
queryResult=$(
aws athena get-query-results \
--query-execution-id "${queryExecutionId}" \
--region us-east-1 | jq --compact-output
)

! read -r -d '' jsonTemplate << EOM
! read -r -d '' jsonTemplate <<EOM
{
"type": "gauge",
"name": "arduino.downloads.total",
Expand All @@ -78,8 +80,8 @@ EOM

datapoints="["
for row in $(echo "${queryResult}" | jq 'del(.ResultSet.Rows[0])' | jq -r '.ResultSet.Rows[] | .Data' --compact-output); do
value=$(jq -r ".[1].VarCharValue" <<< "${row}")
tag=$(jq -r ".[0].VarCharValue" <<< "${row}")
value=$(jq -r ".[1].VarCharValue" <<<"${row}")
tag=$(jq -r ".[0].VarCharValue" <<<"${row}")
# Some splitting to obtain 0.6.0, Windows, 32bit elements from string 0.6.0_Windows_32bit.zip
split=($(echo "$tag" | tr '_' '\n'))
if [[ ${#split[@]} -ne 3 ]]; then
Expand All @@ -90,4 +92,4 @@ for row in $(echo "${queryResult}" | jq 'del(.ResultSet.Rows[0])' | jq -r '.Resu
done
datapoints="${datapoints::-1}]"

echo "::set-output name=result::$(jq --compact-output <<< "${datapoints}")"
echo "::set-output name=result::$(jq --compact-output <<<"${datapoints}")"
103 changes: 44 additions & 59 deletions docs/installation.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
### Install via Homebrew (macOS/Linux)
<!-- Source: https://github.com/arduino/tooling-project-assets/blob/main/other/installation-script/installation.md -->

## Install via Homebrew (macOS/Linux)

The Arduino CLI is available as a Homebrew formula since version `0.5.0`:

Expand All @@ -7,34 +9,34 @@ brew update
brew install arduino-cli
```

#### Command line completion
### Command line completion

[Command line completion](command-line-completion.md#brew) files are already bundled in the homebrew installation.

### Use the install script
## Use the install script

The script requires `sh`. This is always available on Linux and macOS. `sh` is not available by default on Windows. The
script may be run on Windows by installing [Git for Windows], then running it from Git Bash.
The script requires `sh`, which is always available on Linux and macOS. `sh` is not available by default on Windows. The
script can be run on Windows by installing [Git for Windows](https://gitforwindows.org/), then running it from Git Bash.

This script will install the latest version of Arduino CLI to `$PWD/bin`:

```sh
```
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
```

If you want to target a different directory, for example `~/local/bin`, set the `BINDIR` environment variable like this:

```sh
```
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=~/local/bin sh
```

If you would like to use the `arduino-cli` command from any location, install Arduino CLI to a directory already in your
`PATH` or add the Arduino CLI installation path to your `PATH` environment variable.

If you want to download a specific arduino-cli version, for example `0.9.0`, pass the version number as a parameter like
this:
If you want to download a specific Arduino CLI version, for example `0.9.0` or `nightly-latest`, pass the version number
as a parameter like this:

```sh
```
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh -s 0.9.0
```

Expand All @@ -45,75 +47,58 @@ Pre-built binaries for all the supported platforms are available for download fr
If you would like to use the `arduino-cli` command from any location, extract the downloaded file to a directory already
in your `PATH` or add the Arduino CLI installation path to your `PATH` environment variable.

#### Latest packages
#### Latest release

| Platform | | |
| --------- | ------------------ | ------------------ |
| Linux | [Linux 32 bit] | [Linux 64 bit] |
| Linux ARM | [Linux ARM 32 bit] | [Linux ARM 64 bit] |
| Windows | [Windows 32 bit] | [Windows 64 bit] |
| Mac OSX | | [Mac OSX] |
| Platform | | |
| --------- | -------------------- | -------------------- |
| Linux | [32 bit][linux32] | [64 bit][linux64] |
| Linux ARM | [32 bit][linuxarm32] | [64 bit][linuxarm64] |
| Windows | [32 bit][windows32] | [64 bit][windows64] |
| macOS | | [64 bit][macos] |

[linux 64 bit]: https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Linux_64bit.tar.gz
[linux 32 bit]: https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Linux_32bit.tar.gz
[linux arm 64 bit]: https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Linux_ARM64.tar.gz
[linux arm 32 bit]: https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Linux_ARMv7.tar.gz
[windows 64 bit]: https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Windows_64bit.zip
[windows 32 bit]: https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Windows_32bit.zip
[mac osx]: https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_macOS_64bit.tar.gz
[linux64]: https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Linux_64bit.tar.gz
[linux32]: https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Linux_32bit.tar.gz
[linuxarm64]: https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Linux_ARM64.tar.gz
[linuxarm32]: https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Linux_ARMv7.tar.gz
[windows64]: https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Windows_64bit.zip
[windows32]: https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Windows_32bit.zip
[macos]: https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_macOS_64bit.tar.gz

> **Deprecation notice**: links in the form
> `http://downloads.arduino.cc/arduino-cli/arduino-cli-latest-<platform>.tar.bz2` won’t be further updated. That URL
> will provide the version `0.3.7-alpha.preview`, regardless of further releases.

#### Previous versions

These are available from the [releases page](https://github.com/arduino/arduino-cli/releases)
These are available from the "Assets" sections on the [releases page](https://github.com/arduino/arduino-cli/releases).

#### Nightly builds

These builds are generated every day at 01:00 GMT from the `master` branch and should be considered unstable. In order
to get the latest nightly build available for the supported platform, use the following links:

| Platform | | |
| --------- | -------------------------- | -------------------------- |
| Linux | [Nightly Linux 32 bit] | [Nightly Linux 64 bit] |
| Linux ARM | [Nightly Linux ARM 32 bit] | [Nightly Linux ARM 64 bit] |
| Windows | [Nightly Windows 32 bit] | [Nightly Windows 64 bit] |
| Mac OSX | | [Nightly Mac OSX] |

[nightly linux 64 bit]: https://downloads.arduino.cc/arduino-cli/nightly/arduino-cli_nightly-latest_Linux_64bit.tar.gz
[nightly linux 32 bit]: https://downloads.arduino.cc/arduino-cli/nightly/arduino-cli_nightly-latest_Linux_32bit.tar.gz

<!-- prettier-ignore -->
[nightly linux arm 64 bit]: https://downloads.arduino.cc/arduino-cli/nightly/arduino-cli_nightly-latest_Linux_ARM64.tar.gz

<!-- prettier-ignore -->
[nightly linux arm 32 bit]: https://downloads.arduino.cc/arduino-cli/nightly/arduino-cli_nightly-latest_Linux_ARMv7.tar.gz
[nightly windows 64 bit]: https://downloads.arduino.cc/arduino-cli/nightly/arduino-cli_nightly-latest_Windows_64bit.zip
[nightly windows 32 bit]: https://downloads.arduino.cc/arduino-cli/nightly/arduino-cli_nightly-latest_Windows_32bit.zip
[nightly mac osx]: https://downloads.arduino.cc/arduino-cli/nightly/arduino-cli_nightly-latest_macOS_64bit.tar.gz
| Platform | | |
| --------- | ---------------------------- | ---------------------------- |
| Linux | [32 bit][linux32-nightly] | [64 bit][linux64-nightly] |
| Linux ARM | [32 bit][linuxarm32-nightly] | [64 bit][linuxarm64-nightly] |
| Windows | [32 bit][windows32-nightly] | [64 bit][windows64-nightly] |
| macOS | | [64 bit][macos-nightly] |

[linux64-nightly]: https://downloads.arduino.cc/arduino-cli/nightly/arduino-cli_nightly-latest_Linux_64bit.tar.gz
[linux32-nightly]: https://downloads.arduino.cc/arduino-cli/nightly/arduino-cli_nightly-latest_Linux_32bit.tar.gz
[linuxarm64-nightly]: https://downloads.arduino.cc/arduino-cli/nightly/arduino-cli_nightly-latest_Linux_ARM64.tar.gz
[linuxarm32-nightly]: https://downloads.arduino.cc/arduino-cli/nightly/arduino-cli_nightly-latest_Linux_ARMv7.tar.gz
[windows64-nightly]: https://downloads.arduino.cc/arduino-cli/nightly/arduino-cli_nightly-latest_Windows_64bit.zip
[windows32-nightly]: https://downloads.arduino.cc/arduino-cli/nightly/arduino-cli_nightly-latest_Windows_32bit.zip
[macos-nightly]: https://downloads.arduino.cc/arduino-cli/nightly/arduino-cli_nightly-latest_macOS_64bit.tar.gz

> These links return a `302: Found` response, redirecting to latest generated builds by replacing `latest` with the
> latest available build date, using the format YYYYMMDD (i.e for 2019/Aug/06 `latest` is replaced with `20190806` )
> latest available build date, using the format YYYYMMDD (i.e for 2019-08-06 `latest` is replaced with `20190806` )

Checksums for the nightly builds are available at
`https://downloads.arduino.cc/arduino-cli/nightly/nightly-<DATE>-checksums.txt`

### Build from source

If you’re familiar with Golang or if you want to contribute to the project, you will probably build the `arduino-cli`
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
can use [Task][task-site] to get a binary directly from sources. From the project folder run:

```sh
task dist:all
```

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/
[contributing]: CONTRIBUTING.md
[task-site]: https://taskfile.dev/#/installation
If you're familiar with Golang or if you want to contribute to the project, you will probably build Arduino CLI locally
with your Go toolchain. See the ["How to contribute"](CONTRIBUTING.md#building-the-source-code) page for instructions.
Loading