CI #3143
Workflow file for this run
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 workflow builds the client (UI), the server, builds the JAR. | |
name: CI | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the master branch | |
on: | |
push: | |
branches: [ master ] | |
tags: | |
- 'v*' | |
pull_request: | |
branches: [ master ] | |
jobs: | |
# This job builds the client (web view). | |
photonclient-build: | |
# Let all steps run within the photon-client dir. | |
defaults: | |
run: | |
working-directory: photon-client | |
# The type of runner that the job will run on. | |
runs-on: ubuntu-latest | |
# Grab the docker container. | |
container: | |
image: docker://node:10 | |
steps: | |
# Checkout code. | |
- uses: actions/checkout@v1 | |
# Setup Node.js | |
- name: Setup Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 10 | |
# Run npm | |
- run: | | |
npm ci | |
npm run build --if-present | |
# Upload client artifact. | |
- uses: actions/upload-artifact@master | |
with: | |
name: built-client | |
path: photon-client/dist/ | |
photon-build-all: | |
# The type of runner that the job will run on. | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout code. | |
- name: Checkout code | |
uses: actions/checkout@v1 | |
# Fetch tags. | |
- name: Fetch tags | |
run: git fetch --tags --force | |
# Install Java 11. | |
- name: Install Java 11 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
# Run Gradle build. | |
- name: Gradle Build | |
run: | | |
chmod +x gradlew | |
./gradlew build -x check --max-workers 1 | |
# Run Gradle Tests. | |
- name: Gradle Tests | |
run: ./gradlew testHeadless -i --max-workers 1 | |
# Generate Coverage Report. | |
- name: Gradle Coverage | |
run: ./gradlew jacocoTestReport --max-workers 1 | |
# Publish Coverage Report. | |
- name: Publish Server Coverage Report | |
uses: codecov/codecov-action@v1 | |
with: | |
file: ./photon-server/build/reports/jacoco/test/jacocoTestReport.xml | |
- name: Publish Core Coverage Report | |
uses: codecov/codecov-action@v1 | |
with: | |
file: ./photon-core/build/reports/jacoco/test/jacocoTestReport.xml | |
photonserver-build-offline-docs: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout docs. | |
- uses: actions/checkout@v2 | |
with: | |
repository: 'PhotonVision/photonvision-docs.git' | |
ref: master | |
# Install Python. | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: '3.6' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install sphinx sphinx_rtd_theme sphinx-tabs sphinxext-opengraph doc8 | |
pip install -r requirements.txt | |
- name: Check the docs | |
run: | | |
make linkcheck | |
make lint | |
- name: Build the docs | |
run: | | |
make html | |
# Upload docs artifact. | |
- uses: actions/upload-artifact@master | |
with: | |
name: built-docs | |
path: build/html | |
photonserver-check-lint: | |
# The type of runner that the job will run on. | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout code. | |
- uses: actions/checkout@v1 | |
# Install Java 11. | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
# Check server code with Spotless. | |
- run: | | |
chmod +x gradlew | |
./gradlew spotlessCheck | |
photon-release: | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: [photon-build-package] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v2 | |
with: | |
name: jar | |
- uses: softprops/action-gh-release@v1 | |
with: | |
files: '**/*' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Building photonlib | |
photonlib-build-host: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: windows-latest | |
artifact-name: Win64 | |
- os: macos-latest | |
artifact-name: macOS | |
- os: ubuntu-latest | |
artifact-name: Linux | |
runs-on: ${{ matrix.os }} | |
name: "Photonlib - Build - ${{ matrix.artifact-name }}" | |
steps: | |
- uses: actions/[email protected] | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- run: git fetch --tags --force | |
- run: | | |
chmod +x gradlew | |
./gradlew photon-lib:build --max-workers 1 | |
- run: ./gradlew photon-lib:publish | |
name: Publish | |
env: | |
ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }} | |
if: github.event_name == 'push' | |
photonlib-build-docker: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- container: wpilib/roborio-cross-ubuntu:2021-18.04 | |
artifact-name: Athena | |
- container: wpilib/raspbian-cross-ubuntu:10-18.04 | |
artifact-name: Raspbian | |
- container: wpilib/aarch64-cross-ubuntu:bionic-18.04 | |
artifact-name: Aarch64 | |
runs-on: ubuntu-latest | |
container: ${{ matrix.container }} | |
name: "Photonlib - Build - ${{ matrix.artifact-name }}" | |
steps: | |
- uses: actions/[email protected] | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- run: | | |
git describe --tags --exclude="dev" --exclude="[dD]ev*" | |
- run: | | |
chmod +x gradlew | |
./gradlew photon-lib:build --max-workers 1 | |
- run: | | |
chmod +x gradlew | |
./gradlew photon-lib:publish | |
env: | |
ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }} | |
if: github.event_name == 'push' | |
photonlib-wpiformat: | |
name: "wpiformat" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Fetch all history and metadata | |
run: | | |
git fetch --prune --unshallow | |
git checkout -b pr | |
git branch -f master origin/master | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Install clang-format | |
run: sudo apt-get update -q && sudo apt-get install clang-format-10 | |
- name: Install wpiformat | |
run: pip3 install wpiformat | |
- name: Run | |
run: wpiformat -clang 10 -f photon-lib | |
- name: Check Output | |
run: git --no-pager diff --exit-code HEAD | |
- name: Generate diff | |
run: git diff HEAD > wpiformat-fixes.patch | |
if: ${{ failure() }} | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: wpiformat fixes | |
path: wpiformat-fixes.patch | |
if: ${{ failure() }} | |
photon-build-package: | |
needs: [photonclient-build, photon-build-all, photonserver-build-offline-docs, photonlib-build-host, photonlib-build-docker] | |
# The type of runner that the job will run on. | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout code. | |
- uses: actions/checkout@v1 | |
# Install Java 11. | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
# Clear any existing web resources. | |
- run: | | |
rm -rf photon-server/src/main/resources/web/* | |
mkdir -p photon-server/src/main/resources/web/docs | |
# Download client artifact to resources folder. | |
- uses: actions/download-artifact@v2 | |
with: | |
name: built-client | |
path: photon-server/src/main/resources/web/ | |
# Download docs artifact to resources folder. | |
- uses: actions/download-artifact@v2 | |
with: | |
name: built-docs | |
path: photon-server/src/main/resources/web/docs | |
# Build fat jar. | |
- run: | | |
chmod +x gradlew | |
./gradlew photon-server:shadowJar --max-workers 1 | |
# Upload final fat jar as artifact. | |
- uses: actions/upload-artifact@master | |
with: | |
name: jar | |
path: photon-server/build/libs | |
- uses: eine/tip@master | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
tag: 'Dev' | |
rm: true | |
files: | | |
photon-server/build/libs/*.jar | |
if: github.event_name == 'push' | |