mirror of
https://github.com/flarum/core.git
synced 2025-08-08 01:16:52 +02:00
Remove format hook on commit; update CI to only build with valid formatting (#3032)
* Remove format hook on commit We all hate it. Let's remove it.
This commit is contained in:
33
.github/workflows/build.yml
vendored
33
.github/workflows/build.yml
vendored
@@ -1,33 +0,0 @@
|
||||
name: JavaScript
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: JS / Build
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Restore npm cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('js/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-
|
||||
|
||||
# Our action will install npm, cd into `./js`, run `npm run build` and
|
||||
# `npm run build-typings`, then commit and upload any changes
|
||||
- name: Build production JS
|
||||
uses: flarum/action-build@2
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
build_script: build
|
||||
package_manager: npm
|
||||
typings_script: build-typings
|
91
.github/workflows/js.yml
vendored
Normal file
91
.github/workflows/js.yml
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
name: JS
|
||||
|
||||
on: [workflow_dispatch, push, pull_request]
|
||||
|
||||
env:
|
||||
NODE_VERSION: 16
|
||||
|
||||
jobs:
|
||||
prettier:
|
||||
name: Prettier
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: "npm"
|
||||
cache-dependency-path: js/package-lock.json
|
||||
|
||||
- name: Install JS dependencies
|
||||
run: npm ci
|
||||
working-directory: ./js
|
||||
|
||||
- name: Check JS formatting
|
||||
run: npm run format-check
|
||||
working-directory: ./js
|
||||
|
||||
build-prod:
|
||||
name: Build and commit
|
||||
runs-on: ubuntu-latest
|
||||
needs: [prettier]
|
||||
|
||||
# Only commit JS on push to master branch
|
||||
# Remember to change in `build-test` job too
|
||||
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: "npm"
|
||||
cache-dependency-path: js/package-lock.json
|
||||
|
||||
# Our action will install npm, cd into `./js`, run `npm run build` and
|
||||
# `npm run build-typings`, then commit and upload any changes
|
||||
- name: Build production JS
|
||||
uses: flarum/action-build@2
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
build_script: build
|
||||
package_manager: npm
|
||||
typings_script: build-typings
|
||||
|
||||
build-test:
|
||||
name: Test build
|
||||
runs-on: ubuntu-latest
|
||||
needs: [prettier]
|
||||
|
||||
# Inverse check of `build-prod`
|
||||
# Remember to change in `build-prod` job too
|
||||
if: github.ref != 'refs/heads/master' || github.event_name != 'push'
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
cache: "npm"
|
||||
cache-dependency-path: js/package-lock.json
|
||||
|
||||
# Our action will install npm, cd into `./js`, run `npm run build` and
|
||||
# `npm run build-typings`, then commit and upload any changes
|
||||
- name: Build production JS
|
||||
uses: flarum/action-build@2
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
build_script: build
|
||||
package_manager: npm
|
||||
typings_script: build-typings
|
||||
do_not_commit: true
|
32
.github/workflows/lint.yml
vendored
32
.github/workflows/lint.yml
vendored
@@ -1,32 +0,0 @@
|
||||
name: Lint
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- 'js/src/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'js/src/**'
|
||||
|
||||
jobs:
|
||||
prettier:
|
||||
name: JS / Prettier
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: "14"
|
||||
|
||||
- name: Install JS dependencies
|
||||
run: npm ci
|
||||
working-directory: ./js
|
||||
|
||||
- name: Check JS formatting
|
||||
run: npm run format-check
|
||||
working-directory: ./js
|
Reference in New Issue
Block a user