From 71c80cc301e5e68dbc75d369738e247716a66c8c Mon Sep 17 00:00:00 2001 From: Prateek Machiraju Date: Mon, 30 Aug 2021 15:25:29 -0400 Subject: [PATCH] Add nightly build --- .github/workflows/nightly.yml | 55 +++++++++++++++++++++++++ automation/nightly_setup.sh | 77 +++++++++++++++++++++++++++++++++++ 2 files changed, 132 insertions(+) create mode 100644 .github/workflows/nightly.yml create mode 100755 automation/nightly_setup.sh diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 00000000..b50b2267 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,55 @@ +name: Nightly + +on: + workflow_dispatch: + schedule: + - cron: '13 12 * * *' + +jobs: + nightly: + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + artifact-name: Linux + build-options: "-PlinuxBuild" + - os: macos-latest + artifact-name: macOS + build-options: "-PmacBuild" + - os: windows-latest + artifact-name: Win64 + build-options: "" + + name: "Build - ${{ matrix.artifact-name }}" + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - uses: actions/setup-java@v1 + with: + java-version: 11 + + - uses: actions/setup-dotnet@v1 + with: + dotnet-version: 5.0.100 + + - uses: actions/setup-node@v1 + with: + node-version: '10.x' + + - name: Setup Development Artifacts + shell: bash + run: ./automation/nightly_setup.sh + + - name: Build Installer + shell: bash + run: ./gradlew generateInstallers -PjenkinsBuild ${{ matrix.build-options }} + + - uses: actions/upload-artifact@v2 + with: + name: ${{ matrix.artifact-name }} + path: build/pubOutputs/ diff --git a/automation/nightly_setup.sh b/automation/nightly_setup.sh new file mode 100755 index 00000000..528a1da3 --- /dev/null +++ b/automation/nightly_setup.sh @@ -0,0 +1,77 @@ +#!/bin/bash + +# This script sets up the nightly build, including building development +# artifacts for GradleRIO and VS Code Extension from their respective main +# branches. + +set -e + +# Detect the operating system and store OS-specific commands in variables +# to be evaluated later. +NPM_PACKAGE_CMD="" +NPM_PACKAGE_LOC="" +SED_CMD="sed -i" +if [[ "$OSTYPE" == "linux-gnu"* ]]; then + NPM_PACKAGE_CMD="npm run packageLinux && tar -C build/wpilibutility-linux-x64 -pcvzf wpilibutility-linux.tar.gz ." + NPM_PACKAGE_LOC="wpilibutility-linux.tar.gz" +elif [[ "$OSTYPE" == "darwin"* ]]; then + NPM_PACKAGE_CMD="npm run packageMac && tar -C build/wpilibutility-darwin-x64 -pcvzf wpilibutility-mac.tar.gz ." + NPM_PACKAGE_LOC="wpilibutility-mac.tar.gz" + SED_CMD="sed -i {}" +else + NPM_PACKAGE_CMD="npm run packageWindows && powershell -Command \"Compress-Archive -Path build\wpilibutility-win32-ia32\* -DestinationPath wpilibutility-windows.zip\"" + NPM_PACKAGE_LOC="wpilibutility-windows.zip" +fi + +# First, a version number for the nightly is generated. +LATEST_TAG=$(git describe --abbrev=0) +LATEST_TAG_TRIMMED=${LATEST_TAG:1} +DATE=$(date +"%Y%m%d") +VERSION="$LATEST_TAG_TRIMMED-$DATE" + +# Next, we will clone the latest versions of GradleRIO and VS Code +# Extension repositories. +function clone() { + if [ ! -d $1 ]; then + git clone "https://github.com/wpilibsuite/$1" + else + cd $1 + git reset --hard + git pull + cd .. + fi +} +clone "GradleRIO" +clone "vscode-wpilib" + +# Publish a development version of GradleRIO. +cd GradleRIO + +# Temporarily use 2020 ni-libraries while 2022 runtime is still not available. +eval "$SED_CMD \"13s/+/2020.+/\"" versionupdates.gradle + +./gradlew updateVersions -PuseDevelopment +./gradlew publishToMavenLocal -x patchExamples -PpublishVersion=$VERSION +cd .. + +# Publish a development version of the VS Code Extension. +cd vscode-wpilib +./gradlew updateVersions updateAllDependencies -PbuildServer -PpublishVersion=$VERSION + +cd vscode-wpilib +npm install +npm run gulp +npm run webpack +npm run vscePackage + +cd ../wpilib-utility-standalone +npm install +npm run compile +eval "$NPM_PACKAGE_CMD" +cd ../.. + +# Update the version numbers in the installer and set the VS Code Extension +# and Standalone Utility location. +echo "gradleRioVersion: $VERSION" >gradle.properties +echo "vscodeLoc: vscode-wpilib/vscode-wpilib/vscode-wpilib-$VERSION.vsix" >>gradle.properties +echo "standaloneLoc: vscode-wpilib/wpilib-utility-standalone/$NPM_PACKAGE_LOC" >> gradle.properties