diff --git a/.github/workflows/ci_docs.yml b/.github/workflows/ci_docs.yml index 5e4863c..78d4bc4 100644 --- a/.github/workflows/ci_docs.yml +++ b/.github/workflows/ci_docs.yml @@ -1,4 +1,4 @@ -name: Deploy docs to GitHub Pages +name: Deploy docs on: push: @@ -13,22 +13,27 @@ on: jobs: ci_docs: runs-on: ubuntu-latest + steps: - name: Checkout sources uses: actions/checkout@v3 + - name: Setup node uses: actions/setup-node@v3 with: node-version: 14.x registry-url: https://registry.npmjs.org/ cache: npm - - name: Make sure npm is latest + + - name: Install latest npm run: npm install -g npm@latest + - name: Build docs working-directory: projects/docs run: | - npm clean-install + npm clean-install --engine-strict npm run build + - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v3 with: diff --git a/.github/workflows/ci_publish.yml b/.github/workflows/ci_publish.yml index 51cb5fc..3c6e4bf 100644 --- a/.github/workflows/ci_publish.yml +++ b/.github/workflows/ci_publish.yml @@ -1,30 +1,37 @@ -name: Publish library to NPM +name: Publish library on: release: types: [created] jobs: + ci_tests: + uses: ./.github/workflows/ci_tests.yml + ci_publish: + needs: ci_tests runs-on: ubuntu-latest + steps: - name: Checkout sources uses: actions/checkout@v3 + - name: Setup node uses: actions/setup-node@v3 with: node-version: 14.x registry-url: https://registry.npmjs.org/ - - name: Make sure npm is latest + cache: npm + + - name: Install latest npm run: npm install -g npm@latest + - name: Install dependencies - run: npm clean-install - - name: Lint - run: npm run lint - - name: Test - run: npm run test + run: npm clean-install --engine-strict + - name: Build run: npm run build:lib + - name: Publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 59c0fa8..6b1ce12 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -1,4 +1,4 @@ -name: CI tests +name: Run tests on: push: @@ -9,8 +9,13 @@ on: paths-ignore: - 'projects/docs/**' pull_request: + workflow_call: workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: ci_tests: name: Tests on ${{ matrix.os }} node${{ matrix.node }} @@ -19,7 +24,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - node: [12, 14, 16] + node: [14, 16] steps: - name: Checkout sources @@ -30,6 +35,7 @@ jobs: with: node-version: ${{ matrix.node }} registry-url: https://registry.npmjs.org/ + cache: npm # https://github.com/actions/setup-node/issues/411 # https://github.com/npm/cli/issues/4341 @@ -40,8 +46,19 @@ jobs: - name: Install latest npm run: npm install -g npm@latest + - name: Cache node_modules + uses: actions/cache@v3 + id: cache-step + with: + key: cache-${{ matrix.os }}-node${{ matrix.node }}-${{ hashFiles('package-lock.json') }} + restore-keys: | + cache-${{ matrix.os }}-node${{ matrix.node }}- + path: | + node_modules + - name: Install dependencies - run: npm clean-install + if: steps.cache-step.outputs.cache-hit != 'true' + run: npm clean-install --engine-strict - name: Lint run: npm run lint