Skip to content

Commit

Permalink
Speed up and reorganize the CI system (#2505)
Browse files Browse the repository at this point in the history
* Start Using Github Actions for Continuous Integration,  Coverity Scan and Release workflows.
* Use appveyor for the failing CI Tests for Host @ Windows.
  • Loading branch information
slaff authored May 17, 2022
1 parent d1a9e92 commit da1ff08
Show file tree
Hide file tree
Showing 9 changed files with 217 additions and 28 deletions.
92 changes: 92 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Continuous Integration (CI)

on:
push:

pull_request:
branches: [ develop ]

jobs:
build:
strategy:
fail-fast: false
matrix:
arch: [Esp8266, Host, Esp32, Rp2040]
variant: [""]
os: [ubuntu-latest, windows-latest]
include:
- arch: Esp32
variant: esp32s2
os: ubuntu-latest
- arch: Esp32
variant: esp32s2
os: windows-latest
- arch: Esp32
variant: esp32c3
os: ubuntu-latest
- arch: Esp32
variant: esp32c3
os: windows-latest
exclude:
- os: windows-latest
arch: Host

continue-on-error: ${{ matrix.arch == 'Host' && matrix.os == 'windows-latest' }}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ toJson(matrix) }}
cancel-in-progress: true

runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup SMING_HOME for Ubuntu
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
echo "CI_BUILD_DIR=$GITHUB_WORKSPACE" >> $GITHUB_ENV
echo "SMING_HOME=$GITHUB_WORKSPACE/Sming" >> $GITHUB_ENV
- name: Setup SMING_HOME for Windows
if: ${{ matrix.os == 'windows-latest' }}
run: |
echo ("CI_BUILD_DIR=" + $env:GITHUB_WORKSPACE) >> $env:GITHUB_ENV
$env:SMING_HOME = Join-Path $env:GITHUB_WORKSPACE "Sming"
echo ("SMING_HOME=" + $env:SMING_HOME) >> $env:GITHUB_ENV
- name: Install Sming Framework on Ubuntu
if: ${{ matrix.os == 'ubuntu-latest' }}
env:
SMING_ARCH: ${{matrix.arch}}
SMING_SOC: ${{matrix.variant}}
run: |
./Tools/install.sh $(echo "$SMING_ARCH" | tr '[:upper:]' '[:lower:]')
- name: Install Sming Framework on Windows
if: ${{ matrix.os == 'windows-latest' }}
env:
SMING_ARCH: ${{matrix.arch}}
SMING_SOC: ${{matrix.variant}}
run: |
Tools/ci/setenv.ps1
Tools/install.cmd "$env:SMING_ARCH".ToLower()
- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@master
- name: Build and Test for ${{matrix.arch}} on Ubuntu
env:
SMING_ARCH: ${{matrix.arch}}
SMING_SOC: ${{matrix.variant}}
CLANG_FORMAT: clang-format-8
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
source $SMING_HOME/../Tools/export.sh
$CLANG_FORMAT --version
./Tools/ci/build.sh
- name: Build and Test for ${{matrix.arch}} on Windows
env:
SMING_ARCH: ${{matrix.arch}}
SMING_SOC: ${{matrix.variant}}
PYTHON_PATH: C:\hostedtoolcache\windows\Python\3.9.12\x64\
if: ${{ matrix.os == 'windows-latest' }}
run: |
Tools/ci/setenv.ps1
Tools/ci/build.cmd
73 changes: 73 additions & 0 deletions .github/workflows/coverity-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Coverity Scan

on:
# Push to master MUST be evaluated
# Pushing to develop only on condition
push:
branches: [ master, develop ]
# Pull requests to master MUST be evaluated
pull_request:
branches: [ master ]
# Run the workflow once a month
schedule:
- cron: '30 1 1 * *'

jobs:
scan:
# concurrency:
# group: ${{ github.head_ref || github.run_id }}
# cancel-in-progress: true

runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Check if we are allowed to scan
env:
BRANCH: ${{github.ref_name}}
run: |
CHECK_SCA=0
if [[ "$BRANCH" == "master" ]]; then
CHECK_SCA=1;
elif [[ $BRANCH == "develop" ]]; then
if [[ "$GITHUB_EVENT_NAME" == "schedule" ]]; then
CHECK_SCA=1;
elif [[ "$GITHUB_EVENT_NAME" == "push" ]]; then
COMMIT_MSG=$(git log --format=%B -n 1)
if [[ "$COMMIT_MSG" == *"[scan:coverity]"* ]]; then
CHECK_SCA=1;
fi
fi
fi
echo "CHECK_SCA=$CHECK_SCA" >> $GITHUB_ENV
- name: Setup SMING_HOME for Ubuntu
if: ${{ env.CHECK_SCA == 1 }}
run: |
echo "CI_BUILD_DIR=$GITHUB_WORKSPACE" >> $GITHUB_ENV
echo "SMING_HOME=$GITHUB_WORKSPACE/Sming" >> $GITHUB_ENV
echo "SMING_ARCH=Host" >> $GITHUB_ENV
- name: Install Sming Framework on Ubuntu
if: ${{ env.CHECK_SCA == 1 }}
run: |
./Tools/install.sh $(echo "$SMING_ARCH" | tr '[:upper:]' '[:lower:]')
- name: Install Ninja
if: ${{ env.CHECK_SCA == 1 }}
uses: seanmiddleditch/gha-setup-ninja@master
- name: Run Coverity Scan
if: ${{ env.CHECK_SCA == 1 }}
env:
COVERITY_SCAN_TOKEN: ${{secrets.COVERITY_SCAN_TOKEN}}
run: |
source $SMING_HOME/../Tools/export.sh
export MAKE_PARALLEL="make -j$(nproc)"
export COVERITY_SCAN_BUILD_COMMAND_PREPEND="cd $SMING_HOME"
cat > /tmp/secrets.sh
$SMING_HOME/Arch/Host/Tools/ci/coverity-scan.sh
- name: Archive scan log
if: ${{ env.CHECK_SCA == 1 }}
uses: actions/upload-artifact@v3
with:
name: coverity-scan-report
path: Sming/cov-int/scm_log.txt
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Release

on:
workflow_dispatch:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'

# TODO: check if the tag is pointing to the tip of the master branch

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: trstringer/manual-approval@v1
if: ${{ github.ref_type == 'tag' }}
with:
secret: ${{ github.TOKEN }}
approvers: slaff
- name: Install xmlstarlet
if: ${{ github.ref_type == 'tag' }}
run: sudo apt-get install -y xmlstarlet
- name: Build docs
if: ${{ github.ref_type == 'tag' }}
run: |
Tools/install.sh doc
make -C docs html
zip -r sming-docs.zip docs/build/html
- name: Release New Version
if: ${{ github.ref_type == 'tag' }}
env:
SMING_ARCH: Host
RELEASE_TOKEN: ${{secrets.RELEASE_TOKEN}}
CI_REPO_NAME: ${{github.repository}}
CHOCO_TOKEN: ${{secrets.CHOKO_TOKEN}}
run: |
export CI_BUILD_DIR="$GITHUB_WORKSPACE"
export SMING_HOME="$GITHUB_WORKSPACE/Sming"
make -C $SMING_HOME submodules
cat > /tmp/secrets.sh
Tools/ci/deploy.sh ${{github.ref_name}}
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# Run whenever a PR is generated or updated.

name: Pull Request Checks
name: Spelling Check

on:
pull_request:

branches: [ develop ]

jobs:

code-spell:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Sming is [open source](LICENSE), modular and supports [multiple architectures](h
[![Backers](https://opencollective.com/Sming/backers/badge.svg)](#financial-contributions)
[![Sponsors](https://opencollective.com/Sming/sponsors/badge.svg)](#financial-contributions)
[![Download](https://img.shields.io/badge/download-~1.7M-orange.svg)](https://github.com/SmingHub/Sming/releases/latest)
[![Build](https://travis-ci.org/SmingHub/Sming.svg?branch=develop)](https://travis-ci.org/SmingHub/Sming)
[![Build](https://github.com/SmingHub/Sming/actions/workflows/ci.yml/badge.svg)](https://github.com/SmingHub/Sming/actions/workflows/ci.yml)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/23ff16f8d550440787125b0d25ba7ada)](https://www.codacy.com/gh/SmingHub/Sming/dashboard?utm_source=github.com&utm_medium=referral&utm_content=SmingHub/Sming&utm_campaign=Badge_Grade)
[![Coverity Badge](https://img.shields.io/coverity/scan/12007.svg)](https://scan.coverity.com/projects/sminghub-sming)

Expand Down
2 changes: 1 addition & 1 deletion Sming/Components/crypto/include/Crypto/HashContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ template <class Engine_> class HashContext
*/
Hash getHash()
{
Hash hash;
Hash hash{};
engine.final(hash.data());
return hash;
}
Expand Down
3 changes: 0 additions & 3 deletions Tools/ci/build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ if "%BUILD_DOCS%"=="true" (
goto :EOF
)

subst z: %CI_BUILD_DIR%
set SMING_HOME=z:\Sming

cd /d %SMING_HOME%
call Arch\%SMING_ARCH%\Tools\ci\build.setup.cmd || goto :error

Expand Down
8 changes: 5 additions & 3 deletions Tools/ci/setenv.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ if (Test-Path "$env:PICO_TOOLCHAIN_PATH" ) {
if ($IsWindows) {
$env:PATH = "C:\MinGW\msys\1.0\bin;C:\MinGW\bin;$env:PATH"

$env:PYTHON_PATH = "C:\Python39-x64"
if ( -not (Test-Path "$env:PYTHON_PATH") ) {
$env:PYTHON_PATH = "C:\Python39"
if ($null -eq $env:PYTHON_PATH) {
$env:PYTHON_PATH = "C:\Python39-x64"
if ( -not (Test-Path "$env:PYTHON_PATH") ) {
$env:PYTHON_PATH = "C:\Python39"
}
}

$env:PATH = "$env:PYTHON_PATH;$env:PYTHON_PATH\Scripts;$env:PATH"
Expand Down
16 changes: 0 additions & 16 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
image:
- Ubuntu2004
- Visual Studio 2019

environment:
Expand All @@ -9,21 +8,6 @@ environment:
matrix:
- SMING_ARCH: Host

- SMING_ARCH: Esp8266

- SMING_ARCH: Esp32
SMING_SOC: esp32

- SMING_ARCH: Esp32
SMING_SOC: esp32s2

- SMING_ARCH: Esp32
SMING_SOC: esp32c3

- SMING_ARCH: Rp2040

- BUILD_DOCS: true

install:
- ps: |
# Set up environment variables for all environments and build types
Expand Down

0 comments on commit da1ff08

Please sign in to comment.