Skip to content

Update style ci

Update style ci #96

Workflow file for this run

name: CI
on: [push, pull_request]
jobs:
build-docker:
strategy:
fail-fast: false
matrix:
include:
- container: wpilib/roborio-cross-ubuntu:2024-22.04
artifact-name: Athena
build-options: "-Ponlylinuxathena"
- container: wpilib/raspbian-cross-ubuntu:bullseye-22.04
artifact-name: Arm32
build-options: "-Ponlylinuxarm32"
- container: wpilib/aarch64-cross-ubuntu:bullseye-22.04
artifact-name: Arm64
build-options: "-Ponlylinuxarm64"
- container: wpilib/ubuntu-base:22.04
artifact-name: Linux
build-options: ""
name: "Build - ${{ matrix.artifact-name }}"
runs-on: ubuntu-latest
container: ${{ matrix.container }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Set release environment variable
run: echo "EXTRA_GRADLE_ARGS=-PreleaseMode" >> $GITHUB_ENV
if: startsWith(github.ref, 'refs/tags/v')
- name: Fetch all history and metadata
run: |
git config --global --add safe.directory /__w/navx-frc/navx-frc
- name: Build with Gradle
run: ./gradlew build --max-workers 1 -PskipJavaFormat -PbuildServer ${{ matrix.build-options }} ${{ env.EXTRA_GRADLE_ARGS }}
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}
path: build/allOutputs
build-host:
env:
MACOSX_DEPLOYMENT_TARGET: 12
strategy:
fail-fast: false
matrix:
include:
- os: windows-2022
artifact-name: Win64
architecture: x64
- os: macos-12
artifact-name: macOS
architecture: x64
name: "Build - ${{ matrix.artifact-name }}"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Fetch all history and metadata
run: git fetch --prune --unshallow
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: zulu
architecture: ${{ matrix.architecture }}
- name: Set release environment variable
run: echo "EXTRA_GRADLE_ARGS=-PreleaseMode" >> $GITHUB_ENV
shell: bash
if: startsWith(github.ref, 'refs/tags/v')
- name: Build with Gradle
run: ./gradlew build -PskipJavaFormat -Pbuildalldesktop -PbuildServer ${{ env.EXTRA_GRADLE_ARGS }}
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}
path: build/allOutputs
combine:
name: Combine
needs: [build-docker, build-host]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: wpilibsuite/build-tools
- uses: actions/download-artifact@v4
with:
path: combiner/products/build/allOutputs
- name: Flatten Artifacts
run: rsync -a --delete combiner/products/build/allOutputs/*/* combiner/products/build/allOutputs/
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: zulu
- name: Combine
if: |
!startsWith(github.ref, 'refs/tags/v')
run: ./gradlew publish -Pthirdparty
working-directory: combiner
- name: Combine (Release)
if: |
github.repository_owner == 'rzblue' &&
startsWith(github.ref, 'refs/tags/v')
run: |
./gradlew publish -Pthirdparty -PreleaseRepoPublish
working-directory: combiner
- uses: actions/upload-artifact@v4
with:
name: Maven
path: ~/releases
publish-maven:
name: Publish to Maven
if: |
github.repository_owner == 'rzblue' &&
(startsWith(github.ref, 'refs/tags/v') || github.ref_name == 'main')
needs: combine
runs-on: ubuntu-latest
steps:
- name: Fetch maven repo branch
uses: actions/checkout@v4
with:
ref: maven
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: zulu
- name: Download maven artifacts
uses: actions/download-artifact@v4
with:
name: Maven
- name: Update metadata
run: |
java -jar ./maven/release/MavenMetaDataFixer.jar
java -jar ./maven/development/MavenMetaDataFixer.jar
- name: Commit and push changes
if: |
github.ref_name == 'main'
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git add .
git commit -m "Add development build for ${{ github.sha }}" -m "CI Run ID: ${{ github.run_id }}" -m "CI Run Attempt: ${{ github.run_attempt }}"
git push
- name: Commit and push changes (Release)
if: |
startsWith(github.ref, 'refs/tags/v')
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git add .
git commit -m "Add version ${{ github.ref_name }}" -m "CI Run ID: ${{ github.run_id }}" -m "CI Run Attempt: ${{ github.run_attempt }}"
git push