Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Chore] - Updated CI and Added Caching Feature #691

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
12 changes: 12 additions & 0 deletions .github/codeql/codeql-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
paths-ignore:
- '.github/**'
- 'node_modules/**'
- '**/*.md'
- '**/*.json'
- 'LICENSE'
- '**/*.css'
- 'README.md'
- 'css/**'
- 'paper/**'
- 'build/**'

28 changes: 20 additions & 8 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: 3Dmol.js CI

on:
workflow_dispatch:
pull_request:
branches: [master]
push:
branches: [master]
workflow_dispatch:


jobs:
build_and_test:
Expand All @@ -16,18 +16,30 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 20
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}

- uses: actions/cache@v3
id: npm-cache
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Install Dependencies
run: npm install
run: npm ci --cache .npm --prefer-offline

- name: Build 3Dmol.js
run: |
npm run build:dev
npm run build:prod
npm run generate:tests
run: npm run build

- name: Test
run: npm test
run: npm run test:ci

- name: Coverage
env:
Expand Down
31 changes: 20 additions & 11 deletions .github/workflows/CodeQL-Analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ name: "CodeQL"

on:
workflow_dispatch:
push:
branches: [ master ]
pull_request:
branches: [ master ]
push:
branches: [ master ]

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

jobs:
analyze:
Expand All @@ -27,20 +31,24 @@ jobs:

- uses: actions/setup-node@v3
with:
cache: npm
node-version: 20
cache: 'npm'

- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}

- name: Cache NPM Dependencies
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
- uses: actions/cache@v3
id: npm-cache
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Install Dependencies
run: npm install
run: npm ci --cache .npm --prefer-offline

- name: Build 3dmol.js
run: |
Expand All @@ -50,6 +58,7 @@ jobs:
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
config-file: ./.github/codeql/codeql-config.yml
languages: ${{ matrix.language }}

- name: Perform CodeQL Analysis
Expand Down
Loading