Create Dependabot update task #54
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
[push, pull_request] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: false | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
# Use WPI provided Docker images to build for Linux ARM32 and ARM64 platforms | |
build-docker: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- container: wpilib/aarch64-cross-ubuntu:bullseye-22.04 | |
name: LinuxARM64 | |
build-options: "-Ponlylinuxarm64" | |
platform-type: linuxarm64 | |
arch: arm64 | |
- container: wpilib/raspbian-cross-ubuntu:bullseye-22.04 | |
name: LinuxARM32 | |
build-options: "-Ponlylinuxarm32" | |
platform-type: linuxarm32 | |
arch: arm32 | |
runs-on: ubuntu-latest | |
name: "Build - ${{ matrix.name }}" | |
container: ${{ matrix.container }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.sha }} | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Build | |
run: | | |
./gradlew outputVersions publish ${{ matrix.build-options }} -PreleaseMode | |
- name: Download WPILib HAL artifacts and headers for ${{ matrix.platform-type }} | |
run : | | |
halVersion=$(cat wpiHalVersion.txt) | |
halPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/hal/hal-cpp/"$halVersion"/hal-cpp-"$halVersion"-${{ matrix.platform-type }}.zip | |
utilPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/wpiutil/wpiutil-cpp/"$halVersion"/wpiutil-cpp-"$halVersion"-${{ matrix.platform-type }}.zip | |
curl -o halPlatform.zip "$halPlatformUrl" | |
curl -o utilPlatform.zip "$utilPlatformUrl" | |
- name: Unzip WPILib HAL artifacts and headers | |
run: | | |
unzip halPlatform.zip -d halPlatform | |
unzip utilPlatform.zip -d utilPlatform | |
mkdir -p CANBridge-artifacts | |
# Put Linux ARM release files together in one directory | |
- name: Create Artifact | |
run: | | |
cp build/libs/cANBridge/static/release/libCANBridge.a CANBridge-artifacts/libCANBridge.a | |
cp build/libs/cANBridge/shared/release/libCANBridge.so CANBridge-artifacts/libCANBridge.so | |
cp halPlatform/linux/${{ matrix.arch }}/shared/libwpiHal.so CANBridge-artifacts/libwpiHal.so | |
cp utilPlatform/linux/${{ matrix.arch }}/shared/libwpiutil.so CANBridge-artifacts/libwpiutil.so | |
# Upload build artifact | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: CANBridge-${{ matrix.platform-type }}-${{ github.sha}} | |
path: CANBridge-artifacts/ | |
# Use native runners to build for Windows, Linux, and macOS | |
build-native: | |
timeout-minutes: 15 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: windows-latest | |
name: Win64 | |
build-options: "" | |
platform-type: windowsx86-64 | |
- os: ubuntu-latest | |
name: Linux64 | |
platform-type: linuxx86-64 | |
build-options: "" | |
- os: macos-latest | |
name: macOS | |
platform-type: osxuniversal | |
build-options: "" | |
name: "Build - ${{ matrix.name }}" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.sha }} | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Build | |
run: | | |
./gradlew outputVersions publish ${{ matrix.build-options }} -PreleaseMode | |
- name: Download WPILib HAL artifacts and headers for ${{ matrix.platform-type }} | |
run : | | |
halVersion=$(cat wpiHalVersion.txt) | |
halPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/hal/hal-cpp/"$halVersion"/hal-cpp-"$halVersion"-${{ matrix.platform-type }}.zip | |
utilPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/wpiutil/wpiutil-cpp/"$halVersion"/wpiutil-cpp-"$halVersion"-${{ matrix.platform-type }}.zip | |
curl -o halPlatform.zip "$halPlatformUrl" | |
curl -o utilPlatform.zip "$utilPlatformUrl" | |
- name: Unzip WPILib HAL artifacts and headers | |
run: | | |
unzip halPlatform.zip -d halPlatform | |
unzip utilPlatform.zip -d utilPlatform | |
mkdir -p CANBridge-artifacts | |
# Put release files together in one directory based on platform | |
- name: Create Artifact | |
run: | | |
mkdir -p CANBridge-artifacts | |
if [[ "${{ matrix.platform-type }}" == "windowsx86-64" ]]; then | |
cp build/libs/cANBridge/static/windowsx86-64/release/CANBridge.lib CANBridge-artifacts/CANBridge-static.lib | |
cp build/libs/cANBridge/shared/windowsx86-64/release/CANBridge.dll CANBridge-artifacts/CANBridge.dll | |
cp build/libs/cANBridge/shared/windowsx86-64/release/CANBridge.lib CANBridge-artifacts/CANBridge.lib | |
cp halPlatform/windows/x86-64/shared/wpiHal.dll CANBridge-artifacts/wpiHal.dll | |
cp halPlatform/windows/x86-64/shared/wpiHal.lib CANBridge-artifacts/wpiHal.lib | |
cp utilPlatform/windows/x86-64/shared/wpiutil.dll CANBridge-artifacts/wpiutil.dll | |
cp utilPlatform/windows/x86-64/shared/wpiutil.lib CANBridge-artifacts/wpiutil.lib | |
elif [[ "${{ matrix.platform-type }}" == "linuxx86-64" ]]; then | |
cp build/libs/cANBridge/static/linuxx86-64/release/libCANBridge.a CANBridge-artifacts/libCANBridge.a | |
cp build/libs/cANBridge/shared/linuxx86-64/release/libCANBridge.so CANBridge-artifacts/libCANBridge.so | |
cp halPlatform/linux/x86-64/shared/libwpiHal.so CANBridge-artifacts/libwpiHal.so | |
cp utilPlatform/linux/x86-64/shared/libwpiutil.so CANBridge-artifacts/libwpiutil.so | |
elif [[ "${{ matrix.platform-type }}" == "osxuniversal" ]]; then | |
cp build/libs/cANBridge/static/osxuniversal/release/libCANBridge.a CANBridge-artifacts/libCANBridge.a | |
cp build/libs/cANBridge/shared/osxuniversal/release/libCANBridge.dylib CANBridge-artifacts/libCANBridge.dylib | |
cp halPlatform/osx/universal/shared/libwpiHal.dylib CANBridge-artifacts/libwpiHal.dylib | |
cp utilPlatform/osx/universal/shared/libwpiutil.dylib CANBridge-artifacts/libwpiutil.dylib | |
fi | |
# Upload build artifact | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: CANBridge-${{ matrix.platform-type }}-${{ github.sha}} | |
path: CANBridge-artifacts/ | |
# Upload combined headers for WPILib from HAL and WPIUtil | |
wpi-headers: | |
runs-on: ubuntu-latest | |
name: "WPILib Headers" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.sha }} | |
- name: Download WPILib HAL artifacts and headers | |
run : | | |
halVersion=$(cat wpiHalVersion.txt) | |
halHeadersUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/hal/hal-cpp/"$halVersion"/hal-cpp-"$halVersion"-headers.zip | |
utilHeadersUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/wpiutil/wpiutil-cpp/"$halVersion"/wpiutil-cpp-"$halVersion"-headers.zip | |
curl -o halHeaders.zip "$halHeadersUrl" | |
curl -o utilHeaders.zip "$utilHeadersUrl" | |
- name: Unzip WPILib HAL artifacts and headers | |
run: | | |
unzip halHeaders.zip -d halHeaders | |
unzip utilHeaders.zip -d utilHeaders | |
- name: Gather all needed headers | |
run: | | |
mkdir headers-for-artifact | |
cp -r halHeaders/hal headers-for-artifact | |
cp -r utilHeaders/wpi headers-for-artifact | |
cp -r src/main/native/include/* headers-for-artifact | |
# Upload build artifact | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
path: headers-for-artifact | |
name: headers | |
# Upload version file, used for versioning | |
version: | |
runs-on: ubuntu-latest | |
name: "Version" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.sha }} | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: 11 | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Build | |
run: | | |
./gradlew outputVersions -PreleaseMode | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: version | |
path: build/allOutputs/version.txt |