mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-24 01:31:44 +00:00
[CI] Setup CI with GitHub Actions (#5)
* Setup CI with GitHub Actions * Add check-lint job * Remove actions-ci branch trigger
This commit is contained in:
committed by
GitHub
parent
c3987fbd31
commit
b92ad59468
38
.github/workflows/client.yml
vendored
38
.github/workflows/client.yml
vendored
@@ -1,38 +0,0 @@
|
||||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
||||
|
||||
name: Node.js CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
paths:
|
||||
- photon-client/**
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
paths:
|
||||
- photon-client/**
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: docker://node:10
|
||||
volumes:
|
||||
- /workspace:/github/workspace
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: mkdir built-client
|
||||
- run: cd built-client
|
||||
- name: Use Node.js 10
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 10
|
||||
- run: npm ci
|
||||
- run: npm run build --if-present
|
||||
- uses: actions/upload-artifact@master
|
||||
with:
|
||||
name: built-client
|
||||
path: built-client
|
||||
#- run: npm test
|
||||
141
.github/workflows/main.yml
vendored
Normal file
141
.github/workflows/main.yml
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
# 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 ]
|
||||
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@v2
|
||||
|
||||
# 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.
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
# Install Java 11.
|
||||
- uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 11
|
||||
|
||||
# Run Gradle tests.
|
||||
- run: |
|
||||
chmod +x gradlew
|
||||
./gradlew test
|
||||
|
||||
build-package:
|
||||
needs: [build-client, 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.
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
# 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/
|
||||
|
||||
# Download client artifact to resources folder.
|
||||
- uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: built-client
|
||||
path: photon-server/src/main/resources/web/
|
||||
|
||||
# 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
|
||||
|
||||
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@v2
|
||||
|
||||
# Install Java 11.
|
||||
- uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 11
|
||||
|
||||
# Check server code with Spotless.
|
||||
- run: |
|
||||
chmod +x gradlew
|
||||
./gradlew spotlessCheck
|
||||
Reference in New Issue
Block a user