diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 000000000..e7ed19680 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,134 @@ +name: Nightly build + +on: + schedule: + # run every day at 1AM + - cron: "0 1 * * *" + +jobs: + create-nightly-artifacts: + # This workflow is only of value to the arduino/arduino-arduino-lint repository and + # would always fail in forks + if: github.repository == 'arduino/arduino-lint' + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install Taskfile + uses: arduino/actions/setup-taskfile@master + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + version: 3.x + + - name: Build + env: + CUSTOM_VERSION: nightly + run: task dist:all + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: dist + path: dist + + notarize-macos: + runs-on: macos-latest + needs: create-nightly-artifacts + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Download artifacts + uses: actions/download-artifact@v2 + with: + name: dist + # to ensure compatibility with v1 + path: dist + + - name: Import Code-Signing Certificates + env: + KEYCHAIN: "sign.keychain" + INSTALLER_CERT_MAC_PATH: "/tmp/ArduinoCerts2020.p12" + KEYCHAIN_PASSWORD: keychainpassword # Arbitrary password for a keychain that exists only for the duration of the job, so not secret + run: | + echo "${{ secrets.INSTALLER_CERT_MAC_P12 }}" | base64 --decode > ${{ env.INSTALLER_CERT_MAC_PATH }} + security create-keychain -p ${{ env.KEYCHAIN_PASSWORD }} ${{ env.KEYCHAIN }} + security default-keychain -s ${{ env.KEYCHAIN }} + security unlock-keychain -p ${{ env.KEYCHAIN_PASSWORD }} ${{ env.KEYCHAIN }} + security import ${{ env.INSTALLER_CERT_MAC_PATH }} -k ${{ env.KEYCHAIN }} -f pkcs12 -A -T /usr/bin/codesign -P ${{ secrets.INSTALLER_CERT_MAC_PASSWORD }} + security set-key-partition-list -S apple-tool:,apple: -s -k ${{ env.KEYCHAIN_PASSWORD }} ${{ env.KEYCHAIN }} + + - name: Install gon for code signing and app notarization + run: | + wget -q https://github.com/mitchellh/gon/releases/download/v0.2.3/gon_macos.zip + unzip gon_macos.zip -d /usr/local/bin + + - name: Sign and notarize binary + env: + AC_USERNAME: ${{ secrets.AC_USERNAME }} + AC_PASSWORD: ${{ secrets.AC_PASSWORD }} + run: | + gon gon.config.hcl + + - name: Re-package binary and update checksum + # This step performs the following: + # 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 + run: | + # GitHub's upload/download-artifact@v2 action doesn't preserve file permissions, + # so we need to add execution permission back until the action is made to do this. + chmod +x dist/arduino-lint_osx_darwin_amd64/arduino-lint + PACKAGE_FILENAME="$(basename dist/arduino-lint_nightly-*_macOS_64bit.tar.gz)" + tar -czvf dist/$PACKAGE_FILENAME \ + -C dist/arduino-lint_osx_darwin_amd64/ arduino-lint \ + -C ../../ LICENSE.txt + 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 + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: dist + path: dist + + publish-nightly: + runs-on: ubuntu-latest + needs: notarize-macos + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Download artifact + uses: actions/download-artifact@v2 + with: + name: dist + # to ensure compatibility with v1 + path: dist + + - name: Upload release files on Arduino downloads servers + uses: docker://plugins/s3 + env: + PLUGIN_SOURCE: "dist/*" + PLUGIN_TARGET: "/arduino-lint/nightly" + PLUGIN_STRIP_PREFIX: "dist/" + PLUGIN_BUCKET: ${{ secrets.DOWNLOADS_BUCKET }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + + - name: Report failure + if: failure() + uses: masci/datadog@v1 + with: + api-key: ${{ secrets.DD_API_KEY }} + events: | + - title: "arduino-lint nightly build failed" + text: "Nightly build workflow has failed" + alert_type: "error" + host: ${{ github.repository }} + tags: + - "project:arduino-lint" + - "workflow:${{ github.workflow }}" diff --git a/DistTasks.yml b/DistTasks.yml index 983881cd1..724a554c2 100644 --- a/DistTasks.yml +++ b/DistTasks.yml @@ -190,17 +190,18 @@ tasks: PACKAGE_NAME: "{{ .PROJECT_NAME }}_{{ .VERSION }}_{{ .PACKAGE_PLATFORM }}.tar.gz" vars: - VERSION: + TAG: sh: echo "`git describe --tags --abbrev=0`" TIMESTAMP_SHORT: sh: echo "{{now | date "20060102"}}" + VERSION: "{{if .CUSTOM_VERSION}}{{.CUSTOM_VERSION}}-{{.TIMESTAMP_SHORT}}{{else}}{{.TAG}}{{end}}" DIST_LDFLAGS: >- -ldflags ' - -X {{ .CONFIGURATION_PACKAGE }}.version={{.VERSION}} + -X {{ .CONFIGURATION_PACKAGE }}.version={{.TAG}} -X {{ .CONFIGURATION_PACKAGE }}.commit={{.COMMIT}} -X {{ .CONFIGURATION_PACKAGE }}.buildTimestamp={{.TIMESTAMP}} ' CONTAINER: "docker.elastic.co/beats-dev/golang-crossbuild" GO_VERSION: "1.14.7" - CHECKSUM_FILE: "{{ .VERSION }}-{{ .TIMESTAMP_SHORT }}-checksums.txt" + CHECKSUM_FILE: "{{ .VERSION }}-checksums.txt" diff --git a/README.md b/README.md index 1da227e75..546c1e9ef 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # arduino-lint [![Tests Status](https://github.com/arduino/arduino-lint/workflows/Run%20tests/badge.svg)](https://github.com/arduino/arduino-lint/actions?workflow=Run+tests) +[![Nightly Status](https://github.com/arduino/arduino-lint/workflows/Nightly%20build/badge.svg)](https://github.com/arduino/arduino-lint/actions?workflow=Nightly+build) [![Docs Status](https://github.com/arduino/arduino-lint/workflows/Publish%20documentation/badge.svg)](https://github.com/arduino/arduino-lint/actions?workflow=Publish+documentation) **arduino-lint** is a command line tool that checks for common problems in [Arduino](https://www.arduino.cc/) projects: @@ -8,6 +9,8 @@ - Sketches - Libraries +## Documentation + For usage instructions, see [the documentation](https://arduino.github.io/arduino-lint/latest/) ## Continuous Integration @@ -15,3 +18,15 @@ For usage instructions, see [the documentation](https://arduino.github.io/arduin There is a GitHub Actions action that makes it easy to use **arduino-lint**` in your CI workflows! See https://github.com/arduino/arduino-lint-action for more information. + +## How to contribute + +Contributions are welcome! + +Please see the [How to contribute](https://arduino.github.io/arduino-lint/latest/CONTRIBUTING/) page for information on +building the source code, running tests, and contributing your changes to the project. + +### Beta testing + +[Nightly builds](https://arduino.github.io/arduino-lint/latest/installation/#nightly-builds) are available for beta +testing. diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index d9dce8772..c0ddead09 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -8,11 +8,13 @@ There are several ways you can get involved: | ------------------------------------------------- | ------------------------------------------------------- | | - Support request
- Question
- Discussion | Post on the [Arduino Forum][forum] | | - Bug report
- Feature request | Issue report (read the [issue guidelines][issues]) | +| Beta testing | Try out the [nightly build][nightly] | | - Bug fix
- Enhancement | Pull Request (read the [pull request guidelines][prs]) | | Monetary | - [Donate][donate]
- [Buy official products][store] | [forum]: https://forum.arduino.cc/index.php?board=3.0 [issues]: #issue-reports +[nightly]: installation.md#nightly-builds [prs]: #pull-requests [donate]: https://www.arduino.cc/en/Main/Contribute [store]: https://store.arduino.cc @@ -26,6 +28,7 @@ High quality bug reports and feature requests are valuable contributions to the ### Before reporting an issue +- Give the [nightly build](installation.md#nightly-builds) a test drive to see if your issue was already resolved. - Search [existing pull requests and issues](https://github.com/arduino/arduino-lint/issues?q=) to see if it was already reported. If you have additional information to provide about an existing issue, please comment there. You can use [GitHub's "Reactions" feature](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments) if you diff --git a/docs/installation.md b/docs/installation.md index 50de6bb8c..1f75d62e7 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -18,8 +18,8 @@ curl -fsSL https://raw.githubusercontent.com/arduino/arduino-lint/main/etc/insta If you would like to use the `arduino-lint` command from any location, install arduino-lint to a directory already in your `PATH` or add the arduino-lint installation path to your `PATH` environment variable. -If you want to download a specific arduino-lint version, for example `0.9.0`, pass the version number as a parameter -like this: +If you want to download a specific arduino-lint version, for example `0.9.0` or `nightly-latest`, pass the version +number as a parameter like this: ``` curl -fsSL https://raw.githubusercontent.com/arduino/arduino-lint/main/etc/install.sh | sh -s 0.9.0 @@ -53,6 +53,30 @@ already in your `PATH` or add the arduino-lint installation path to your `PATH` These are available from the "Assets" sections on the [releases page](https://github.com/arduino/arduino-lint/releases). +#### Nightly builds + +These builds are generated every day at 01:00 GMT from the `main` 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 | [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-lint/nightly/arduino-lint_nightly-latest_Linux_64bit.tar.gz +[linux32-nightly]: https://downloads.arduino.cc/arduino-lint/nightly/arduino-lint_nightly-latest_Linux_32bit.tar.gz +[linuxarm64-nightly]: https://downloads.arduino.cc/arduino-lint/nightly/arduino-lint_nightly-latest_Linux_ARM64.tar.gz +[linuxarm32-nightly]: https://downloads.arduino.cc/arduino-lint/nightly/arduino-lint_nightly-latest_Linux_ARMv7.tar.gz +[windows64-nightly]: https://downloads.arduino.cc/arduino-lint/nightly/arduino-lint_nightly-latest_Windows_64bit.zip +[windows32-nightly]: https://downloads.arduino.cc/arduino-lint/nightly/arduino-lint_nightly-latest_Windows_32bit.zip +[macos-nightly]: https://downloads.arduino.cc/arduino-lint/nightly/arduino-lint_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-08-06 `latest` is replaced with `20190806` ) + +Checksums for the nightly builds are available at `https://downloads.arduino.cc/arduino-lint/nightly/nightly--checksums.txt` ### Build from source diff --git a/etc/install.sh b/etc/install.sh index c3bd00f79..1c14302bb 100755 --- a/etc/install.sh +++ b/etc/install.sh @@ -139,7 +139,17 @@ downloadFile() { else ARDUINO_LINT_DIST="${PROJECT_NAME}_${TAG}_${OS}_${ARCH}.tar.gz" fi - DOWNLOAD_URL="https://downloads.arduino.cc/${PROJECT_NAME}/${ARDUINO_LINT_DIST}" + + # Support specifying nightly build versions (e.g., "nightly-latest") via the script argument. + case "$TAG" in + nightly*) + DOWNLOAD_URL="https://downloads.arduino.cc/${PROJECT_NAME}/nightly/${ARDUINO_LINT_DIST}" + ;; + *) + DOWNLOAD_URL="https://downloads.arduino.cc/${PROJECT_NAME}/${ARDUINO_LINT_DIST}" + ;; + esac + ARDUINO_LINT_TMP_FILE="/tmp/$ARDUINO_LINT_DIST" echo "Downloading $DOWNLOAD_URL" httpStatusCode=$(getFile "$DOWNLOAD_URL" "$ARDUINO_LINT_TMP_FILE")