Skip to content

Commit

Permalink
linting stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
srimanachanta committed Oct 15, 2023
1 parent ad4f462 commit 1b67cdb
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 77 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/lint-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Lint and Format

on:
pull_request:
push:
branches-ignore:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
wpiformat:
name: "wpiformat"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- 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@v4
with:
python-version: 3.8
- name: Install wpiformat
run: pip3 install wpiformat
- name: Run
run: wpiformat
- 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@v3
with:
name: wpiformat fixes
path: wpiformat-fixes.patch
if: ${{ failure() }}
javaformat:
name: "Java Formatting"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
- run: |
chmod +x gradlew
./gradlew spotlessCheck
clientformat:
name: "PhotonClient Lint and Formatting"
defaults:
run:
working-directory: photon-client
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 17
- name: Install Dependencies
run: npm ci
- name: Check Linting
run: npm run lint-ci
- name: Check Formatting
run: npm run format-ci
77 changes: 0 additions & 77 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,33 +45,6 @@ jobs:
with:
name: built-client
path: photon-client/dist/
photonclient-check-lint:
# 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-22.04

steps:
# Checkout code.
- uses: actions/checkout@v3

# Setup Node.js
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 17

- name: Install Dependencies
run: npm ci

- name: Check Linting
run: npm run lint-ci

- name: Check Formatting
run: npm run format-ci
photon-build-examples:
runs-on: ubuntu-22.04
name: "Build Examples"
Expand Down Expand Up @@ -196,26 +169,6 @@ jobs:
with:
name: built-docs
path: build/html
photonserver-check-lint:
# The type of runner that the job will run on.
runs-on: ubuntu-22.04

steps:
# Checkout code.
- uses: actions/checkout@v3
with:
fetch-depth: 0

# Install Java 17.
- uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin

# Check server code with Spotless.
- run: |
chmod +x gradlew
./gradlew spotlessCheck
photonlib-build-host:
env:
MACOSX_DEPLOYMENT_TARGET: 10.14
Expand Down Expand Up @@ -284,36 +237,6 @@ jobs:
env:
ARTIFACTORY_API_KEY: ${{ secrets.ARTIFACTORY_API_KEY }}
if: github.event_name == 'push'
photonlib-wpiformat:
name: "wpiformat"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- 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@v4
with:
python-version: 3.8
- name: Install wpiformat
run: pip3 install wpiformat
- name: Check index.html not changed
run: git --no-pager diff --exit-code origin/master photon-server/src/main/resources/web/index.html
- name: Run
run: wpiformat
- 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@v3
with:
name: wpiformat fixes
path: wpiformat-fixes.patch
if: ${{ failure() }}
photon-build-package:
needs: [photonclient-build, photon-build-all, photonserver-build-offline-docs]

Expand Down

0 comments on commit 1b67cdb

Please sign in to comment.