Skip to content

Commit

Permalink
ci/cd: optimize Continuous integration workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilsk committed Apr 1, 2023
1 parent 86733c1 commit 79179d4
Showing 1 changed file with 15 additions and 41 deletions.
56 changes: 15 additions & 41 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,63 +31,37 @@ jobs:
with: { fetch-depth: 0 }
- name: Set up Node.js environment
uses: actions/setup-node@v3
with: { node-version: 16, cache: npm }
with: { node-version: 16 }

# - name: Cache application dependencies
# id: core
# uses: actions/cache@v3
# with:
# path: ./node_modules
# key: core-${{ hashFiles('package-lock.json') }}
- name: Install application dependencies if needed
run: npm ci --ignore-scripts --include=dev
# if: steps.core.outputs.cache-hit != 'true'
env: { FONTAWESOME_TOKEN: '${{ secrets.FONTAWESOME_TOKEN }}' }
- name: Build the application
run: npm run build

validate:
name: Validating
runs-on: ubuntu-latest

steps:
- name: Checkout the repository
uses: actions/checkout@v3
with: { fetch-depth: 0 }

- name: Set up Node.js environment
- name: Cache application dependencies
id: app
uses: actions/setup-node@v3
with: { node-version: 16, cache: npm }
uses: actions/cache@v3
with:
path: ./node_modules
key: app-${{ hashFiles('package-lock.json') }}
- name: Install application dependencies if needed
run: npm ci --ignore-scripts --include=dev
env: { FONTAWESOME_TOKEN: '${{ secrets.FONTAWESOME_TOKEN }}' }
if: steps.app.outputs.cache-hit != 'true'
env: { FONTAWESOME_TOKEN: '${{ secrets.FONTAWESOME_TOKEN }}' }

- name: Set up Node.js environment
- name: Cache tooling dependencies
id: tools
uses: actions/setup-node@v3
with: { node-version: 16, cache: npm, cache-dependency-path: tools/package-lock.json }
uses: actions/cache@v3
with:
path: ./tools/node_modules
key: tools-${{ hashFiles('tools/package-lock.json') }}
- name: Install tooling dependencies if needed
run: ./Taskfile tools npm ci
if: steps.tools.outputs.cache-hit != 'true'

# https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#caching-packages-data
# - name: Cache tooling dependencies
# id: tools
# uses: actions/cache@v3
# with:
# path: ./tools/node_modules
# key: tools-${{ hashFiles('tools/package-lock.json') }}
# - name: Install tooling dependencies if needed
# run: ./Taskfile tools npm ci
# if: steps.tools.outputs.cache-hit != 'true'
- name: Check application dependencies
run: 'source bin/activate && [ "$(./Taskfile @deps check)" == "No depcheck issue" ]'
- name: Build the application
run: npm run build

notify:
name: Notifying
needs: [ build, validate ]
needs: [ build ]
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' && (failure() || success())

Expand Down

0 comments on commit 79179d4

Please sign in to comment.