Skip to content

Merge branch 'main' into prs-to-unofficial-rev-port/include-static-ar… #91

Merge branch 'main' into prs-to-unofficial-rev-port/include-static-ar…

Merge branch 'main' into prs-to-unofficial-rev-port/include-static-ar… #91

Workflow file for this run

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)
sharedHalPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/hal/hal-cpp/"$halVersion"/hal-cpp-"$halVersion"-${{ matrix.platform-type }}.zip
sharedUtilPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/wpiutil/wpiutil-cpp/"$halVersion"/wpiutil-cpp-"$halVersion"-${{ matrix.platform-type }}.zip
curl -L -o sharedHalPlatform.zip "$sharedHalPlatformUrl"
curl -L -o sharedUtilPlatform.zip "$sharedHtilPlatformUrl"
staticHalPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/hal/hal-cpp/"$halVersion"/hal-cpp-"$halVersion"-${{ matrix.platform-type }}static.zip
staticUtilPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/wpiutil/wpiutil-cpp/"$halVersion"/wpiutil-cpp-"$halVersion"-${{ matrix.platform-type }}static.zip
curl -L -o staticHalPlatform.zip "$staticHalPlatformUrl"
curl -L -o staticUtilPlatform.zip "$staticHtilPlatformUrl"
- name: Unzip WPILib HAL artifacts and headers
run: |
unzip sharedHalPlatform.zip -d sharedHalPlatform
unzip sharedUtilPlatform.zip -d sharedUtilPlatform
unzip staticHalPlatform.zip -d staticHalPlatform
unzip staticUtilPlatform.zip -d staticUtilPlatform
mkdir -p CANBridge-artifacts/static
mkdir -p CANBridge-artifacts/shared
# Put Linux ARM release files together in one directory
- name: Create Artifact
run: |
cp build/libs/cANBridge/shared/release/libCANBridge.so CANBridge-artifacts/shared/libCANBridge.so
cp sharedHalPlatform/linux/${{ matrix.arch }}/shared/libwpiHal.so CANBridge-artifacts/shared/libwpiHal.so
cp sharedUtilPlatform/linux/${{ matrix.arch }}/shared/libwpiutil.so CANBridge-artifacts/shared/libwpiutil.so
cp build/libs/cANBridge/static/release/libCANBridge.a CANBridge-artifacts/static/libCANBridge.a
cp staticHalPlatform/linux/${{ matrix.arch }}/static/libwpiHal.a CANBridge-artifacts/static/libwpiHal.a
cp staticUtilPlatform/linux/${{ matrix.arch }}/static/libwpiutil.a CANBridge-artifacts/static/libwpiutil.a
# 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)
sharedHalPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/hal/hal-cpp/"$halVersion"/hal-cpp-"$halVersion"-${{ matrix.platform-type }}.zip
sharedUtilPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/wpiutil/wpiutil-cpp/"$halVersion"/wpiutil-cpp-"$halVersion"-${{ matrix.platform-type }}.zip
curl -L -o sharedHalPlatform.zip "$sharedHalPlatformUrl"
curl -L -o sharedUtilPlatform.zip "$sharedHtilPlatformUrl"
staticHalPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/hal/hal-cpp/"$halVersion"/hal-cpp-"$halVersion"-${{ matrix.platform-type }}static.zip
staticUtilPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/wpiutil/wpiutil-cpp/"$halVersion"/wpiutil-cpp-"$halVersion"-${{ matrix.platform-type }}static.zip
curl -L -o staticHalPlatform.zip "$staticHalPlatformUrl"
curl -L -o staticUtilPlatform.zip "$staticHtilPlatformUrl"
- name: Unzip WPILib HAL artifacts and headers
run: |
unzip sharedHalPlatform.zip -d sharedHalPlatform
unzip sharedUtilPlatform.zip -d sharedUtilPlatform
unzip staticHalPlatform.zip -d staticHalPlatform
unzip staticUtilPlatform.zip -d staticUtilPlatform
mkdir -p CANBridge-artifacts/static
mkdir -p CANBridge-artifacts/shared
# 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/shared/windowsx86-64/release/CANBridge.dll CANBridge-artifacts/shared/
cp build/libs/cANBridge/shared/windowsx86-64/release/CANBridge.lib CANBridge-artifacts/shared/
cp sharedHalPlatform/windows/x86-64/shared/wpiHal.dll CANBridge-artifacts/shared/
cp sharedHalPlatform/windows/x86-64/shared/wpiHal.lib CANBridge-artifacts/shared/
cp sharedUtilPlatform/windows/x86-64/shared/wpiutil.dll CANBridge-artifacts/shared/
cp sharedUtilPlatform/windows/x86-64/shared/wpiutil.lib CANBridge-artifacts/shared/
cp build/libs/cANBridge/static/windowsx86-64/release/CANBridge.lib CANBridge-artifacts/static/
cp staticHalPlatform/windows/x86-64/static/wpiHal.lib CANBridge-artifacts/static/
cp staticUtilPlatform/windows/x86-64/static/wpiutil.lib CANBridge-artifacts/static/
elif [[ "${{ matrix.platform-type }}" == "linuxx86-64" ]]; then
cp build/libs/cANBridge/shared/linuxx86-64/release/libCANBridge.so CANBridge-artifacts/shared/
cp sharedHalPlatform/linux/x86-64/shared/libwpiHal.so CANBridge-artifacts/shared/
cp sharedUtilPlatform/linux/x86-64/shared/libwpiutil.so CANBridge-artifacts/shared/
cp build/libs/cANBridge/static/linuxx86-64/release/libCANBridge.a CANBridge-artifacts/static/
cp staticHalPlatform/linux/x86-64/static/libwpiHal.a CANBridge-artifacts/static/
cp staticUtilPlatform/linux/x86-64/static/libwpiutil.a CANBridge-artifacts/static/
elif [[ "${{ matrix.platform-type }}" == "osxuniversal" ]]; then
cp build/libs/cANBridge/shared/osxuniversal/release/libCANBridge.dylib CANBridge-artifacts/shared/
cp sharedHalPlatform/osx/universal/shared/libwpiHal.dylib CANBridge-artifacts/shared/
cp sharedUtilPlatform/osx/universal/shared/libwpiutil.dylib CANBridge-artifacts/shared
cp build/libs/cANBridge/static/osxuniversal/release/libCANBridge.a CANBridge-artifacts/static/
cp staticHalPlatform/osx/universal/static/libwpiHal.a CANBridge-artifacts/static/
cp staticUtilPlatform/osx/universal/static/libwpiutil.a CANBridge-artifacts/static/
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 -L -o halHeaders.zip "$halHeadersUrl"
curl -L -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