Skip to content

Commit

Permalink
Add nightly build
Browse files Browse the repository at this point in the history
  • Loading branch information
prateekma committed Aug 30, 2021
1 parent 3788d2e commit 48980b1
Show file tree
Hide file tree
Showing 2 changed files with 132 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -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/
77 changes: 77 additions & 0 deletions automation/nightly_setup.sh
Original file line number Diff line number Diff line change
@@ -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="build/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="build/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="build/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

0 comments on commit 48980b1

Please sign in to comment.