Skip to content

Commit

Permalink
Merge pull request #4608 from UniversityOfHelsinkiCS/gha-lint
Browse files Browse the repository at this point in the history
Create a separate workflow for linting
  • Loading branch information
rikurauhala authored Aug 20, 2024
2 parents 9c3db72 + 97b5d5f commit 92c89f4
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 30 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: 'Lint code'

on:
workflow_call:
inputs: {}

jobs:
lint_backend_and_frontend:
name: 'Lint backend and frontend'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: 'Install dependencies'
run: npm ci && cd services/frontend && npm ci && cd ../backend && npm ci
- name: 'Create symlink for shared'
run: ln -s $PWD/services/shared $PWD/services/backend/src/shared && ln -s $PWD/services/shared $PWD/services/frontend/src/shared
- name: 'Run Stylelint for CSS files'
run: npm run stylelint "services/frontend/src/**/*.css"
- name: 'Run ESLint for JS files'
run: npm run eslint -- --ext .jsx,.js services --report-unused-disable-directives
16 changes: 1 addition & 15 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,7 @@ on:

jobs:
lint_backend_and_frontend:
name: 'Lint backend and frontend'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: 'Install dependencies'
run: npm ci && cd services/frontend && npm ci && cd ../backend && npm ci
- name: 'Create symlink for shared'
run: ln -s $PWD/services/shared $PWD/services/backend/src/shared && ln -s $PWD/services/shared $PWD/services/frontend/src/shared
- name: 'Run Stylelint for CSS files'
run: npm run stylelint "services/frontend/src/**/*.css"
- name: 'Run ESLint for JS files'
run: npm run eslint -- --ext .jsx,.js services --report-unused-disable-directives
uses: ./.github/workflows/lint.yaml

test_end_to_end:
runs-on: ubuntu-latest
Expand Down
16 changes: 1 addition & 15 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,7 @@ on:
jobs:
# === Static tests / linting ===
lint_backend_and_frontend:
name: 'Lint backend and frontend'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: 'Install dependencies'
run: npm ci && cd services/frontend && npm ci && cd ../backend && npm ci
- name: 'Create symlink for shared'
run: ln -s $PWD/services/shared $PWD/services/backend/src/shared && ln -s $PWD/services/shared $PWD/services/frontend/src/shared
- name: 'Run Stylelint for CSS files'
run: npm run stylelint "services/frontend/src/**/*.css"
- name: 'Run ESLint for JS and TS files'
run: npm run eslint -- --ext .js,.jsx,.ts,.tsx services --report-unused-disable-directives
uses: ./.github/workflows/lint.yaml

# === Build database images ===
build_backend:
Expand Down

0 comments on commit 92c89f4

Please sign in to comment.