diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c234bd..62fcce3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,13 @@ +name: CI Workflow + on: push: branches: - main pull_request: - types: [assigned, opened, synchronize, reopened, labeled] -name: ci + branches: + - '*' + permissions: contents: read # to fetch code (actions/checkout) @@ -13,13 +16,44 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node: [20] + node-version: [14, 16, 18, 20] + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run linter + run: npm run lint + + - name: Run tests + run: npm test + + build: + runs-on: ubuntu-latest + needs: test + strategy: + matrix: + node-version: [18] steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 with: - node-version: ${{ matrix.node }} - - run: npm install -g npm@10 - - run: node --version - - run: npm ci - - run: npm run test + node-version: ${{ matrix.node-version }} + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Build project + run: npm run build