Skip to content

Commit

Permalink
BEEEP - organize linting in CI (bitwarden#1520)
Browse files Browse the repository at this point in the history
  • Loading branch information
mimartin12 authored Mar 7, 2022
1 parent 0e515bc commit 5cb3941
Showing 1 changed file with 36 additions and 6 deletions.
42 changes: 36 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,26 @@ jobs:
- name: Print lines of code
run: cloc --include-lang TypeScript,JavaScript,HTML,Sass,CSS --vcs git

lint:
name: Lint
runs-on: ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846

- name: Cache npm
id: npm-cache
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6
with:
path: "~/.npm"
key: ${{ runner.os }}-npm-lint-${{ hashFiles('**/package-lock.json') }}

- name: Install dependencies
run: npm ci

- name: Run linter
run: npm run lint

setup:
name: Setup
runs-on: ubuntu-20.04
Expand All @@ -46,7 +66,9 @@ jobs:
build-oss-selfhost:
name: Build OSS zip
runs-on: ubuntu-20.04
needs: setup
needs:
- setup
- lint
env:
_VERSION: ${{ needs.setup.outputs.version }}
steps:
Expand Down Expand Up @@ -93,7 +115,9 @@ jobs:
build-cloud:
name: Build Cloud zip
runs-on: ubuntu-20.04
needs: setup
needs:
- setup
- lint
env:
_VERSION: ${{ needs.setup.outputs.version }}
steps:
Expand Down Expand Up @@ -140,7 +164,9 @@ jobs:
build-commercial-selfhost:
name: Build SelfHost Docker image
runs-on: ubuntu-20.04
needs: setup
needs:
- setup
- lint
env:
_VERSION: ${{ needs.setup.outputs.version }}
steps:
Expand Down Expand Up @@ -246,6 +272,9 @@ jobs:
build-qa:
name: Build Docker images for QA environment
runs-on: ubuntu-20.04
needs:
- setup
- lint
steps:
- name: Set up Node
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea
Expand Down Expand Up @@ -377,9 +406,6 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Run linter
run: npm run lint

- name: NPM build
run: npm run build:bit:cloud

Expand Down Expand Up @@ -428,6 +454,7 @@ jobs:
needs:
- cloc
- setup
- lint
- build-oss-selfhost
- build-cloud
- build-commercial-selfhost
Expand All @@ -439,6 +466,7 @@ jobs:
if: ${{ (github.ref == 'refs/heads/master') || (github.ref == 'refs/heads/rc') }}
env:
CLOC_STATUS: ${{ needs.cloc.result }}
LINT_STATUS: ${{ needs.lint.result }}
SETUP_STATUS: ${{ needs.setup.result }}
BUILD_OSS_SELFHOST_STATUS: ${{ needs.build-oss-selfhost.result }}
BUILD_CLOUD_STATUS: ${{ needs.build-cloud.result }}
Expand All @@ -449,6 +477,8 @@ jobs:
run: |
if [ "$CLOC_STATUS" = "failure" ]; then
exit 1
elif [ "$LINT_STATUS" = "failure" ]; then
exit 1
elif [ "$SETUP_STATUS" = "failure" ]; then
exit 1
elif [ "$BUILD_OSS_SELFHOST_STATUS" = "failure" ]; then
Expand Down

0 comments on commit 5cb3941

Please sign in to comment.