forked from REVrobotics/CANBridge
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request REVrobotics#14 from REVrobotics/github-actions
Add GitHub Actions workflows for build and release
- Loading branch information
Showing
12 changed files
with
195 additions
and
107 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
pull_request: | ||
branches: | ||
- '*' | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
build: | ||
timeout-minutes: 15 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- os: windows-latest | ||
container: '' | ||
name: windows64 | ||
name: "build-${{ matrix.name }}" | ||
runs-on: ${{ matrix.os }} | ||
container: ${{ matrix.container }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.sha }} | ||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'zulu' | ||
java-version: 11 | ||
|
||
- name: Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
.gradle | ||
bin | ||
build | ||
key: ${{ matrix.name }}-build-${{ github.sha }} | ||
restore-keys: | | ||
${{ matrix.name }}-build- | ||
- name: Publish | ||
run: | | ||
./gradlew outputVersions publish ${{ matrix.build-options }} -PreleaseMode | ||
# Put release files together in one directory | ||
- name: Create Artifact | ||
run: | | ||
mkdir CANBridge-artifacts | ||
cp -r build/libs/cANBridge/static/windowsx86-64/release/CANBridge.lib CANBridge-artifacts/CANBridge-static.lib | ||
cp -r build/libs/cANBridge/shared/windowsx86-64/release/CANBridge.lib CANBridge-artifacts/CANBridge.dll | ||
cp -r build/libs/cANBridge/shared/windowsx86-64/release/CANBridge.lib CANBridge-artifacts/CANBridge.lib | ||
# Upload build artifact | ||
- name: Upload build artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: CANBridge-${{ github.sha }} | ||
path: CANBridge-artifacts/ | ||
|
||
# Upload version.txt | ||
- name: Upload version artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: version | ||
path: build/allOutputs/version.txt |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
name: Create release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
check-versions: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
TAG_NAME: ${{ env.TAG_NAME }} | ||
VERSION: ${{ steps.get_version.outputs.version }} | ||
steps: | ||
- name: Wait for build to finish | ||
uses: lewagon/[email protected] | ||
with: | ||
ref: ${{ github.ref }} | ||
check-name: 'build-windows64' | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
wait-interval: 10 | ||
- name: Get tag name | ||
run: | | ||
echo "TAG_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | ||
# Download artifacts from build workflow | ||
- name: Download workflow artifacts | ||
uses: dawidd6/action-download-artifact@v2 | ||
with: | ||
workflow: build.yml | ||
commit: ${{ github.sha }} | ||
path: '.' | ||
|
||
# Get publish.gradle version | ||
- name: Get publish.gradle version | ||
id: get_version | ||
run: | | ||
echo "version=$(cat version/version.txt)" >> $GITHUB_OUTPUT | ||
echo "expectedTagName=v$(cat version/version.txt)" >> $GITHUB_OUTPUT | ||
# Check publish.gradle version | ||
- name: publish.gradle version check FAILED | ||
if: ${{ steps.get_version.outputs.expectedTagName != env.TAG_NAME }} | ||
run: | | ||
echo Tag name: ${{ env.TAG_NAME }} | ||
echo publish.gradle version: ${{ steps.get_version.outputs.version }} | ||
exit 1 | ||
prepare-release: | ||
runs-on: ubuntu-latest | ||
needs: check-versions | ||
steps: | ||
# Download API, docs, and version.txt | ||
- name: Download workflow artifacts | ||
uses: dawidd6/action-download-artifact@v2 | ||
with: | ||
workflow: build.yml | ||
commit: ${{ github.sha }} | ||
path: './artifacts' | ||
|
||
# Create new release draft | ||
- name: Create release | ||
id: create_release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
VERSION=${{ needs.check-versions.outputs.version }} | ||
TAG=v$VERSION | ||
gh release create $TAG --draft --title "Version $VERSION" | ||
echo "Sleep after creating release to avoid race condition" | ||
sleep 5 | ||
gh release upload $TAG CANBridge-${{ github.sha }}/* |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,2 @@ | ||
dependencies { | ||
implementation 'edu.wpi.first.cscore:cscore-java:2020.+' | ||
implementation 'edu.wpi.first.cameraserver:cameraserver-java:2020.+' | ||
implementation 'edu.wpi.first.ntcore:ntcore-java:2020.+' | ||
implementation 'edu.wpi.first.wpilibj:wpilibj-java:2020.+' | ||
implementation 'edu.wpi.first.wpiutil:wpiutil-java:2020.+' | ||
implementation 'edu.wpi.first.hal:hal-java:2020.+' | ||
implementation 'edu.wpi.first.thirdparty.frc2020.opencv:opencv-java:3.4.7-2' | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -235,4 +235,4 @@ class DriverDeviceThread { | |
|
||
|
||
} // namespace usb | ||
} // namespace rev | ||
} // namespace rev |
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
Oops, something went wrong.