Skip to content

Commit

Permalink
use a reusable workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
TieDyedSheep committed May 23, 2024
1 parent d05de5b commit a2a47df
Showing 1 changed file with 5 additions and 72 deletions.
77 changes: 5 additions & 72 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,80 +1,13 @@
name: Typescript CI Workflow
name: Node CI Workflow

on:
push:
branches:
- dev
- main
pull_request:
branches:
- dev
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/[email protected]

- name: Set up Node.js
uses: actions/[email protected]
with:
node-version: '${{ vars.NODE_VERSION }}'
cache: 'npm'

- name: Install dependencies
run: |
echo "Installing dependencies..."
npm ci --ignore-scripts
echo "Dependency installation complete."
- name: Lint
id: lint
run: |
echo "Running Linter..."
npm run lint
echo "Running Linter complete."
continue-on-error: true

- name: Format check
id: format_check
run: |
echo "Running format check..."
npm run format-check
echo "Format check complete."
continue-on-error: true

- name: Test apply patches
id: test_apply_patches
run: |
set -e
shopt -s nullglob
patches=(*.patch)
if [ ${#patches[@]} -eq 0 ]; then
echo "No patches to test."
else
for patch in "${patches[@]}"; do
echo "Testing $patch"
git apply --check -v "$patch" || (echo "Failed to apply patch: $patch" && exit 1)
done
echo "All patches applied successfully."
fi
continue-on-error: true

- name: Build
id: build
run: |
echo "Building the code..."
npm run build
echo "Build complete."
- name: Unit Tests
id: unit_tests
run: |
echo "Running Unit Tests..."
npm test
echo "Unit Tests complete."
- name: Check if any step failed
if: ${{ steps.lint.outcome == 'failure' || steps.format_check.outcome == 'failure' || steps.test_apply_patches.outcome == 'failure' }}
run: exit 1
ci:
uses: shardeum/github-automation/.github/workflows/node-ci-shared.yml@dev

0 comments on commit a2a47df

Please sign in to comment.