|
1 | 1 | name: Build
|
2 | 2 |
|
3 | 3 | on:
|
4 |
| - push: |
5 |
| - branches: |
6 |
| - - 'main' |
7 |
| - pull_request: |
8 |
| - branches: |
9 |
| - - '*' |
| 4 | + [push, pull_request] |
| 5 | + |
| 6 | +concurrency: |
| 7 | + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} |
| 8 | + cancel-in-progress: false |
10 | 9 |
|
11 | 10 | defaults:
|
12 | 11 | run:
|
13 | 12 | shell: bash
|
14 | 13 |
|
15 | 14 | jobs:
|
| 15 | + # Use native runners to build for Windows, Linux x86-64, and macOS; use WPI provided Docker images to build for Linux ARM32 and ARM64 platforms |
16 | 16 | build:
|
17 |
| - timeout-minutes: 15 |
18 | 17 | strategy:
|
19 | 18 | fail-fast: false
|
20 | 19 | matrix:
|
21 | 20 | include:
|
22 | 21 | - os: windows-latest
|
23 |
| - container: '' |
24 |
| - name: windows64 |
25 |
| - name: "build-${{ matrix.name }}" |
| 22 | + name: Win64 |
| 23 | + build-options: "" |
| 24 | + platform-type: windowsx86-64 |
| 25 | + - os: ubuntu-latest |
| 26 | + name: Linux64 |
| 27 | + platform-type: linuxx86-64 |
| 28 | + build-options: "" |
| 29 | + - os: macos-latest |
| 30 | + name: macOS |
| 31 | + platform-type: osxuniversal |
| 32 | + build-options: "" |
| 33 | + - container: wpilib/aarch64-cross-ubuntu:bullseye-22.04 |
| 34 | + os: ubuntu-latest |
| 35 | + name: LinuxARM64 |
| 36 | + build-options: "-Ponlylinuxarm64" |
| 37 | + platform-type: linuxarm64 |
| 38 | + arch: arm64 |
| 39 | + - container: wpilib/raspbian-cross-ubuntu:bullseye-22.04 |
| 40 | + os: ubuntu-latest |
| 41 | + name: LinuxARM32 |
| 42 | + build-options: "-Ponlylinuxarm32" |
| 43 | + platform-type: linuxarm32 |
| 44 | + arch: arm32 |
| 45 | + name: "Build - ${{ matrix.name }}" |
26 | 46 | runs-on: ${{ matrix.os }}
|
27 | 47 | container: ${{ matrix.container }}
|
28 | 48 | steps:
|
29 | 49 | - name: Checkout
|
30 |
| - uses: actions/checkout@v3 |
| 50 | + uses: actions/checkout@v4 |
31 | 51 | with:
|
32 | 52 | ref: ${{ github.sha }}
|
33 | 53 |
|
34 | 54 | - name: Setup Java
|
35 |
| - uses: actions/setup-java@v3 |
| 55 | + uses: actions/setup-java@v4 |
36 | 56 | with:
|
37 | 57 | distribution: 'zulu'
|
38 | 58 | java-version: 11
|
39 | 59 |
|
| 60 | + - name: Setup Gradle |
| 61 | + uses: gradle/actions/setup-gradle@v4 |
| 62 | + |
40 | 63 | - name: Build
|
41 | 64 | run: |
|
42 | 65 | ./gradlew outputVersions publish ${{ matrix.build-options }} -PreleaseMode
|
43 | 66 |
|
44 |
| - - name: Download WPILib HAL artifacts and headers, gather all needed headers |
| 67 | + - name: Download WPILib HAL artifacts and headers for ${{ matrix.platform-type }} |
45 | 68 | run : |
|
46 | 69 | halVersion=$(cat wpiHalVersion.txt)
|
| 70 | +
|
| 71 | + sharedHalPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/hal/hal-cpp/"$halVersion"/hal-cpp-"$halVersion"-${{ matrix.platform-type }}.zip |
| 72 | + sharedUtilPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/wpiutil/wpiutil-cpp/"$halVersion"/wpiutil-cpp-"$halVersion"-${{ matrix.platform-type }}.zip |
| 73 | + curl -L -o sharedHalPlatform.zip "$sharedHalPlatformUrl" |
| 74 | + curl -L -o sharedUtilPlatform.zip "$sharedUtilPlatformUrl" |
47 | 75 |
|
48 |
| - # Download WPILib artifacts from Artifactory |
49 |
| - halWindowsUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/hal/hal-cpp/"$halVersion"/hal-cpp-"$halVersion"-windowsx86-64.zip |
| 76 | + staticHalPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/hal/hal-cpp/"$halVersion"/hal-cpp-"$halVersion"-${{ matrix.platform-type }}static.zip |
| 77 | + staticUtilPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/wpiutil/wpiutil-cpp/"$halVersion"/wpiutil-cpp-"$halVersion"-${{ matrix.platform-type }}static.zip |
| 78 | + curl -L -o staticHalPlatform.zip "$staticHalPlatformUrl" |
| 79 | + curl -L -o staticUtilPlatform.zip "$staticUtilPlatformUrl" |
| 80 | +
|
| 81 | + - name: Unzip WPILib HAL artifacts and headers |
| 82 | + run: | |
| 83 | + unzip sharedHalPlatform.zip -d sharedHalPlatform |
| 84 | + unzip sharedUtilPlatform.zip -d sharedUtilPlatform |
| 85 | + unzip staticHalPlatform.zip -d staticHalPlatform |
| 86 | + unzip staticUtilPlatform.zip -d staticUtilPlatform |
| 87 | + mkdir -p CANBridge-artifacts/static |
| 88 | + mkdir -p CANBridge-artifacts/shared |
| 89 | +
|
| 90 | + # Put release files together in one directory based on platform |
| 91 | + - name: Create Artifact |
| 92 | + run: | |
| 93 | + mkdir -p CANBridge-artifacts |
| 94 | + if [[ "${{ matrix.platform-type }}" == "windowsx86-64" ]]; then |
| 95 | + cp build/libs/cANBridge/shared/windowsx86-64/release/CANBridge.dll CANBridge-artifacts/shared/ |
| 96 | + cp build/libs/cANBridge/shared/windowsx86-64/release/CANBridge.lib CANBridge-artifacts/shared/ |
| 97 | + cp sharedHalPlatform/windows/x86-64/shared/wpiHal.dll CANBridge-artifacts/shared/ |
| 98 | + cp sharedHalPlatform/windows/x86-64/shared/wpiHal.lib CANBridge-artifacts/shared/ |
| 99 | + cp sharedUtilPlatform/windows/x86-64/shared/wpiutil.dll CANBridge-artifacts/shared/ |
| 100 | + cp sharedUtilPlatform/windows/x86-64/shared/wpiutil.lib CANBridge-artifacts/shared/ |
| 101 | + |
| 102 | + cp build/libs/cANBridge/static/windowsx86-64/release/CANBridge.lib CANBridge-artifacts/static/ |
| 103 | + cp staticHalPlatform/windows/x86-64/static/wpiHal.lib CANBridge-artifacts/static/ |
| 104 | + cp staticUtilPlatform/windows/x86-64/static/wpiutil.lib CANBridge-artifacts/static/ |
| 105 | + elif [[ "${{ matrix.platform-type }}" == "linuxx86-64" ]]; then |
| 106 | + cp build/libs/cANBridge/shared/linuxx86-64/release/libCANBridge.so CANBridge-artifacts/shared/ |
| 107 | + cp sharedHalPlatform/linux/x86-64/shared/libwpiHal.so CANBridge-artifacts/shared/ |
| 108 | + cp sharedUtilPlatform/linux/x86-64/shared/libwpiutil.so CANBridge-artifacts/shared/ |
| 109 | + |
| 110 | + cp build/libs/cANBridge/static/linuxx86-64/release/libCANBridge.a CANBridge-artifacts/static/ |
| 111 | + cp staticHalPlatform/linux/x86-64/static/libwpiHal.a CANBridge-artifacts/static/ |
| 112 | + cp staticUtilPlatform/linux/x86-64/static/libwpiutil.a CANBridge-artifacts/static/ |
| 113 | + elif [[ "${{ matrix.platform-type }}" == "osxuniversal" ]]; then |
| 114 | + cp build/libs/cANBridge/shared/osxuniversal/release/libCANBridge.dylib CANBridge-artifacts/shared/ |
| 115 | + cp sharedHalPlatform/osx/universal/shared/libwpiHal.dylib CANBridge-artifacts/shared/ |
| 116 | + cp sharedUtilPlatform/osx/universal/shared/libwpiutil.dylib CANBridge-artifacts/shared |
| 117 | + |
| 118 | + cp build/libs/cANBridge/static/osxuniversal/release/libCANBridge.a CANBridge-artifacts/static/ |
| 119 | + cp staticHalPlatform/osx/universal/static/libwpiHal.a CANBridge-artifacts/static/ |
| 120 | + cp staticUtilPlatform/osx/universal/static/libwpiutil.a CANBridge-artifacts/static/ |
| 121 | + elif [[ "${{ matrix.platform-type }}" == "linuxarm32" || "${{ matrix.platform-type }}" == "linuxarm64" ]]; then |
| 122 | + cp build/libs/cANBridge/shared/release/libCANBridge.so CANBridge-artifacts/shared/libCANBridge.so |
| 123 | + cp sharedHalPlatform/linux/${{ matrix.arch }}/shared/libwpiHal.so CANBridge-artifacts/shared/libwpiHal.so |
| 124 | + cp sharedUtilPlatform/linux/${{ matrix.arch }}/shared/libwpiutil.so CANBridge-artifacts/shared/libwpiutil.so |
| 125 | + |
| 126 | + cp build/libs/cANBridge/static/release/libCANBridge.a CANBridge-artifacts/static/libCANBridge.a |
| 127 | + cp staticHalPlatform/linux/${{ matrix.arch }}/static/libwpiHal.a CANBridge-artifacts/static/libwpiHal.a |
| 128 | + cp staticUtilPlatform/linux/${{ matrix.arch }}/static/libwpiutil.a CANBridge-artifacts/static/libwpiutil.a |
| 129 | + fi |
| 130 | +
|
| 131 | + # Upload build artifact |
| 132 | + - name: Upload build artifact |
| 133 | + uses: actions/upload-artifact@v4 |
| 134 | + with: |
| 135 | + name: CANBridge-${{ matrix.platform-type }}-${{ github.sha}} |
| 136 | + path: CANBridge-artifacts/ |
| 137 | + |
| 138 | + # Upload combined headers for WPILib from HAL and WPIUtil |
| 139 | + wpi-headers: |
| 140 | + runs-on: ubuntu-latest |
| 141 | + name: "WPILib Headers" |
| 142 | + steps: |
| 143 | + - name: Checkout |
| 144 | + uses: actions/checkout@v4 |
| 145 | + with: |
| 146 | + ref: ${{ github.sha }} |
| 147 | + - name: Download WPILib HAL artifacts and headers |
| 148 | + run : | |
| 149 | + halVersion=$(cat wpiHalVersion.txt) |
| 150 | +
|
50 | 151 | halHeadersUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/hal/hal-cpp/"$halVersion"/hal-cpp-"$halVersion"-headers.zip
|
51 |
| - utilWindowsUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/wpiutil/wpiutil-cpp/"$halVersion"/wpiutil-cpp-"$halVersion"-windowsx86-64.zip |
52 | 152 | utilHeadersUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/wpiutil/wpiutil-cpp/"$halVersion"/wpiutil-cpp-"$halVersion"-headers.zip
|
53 |
| - curl -L -o halWindows.zip "$halWindowsUrl" |
| 153 | +
|
54 | 154 | curl -L -o halHeaders.zip "$halHeadersUrl"
|
55 |
| - curl -L -o utilWindows.zip "$utilWindowsUrl" |
56 | 155 | curl -L -o utilHeaders.zip "$utilHeadersUrl"
|
57 |
| - unzip halWindows.zip -d halWindows |
| 156 | +
|
| 157 | + - name: Unzip WPILib HAL artifacts and headers |
| 158 | + run: | |
58 | 159 | unzip halHeaders.zip -d halHeaders
|
59 |
| - unzip utilWindows.zip -d utilWindows |
60 | 160 | unzip utilHeaders.zip -d utilHeaders
|
61 | 161 |
|
62 |
| - # Gather all of the the needed headers |
| 162 | + - name: Gather all needed headers |
| 163 | + run: | |
63 | 164 | mkdir headers-for-artifact
|
64 | 165 | cp -r halHeaders/hal headers-for-artifact
|
65 | 166 | cp -r utilHeaders/wpi headers-for-artifact
|
66 | 167 | cp -r src/main/native/include/* headers-for-artifact
|
67 | 168 |
|
68 |
| - # Zip the needed headers and put them in the appropriate location for artifact upload |
69 |
| - mkdir -p CANBridge-artifacts |
70 |
| - 7z a CANBridge-artifacts/headers.zip ./headers-for-artifact/* |
71 |
| -
|
72 |
| - # Put release files together in one directory |
73 |
| - - name: Create Artifact |
74 |
| - run: | |
75 |
| - mkdir -p CANBridge-artifacts |
76 |
| - cp build/libs/cANBridge/static/windowsx86-64/release/CANBridge.lib CANBridge-artifacts/CANBridge-static.lib |
77 |
| - cp build/libs/cANBridge/shared/windowsx86-64/release/CANBridge.dll CANBridge-artifacts/CANBridge.dll |
78 |
| - cp build/libs/cANBridge/shared/windowsx86-64/release/CANBridge.lib CANBridge-artifacts/CANBridge.lib |
79 |
| - cp halWindows/windows/x86-64/shared/wpiHal.dll CANBridge-artifacts/wpiHal.dll |
80 |
| - cp halWindows/windows/x86-64/shared/wpiHal.lib CANBridge-artifacts/wpiHal.lib |
81 |
| - cp utilWindows/windows/x86-64/shared/wpiutil.dll CANBridge-artifacts/wpiutil.dll |
82 |
| - cp utilWindows/windows/x86-64/shared/wpiutil.lib CANBridge-artifacts/wpiutil.lib |
83 |
| -
|
84 | 169 | # Upload build artifact
|
85 | 170 | - name: Upload build artifact
|
86 |
| - uses: actions/upload-artifact@v3 |
| 171 | + uses: actions/upload-artifact@v4 |
87 | 172 | with:
|
88 |
| - name: CANBridge-${{ github.sha }} |
89 |
| - path: CANBridge-artifacts/ |
| 173 | + path: headers-for-artifact |
| 174 | + name: headers |
| 175 | + |
| 176 | + # Upload version file, used for versioning |
| 177 | + version: |
| 178 | + runs-on: ubuntu-latest |
| 179 | + name: "Version" |
| 180 | + steps: |
| 181 | + - name: Checkout |
| 182 | + uses: actions/checkout@v4 |
| 183 | + with: |
| 184 | + ref: ${{ github.sha }} |
| 185 | + |
| 186 | + - name: Setup Java |
| 187 | + uses: actions/setup-java@v4 |
| 188 | + with: |
| 189 | + distribution: 'zulu' |
| 190 | + java-version: 11 |
| 191 | + |
| 192 | + - name: Setup Gradle |
| 193 | + uses: gradle/actions/setup-gradle@v4 |
| 194 | + |
| 195 | + - name: Build |
| 196 | + run: | |
| 197 | + ./gradlew outputVersions -PreleaseMode |
90 | 198 |
|
91 |
| - # Upload version.txt |
92 |
| - - name: Upload version artifact |
93 |
| - uses: actions/upload-artifact@v3 |
| 199 | + - name: Upload build artifact |
| 200 | + uses: actions/upload-artifact@v4 |
94 | 201 | with:
|
95 | 202 | name: version
|
96 | 203 | path: build/allOutputs/version.txt
|
0 commit comments