mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
227 lines
5.3 KiB
YAML
227 lines
5.3 KiB
YAML
# 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).
|
|
build-client:
|
|
|
|
# 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/
|
|
|
|
build-server:
|
|
# Let all steps run within the photon-server dir.
|
|
defaults:
|
|
run:
|
|
working-directory: photon-server
|
|
|
|
# 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
|
|
|
|
# Run Tests Generate Coverage Report.
|
|
- name: Gradle Test and Coverage
|
|
run: ./gradlew jacocoTestReport
|
|
|
|
# Publish Coverage Report.
|
|
- name: Publish Coverage Report
|
|
uses: codecov/codecov-action@v1
|
|
with:
|
|
file: ./photon-server/build/reports/jacoco/test/jacocoTestReport.xml
|
|
|
|
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
|
|
|
|
build-package:
|
|
needs: [build-client, build-server, build-offline-docs]
|
|
|
|
# Let all steps run within the photon-server dir.
|
|
defaults:
|
|
run:
|
|
working-directory: photon-server
|
|
|
|
# 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 src/main/resources/web/*
|
|
mkdir -p 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
|
|
|
|
|
|
# Print folder contents.
|
|
- run: ls
|
|
working-directory: photon-server/src/main/resources/web/
|
|
|
|
# Build fat jar.
|
|
- run: |
|
|
chmod +x gradlew
|
|
./gradlew shadowJar
|
|
working-directory: photon-server
|
|
|
|
# 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'
|
|
|
|
check-lint:
|
|
# Let all steps run within the photon-server dir.
|
|
defaults:
|
|
run:
|
|
working-directory: photon-server
|
|
|
|
# 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
|
|
|
|
release:
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
needs: [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 }}
|