1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-05-31 08:42:49 +03:00

Transition from TravisCI to GitHub CI ()

Convert the continuous integration process to use GitHub's internal
CI cloud.  Allows us to run up to 20 jobs in parallel, speeding up
CI immensely.  Keep a short Travis-CI run, too, just for sanity and backup.

Uses new keys and secret when publishing a release to
esp8266.github.io.
This commit is contained in:
Earle F. Philhower, III 2020-07-14 22:02:47 -07:00 committed by GitHub
parent f8091311a3
commit 3bd24587e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 442 additions and 173 deletions

259
.github/workflows/pull-request.yml vendored Normal file

@ -0,0 +1,259 @@
# Run whenever a PR is generated or updated.
# Most jobs check out the code, ensure Python3 is installed, and for build
# tests the ESP8266 toolchain is cached when possible to speed up execution.
name: ESP8266 Arduino CI
on:
pull_request:
jobs:
# Run 8 parallel jobs for the default build of all examples.
build-linux:
name: Build ${{ matrix.chunk }}
runs-on: ubuntu-latest
strategy:
matrix:
chunk: [0, 1, 2, 3, 4, 5, 6, 7]
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Cache Linux toolchain
id: cache-linux
uses: actions/cache@v2
with:
path: ./tools/dist
key: key-linux-toolchain
- name: Build Sketches
env:
TRAVIS_BUILD_DIR: ${{ github.workspace }}
TRAVIS_TAG: ${{ github.ref }}
BUILD_PARITY: custom
mod: 8
rem: ${{ matrix.chunk }}
run: |
bash ./tests/build.sh
# Cover the debug and IPv6 cases by enabling both and running 8 parallel jobs
# over all example code.
build-debug-ipv6:
name: Debug IPv6 ${{ matrix.chunk }}
runs-on: ubuntu-latest
strategy:
matrix:
chunk: [0, 1, 2, 3, 4, 5, 6, 7]
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Cache Linux toolchain
id: cache-linux
uses: actions/cache@v2
with:
path: ./tools/dist
key: key-linux-toolchain
- name: Build Sketches
env:
TRAVIS_BUILD_DIR: ${{ github.workspace }}
TRAVIS_TAG: ${{ github.ref }}
BUILD_PARITY: custom
mod: 8
rem: ${{ matrix.chunk }}
run: |
bash ./tests/debug6.sh
# Single build under Windows to ensure the Win toolchain is good.
build-windows:
name: Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Cache Windows toolchain
id: cache-windows
uses: actions/cache@v2
with:
path: ./tools/dist
key: key-windows-toolchain
- name: Build Sketch
env:
TRAVIS_BUILD_DIR: ${{ github.workspace }}
TRAVIS_TAG: ${{ github.ref }}
WINDOWS: 1
BUILD_PARITY: custom
mod: 500
rem: 1
run: |
# Windows has python3 already installed, but it's called "python".
# Copy python.exe to the proper name so scripts "just work".
copy (get-command python).source (get-command python).source.Replace("python.exe", "python3.exe")
bash ./tests/build.sh
# Single build under macOS to ensure the Mac toolchain is good.
build-mac:
name: Mac
runs-on: macOS-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Cache Mac toolchain
id: cache-mac
uses: actions/cache@v2
with:
path: ./tools/dist
key: key-mac-toolchain
- name: Build Sketch
env:
TRAVIS_BUILD_DIR: ${{ github.workspace }}
TRAVIS_TAG: ${{ github.ref }}
MACOSX: 1
BUILD_PARITY: custom
mod: 500
rem: 1
run: |
bash ./tests/build.sh
# Run a few Platform.IO jobs (not full suite) to check PIO integration.
build-pio:
name: Build Platform.IO
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Build subset on Platform.IO
env:
TRAVIS_BUILD_DIR: ${{ github.workspace }}
TRAVIS_TAG: ${{ github.ref }}
BUILD_PARITY: custom
mod: 42 # Picked at random to give 4-5 builds and exit.
rem: 13
run: |
sudo apt-get install python3-pip python3-setuptools
PATH=/home/runner/.local/bin:$PATH bash ./tests/platformio.sh
# Run host test suite under valgrind for runtime checking of code.
host-tests:
name: Host tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Run host tests
env:
TRAVIS_BUILD_DIR: ${{ github.workspace }}
TRAVIS_TAG: ${{ github.ref }}
run: |
sudo apt-get install valgrind lcov
bash ./tests/ci/host_test.sh
# Ensure Sphinx can build the documentation properly.
documentation:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Build documentation
env:
TRAVIS_BUILD_DIR: ${{ github.workspace }}
TRAVIS_TAG: ${{ github.ref }}
run: |
sudo apt-get install python3-pip python3-setuptools
# GitHub CI installs pip3 and setuptools outside the path.
# Update the path to include them and run.
PATH=/home/runner/.local/bin:$PATH pip3 install --user -r doc/requirements.txt
PATH=/home/runner/.local/bin:$PATH bash ./tests/ci/build_docs.sh
# Standard Arduino formatting in all the examples
style-check:
name: Style and formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Style check
env:
TRAVIS_BUILD_DIR: ${{ github.workspace }}
TRAVIS_TAG: ${{ github.ref }}
run: |
sudo apt-get install astyle
bash ./tests/ci/style_check.sh
# Quick test that the mocking builds succeed
mock-check:
name: Mock trivial test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Mock build
env:
TRAVIS_BUILD_DIR: ${{ github.workspace }}
TRAVIS_TAG: ${{ github.ref }}
run: |
bash ./tests/buildm.sh
# Ensure no manual edits to boards.txt
boards-check:
name: Boards.txt check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Boards.txt diff
env:
TRAVIS_BUILD_DIR: ${{ github.workspace }}
TRAVIS_TAG: ${{ github.ref }}
run: |
bash ./tests/ci/build_boards.sh

@ -0,0 +1,56 @@
# Whenever a release is published from a draft, this will update the
# master Arduino JSON file to add its new entry.
# We keep the master JSON file in another repo, so we need to use a pre-set
# Deployment SSH key to be able to push a change to the repo.
#### Steps to follow when you need to make a new SSH key for upload (not
#### normally needed!)
# Generate a new SSH key private/public pair
# ssh-keygen -t rsa -b 4096 -C "your@email.com" -f ./deploy_rsa
# Upload deploy_rsa.pub to the *ESP8266.GITHUB.IO* repo as a deployment key
# Convert the private key to base64 (to remove line breaks and allow easier
# usage in the script as an environment variable)
# base64.exe -w 0 < deploy_rsa > deploy_rsa.b64
# Copy the contents of the .b64 file to the clipboard, make a new GitHub
# secret in the ESP8266/Arduino repo called "GHCI_DEPLOY_KEY" and paste
# the B64 code into the variable.
name: ESP8266 Arduino Release Publisher
on:
release:
types: [published]
jobs:
package:
name: Update master JSON file
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Set GIT tag name
run: |
echo "::set-env name=TRAVIS_TAG::$(git describe --exact-match --tags)"
- name: Deploy updated JSON
env:
TRAVIS_BUILD_DIR: ${{ github.workspace }}
BUILD_TYPE: package
CI_GITHUB_API_KEY: ${{ secrets.GITHUB_TOKEN }}
GHCI_DEPLOY_KEY: ${{ secrets.GHCI_DEPLOY_KEY }}
run: |
bash ./tests/ci/build_package.sh
# Only the regenerated JSON file will be used, but it's simpler
# than looking for it in a GH release.
bash ./package/deploy_package_index.sh

@ -0,0 +1,40 @@
# Whenever a tag of the form #.xxxx is pushed against master, generate a
# draft release and upload the ZIP and JSON file to it. Maintainers then
# will manually add the changelist and publish it.
name: ESP8266 Arduino Draft Release
on:
push:
tags:
# Run for tags of the x.x.x* form (i.e. 3.0.0, 3.0.0-beta, etc.).
- '[0-9]+.[0-9]+.[0-9]+*'
jobs:
package:
name: Package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Set GIT tag name
run: |
# Sets an environment variable used in the next steps
echo "::set-env name=TRAVIS_TAG::$(git describe --exact-match --tags)"
- name: Build package JSON
env:
TRAVIS_BUILD_DIR: ${{ github.workspace }}
BUILD_TYPE: package
CI_GITHUB_API_KEY: ${{ secrets.GITHUB_TOKEN }}
run: |
bash ./tests/ci/build_package.sh
pip3 install PyGithub
# Create a draft release and upload the ZIP and JSON files.
# This draft is not visible to normal users and needs to be
# updated manually with release notes and published from the
# GitHub web interface.
python3 ./package/upload_release.py --user "$GITHUB_ACTOR" --repo "$GITHUB_REPOSITORY" --token "$CI_GITHUB_API_KEY" --tag "$TRAVIS_TAG" --name "Release $TRAVIS_TAG" --msg "Update the draft with release notes before publishing." package/versions/*/*.zip package/versions/*/package_esp8266com_index.json

@ -1,3 +1,12 @@
# TravisCI left in repo as a backup CI solution in case GitHub CI suffers a
# major disruption. Only a few, quick tests are run in order to keep the
# TravisCI runtime equal to the GitHub CI time (to avoid bottlenecking on
# TravisCI).
#
# If GitHub CI goes away, it would make sense to drop this .YML file and
# use the complete one from release tag 2.7.2
language: bash
os: linux
dist: bionic
@ -9,135 +18,46 @@ git:
before_install:
- git submodule update --init # no recursive update
cache:
directories:
- $HOME/astyle
stages:
- build
- deploy
# Run only 5 jobs since TravisCI only allows 5 in parallel
jobs:
include:
# Build stage. To save time, run all kinds of builds and tests in parallel.
- name: "Platformio (1)"
- name: "Platform.IO"
stage: build
script: $TRAVIS_BUILD_DIR/tests/platformio.sh
install:
- sudo apt-get install python3-pip python3-setuptools
env:
- BUILD_PARITY=even
- name: "Platformio (2)"
stage: build
script: $TRAVIS_BUILD_DIR/tests/platformio.sh
install:
- sudo apt-get install python3-pip python3-setuptools
env:
- BUILD_PARITY=odd
# PIO is very slow, so do 1/2 as many builds as Arduino
- BUILD_PARITY=custom mod=20 rem=5
- name: "Build (1)"
- name: "Build 1/4"
stage: build
script: $TRAVIS_BUILD_DIR/tests/build.sh
env:
- BUILD_PARITY=even
- name: "Build (2)"
- BUILD_PARITY=custom mod=10 rem=1
- name: "Build 2/4"
stage: build
script: $TRAVIS_BUILD_DIR/tests/build.sh
env:
- BUILD_PARITY=odd
- BUILD_PARITY=custom mod=10 rem=2
- name: "Debug IPv6 (1)"
stage: build
script: $TRAVIS_BUILD_DIR/tests/debug6.sh
env:
- BUILD_PARITY=even
- name: "Debug IPv6 (2)"
stage: build
script: $TRAVIS_BUILD_DIR/tests/debug6.sh
env:
- BUILD_PARITY=odd
# - name: "Build IPv6 (1)"
# stage: build
# script: $TRAVIS_BUILD_DIR/tests/build6.sh
# env:
# - BUILD_PARITY=even
# - name: "Build IPv6 (2)"
# stage: build
# script: $TRAVIS_BUILD_DIR/tests/build6.sh
# env:
# - BUILD_PARITY=odd
- name: "Mac OSX can build sketches"
os: osx
- name: "Build 3/4"
stage: build
script: $TRAVIS_BUILD_DIR/tests/build.sh
env: MACOSX=1 BUILD_PARITY=custom mod=500 rem=1
env:
- BUILD_PARITY=custom mod=10 rem=3
- name: "Windows can build sketches"
os: windows
- name: "Build 4/4"
stage: build
script: $TRAVIS_BUILD_DIR/tests/build.sh
env: WINDOWS=1 BUILD_PARITY=custom mod=500 rem=1
- name: "Host tests"
stage: build
script: $TRAVIS_BUILD_DIR/tests/ci/host_test.sh
install:
- sudo apt-get install valgrind lcov
- name: "Docs"
stage: build
script: $TRAVIS_BUILD_DIR/tests/ci/build_docs.sh
install:
- sudo apt-get install python3-pip python3-setuptools
- pip3 install --user -r doc/requirements.txt;
- name: "Style check"
stage: build
script: $TRAVIS_BUILD_DIR/tests/ci/style_check.sh
install: tests/ci/install_astyle.sh
- name: "Mock trivial test"
stage: build
script: $TRAVIS_BUILD_DIR/tests/buildm.sh
- name: "Boards"
stage: build
script: $TRAVIS_BUILD_DIR/tests/ci/build_boards.sh
# Deploy stage.
# Here we build the package JSON (always) and do the deployments
- name: "Package / deploy"
stage: deploy
script: tests/ci/build_package.sh
env: BUILD_TYPE=package
before_deploy: git submodule update --init
deploy:
# Create Github release, upload artifacts
- provider: releases
draft: true
skip_cleanup: true
api_key:
secure: kYsxX/N21fwLSTLpbb0c96PnQHn1CIMqZstm02hfUhCX83FygWSh4vs3gzW28DMpjQMZ6vC4g+jtfosYU2tUhht/bynurDH4edpEyGeMyK+fzCI9pAr4JT0RbKQI84EC18ScpgP/UP0jTc1LJ+xl8UMwSiDE0mzHx7xJ4mMNQbA=
file_glob: true
tag_name: $TRAVIS_TAG
target_commitish: $TRAVIS_COMMIT
file:
- package/versions/$TRAVIS_TAG/esp8266-$TRAVIS_TAG.zip
- package/versions/$TRAVIS_TAG/package_esp8266com_index.json
on:
repo: esp8266/Arduino
tags: true
# Update the package index URL to point to the new version
- provider: script
skip_cleanup: true
script: bash package/deploy_package_index.sh
on:
repo: esp8266/Arduino
tags: true
env:
- BUILD_PARITY=custom mod=10 rem=4
notifications:
email:

Binary file not shown.

@ -1,33 +1,25 @@
#!/bin/bash
#set -x
# Extract the release name from a release
ver=`git describe --tag`
# Default to draft tag name
ver=$(basename $(jq -e -r '.ref' "$GITHUB_EVENT_PATH"))
# If not available, try the publish tag name
if [ "$ver" == "null" ]; then
ver=$(jq -e -r '.release.tag_name' "$GITHUB_EVENT_PATH")
fi
# Fall back to the git description OTW (i.e. interactive)
if [ "$ver" == "null" ]; then
ver=$(git describe --tag)
fi
visiblever=$ver
# match 0.0.*
if [ "${ver%.*}" = 0.0 ]; then
plainver=$ver
# Match 0.0.* as special-case early-access builds
if [ "${ver%.*}" = 0.0 ]; then
git tag -d ${ver}
ver=`git describe --tag HEAD`
plain_ver=$ver
else
# Extract next version from platform.txt
next=`sed -n -E 's/version=([0-9.]+)/\1/p' ../platform.txt`
# Figure out how will the package be called
ver=`git describe --exact-match`
if [ $? -ne 0 ]; then
# not tagged version; generate nightly package
date_str=`date +"%Y%m%d"`
is_nightly=1
plain_ver="${next}-nightly"
ver="${plain_ver}+${date_str}"
else
plain_ver=$ver
fi
visiblever=$ver
fi
set -e

@ -1,32 +1,36 @@
#!/bin/bash
#
# This script updates package index hosted on esp8266.github.io (aka arduino.esp8266.com).
# Normally is run by Travis CI for tagged versions, as a deploy step.
tag=`git describe --tags`
tag=$(jq -r '.release.tag_name' "$GITHUB_EVENT_PATH")
if [ "$tag" == "" ]; then
tag=`git describe --tags`
fi
cd $(dirname "$0")
# Decrypt and install SSH private key.
# "encrypted_xxx_key" and "encrypted_xxx_iv" are environment variables
# known to Travis CI builds.
openssl aes-256-cbc -K $encrypted_3a94a4db7dec_key -iv $encrypted_3a94a4db7dec_iv -in esp8266_github_io_deploy.enc -out esp8266_github_io_deploy -d
set -e # Abort with error if anything here does not go as expected!
# Install SSH private key from a GH Secret
echo $GHCI_DEPLOY_KEY | base64 -d > esp8266_github_io_deploy
eval "$(ssh-agent -s)"
chmod 600 esp8266_github_io_deploy
ssh-add esp8266_github_io_deploy
mkdir -p ~/.ssh
chmod go-w ~/.ssh
echo -e "Host github.com\nStrictHostKeyChecking no\n" >> ~/.ssh/config
chmod go-w ~/.ssh/config
# Clone the Github pages repository
git clone git@github.com:esp8266/esp8266.github.io.git
pushd esp8266.github.io
# Update the package index
cp ../versions/$tag/package_esp8266com_index.json stable/package_esp8266com_index.json
cp ../versions/*/package_esp8266com_index.json stable/package_esp8266com_index.json
git add stable/package_esp8266com_index.json
# Commit and push the changes
git config user.email "travis@travis-ci.org"
git config user.name "Travis CI"
git commit -m "update package index for release $tag"
git config user.email "github-ci-action@github.com"
git config user.name "GitHub CI Action"
git commit -m "Update package index for release $tag"
git push origin master
popd

30
package/upload_release.py Normal file

@ -0,0 +1,30 @@
#!/usr/bin/env python3
from github import Github
import argparse
import collections
import glob
import json
import mimetypes
import os
parser = argparse.ArgumentParser(description='Upload a set of files to a new draft release')
parser.add_argument('--user', help="Github username", type=str, required=True)
parser.add_argument('--token', help="Github Personal Access Token (PAT)", type=str, required=True)
parser.add_argument('--repo', help="Repository", type=str, required=True)
parser.add_argument('--tag', help="Release tag", type=str, required=True)
parser.add_argument('--name', help="Release name", type=str, required=True)
parser.add_argument('--msg', help="Release message", type=str, required=True)
parser.add_argument('files', nargs=argparse.REMAINDER)
args = parser.parse_args()
if len(args.files) == 0:
print("ERROR: No files specified")
quit()
gh = Github(login_or_token=args.token)
repo = gh.get_repo(str(args.repo))
release = repo.create_git_release(args.tag, args.name, args.msg, draft=True)
for fn in args.files:
print("Uploading file: " + fn)
release.upload_asset(fn)

@ -1,16 +0,0 @@
#!/bin/bash
#
# $HOME/astyle directory is cached on Travis.
# If cached build is not present, download astyle and build it.
# Install built astyle binary into the home directory.
#
set -e
if [ ! -f $HOME/astyle/build/gcc/bin/astyle ]; then
wget -O astyle_3.1_linux.tar.gz https://sourceforge.net/projects/astyle/files/astyle/astyle%203.1/astyle_3.1_linux.tar.gz/download
tar -xf astyle_3.1_linux.tar.gz -C $HOME
make -C $HOME/astyle/build/gcc
fi
make -C $HOME/astyle/build/gcc prefix=$HOME install

@ -58,7 +58,7 @@ function build_sketches()
local build_rem=$5
local lwip=$6
mkdir -p $build_dir
local build_cmd="python3 tools/build.py -b generic -v -w all -s 4M1M -v -k --build_cache $cache_dir -p $PWD/$build_dir -n $lwip $build_arg "
local build_cmd="python3 tools/build.py -b generic -v -w all -s 4M1M -v -k --build_cache $cache_dir -p ./$build_dir -n $lwip $build_arg "
if [ "$WINDOWS" = "1" ]; then
# Paths to the arduino builder need to be / referenced, not our native ones
build_cmd=$(echo $build_cmd --ide_path $arduino | sed 's/ \/c\// \//g' ) # replace '/c/' with '/'
@ -140,7 +140,7 @@ function install_libraries()
pushd $HOME/Arduino/libraries
# install ArduinoJson library
{ test -r ArduinoJson-v6.11.0.zip || wget -q -nv https://github.com/bblanchon/ArduinoJson/releases/download/v6.11.0/ArduinoJson-v6.11.0.zip; } && unzip -q ArduinoJson-v6.11.0.zip
{ test -r ArduinoJson-v6.11.0.zip || curl --output ArduinoJson-v6.11.0.zip -L https://github.com/bblanchon/ArduinoJson/releases/download/v6.11.0/ArduinoJson-v6.11.0.zip; } && unzip -q ArduinoJson-v6.11.0.zip
popd
}
@ -159,21 +159,7 @@ function install_ide()
local core_path=$2
local debug=$3
if [ "$WINDOWS" = "1" ]; then
mkdir /c/mybin
pushd /c/mybin
# Use Python.org to install python3 and make sure it is in path
wget -q -nv https://www.python.org/ftp/python/3.8.1/python-3.8.1-embed-win32.zip
unzip -q python-3.8.1-embed-win32.zip
cp "python.exe" "python3.exe"
wget -q -nv -O sed.exe https://github.com/mbuilov/sed-windows/raw/master/sed-4.8-x64.exe
#wget -nv https://fossies.org/windows/misc/unz600xn.exe
#unzip -q ./unz600xn.exe
popd
export PATH="c:\\mybin:$PATH" # Ensure it's live from now on...
python3 --version
sed --version
awk --version
test -r arduino-windows.zip || wget -q -nv -O arduino-windows.zip "${ideurl}-windows.zip"
test -r arduino-windows.zip || curl --output arduino-windows.zip -L "${ideurl}-windows.zip"
unzip -q arduino-windows.zip
mv arduino-${idever} arduino-distrib
elif [ "$MACOSX" = "1" ]; then
@ -188,7 +174,6 @@ function install_ide()
mv Arduino.app arduino-distrib
mv arduino-distrib/Contents/Java/* arduino-distrib/.
else
#test -r arduino.tar.xz || wget -O arduino.tar.xz https://www.arduino.cc/download.php?f=/arduino-nightly-linux64.tar.xz
test -r arduino-linux.tar.xz || wget -q -O arduino-linux.tar.xz "${ideurl}-linux64.tar.xz"
tar xf arduino-linux.tar.xz
mv arduino-${idever} arduino-distrib

1
tests/debug6.sh Executable file → Normal file

@ -19,4 +19,3 @@ install_arduino debug
build_sketches_with_arduino "$mod" "$rem" lm6f
rm -rf "$cache_dir"