Skip to content

chore(deps-dev): bump the development group with 2 updates (#164) #184

chore(deps-dev): bump the development group with 2 updates (#164)

chore(deps-dev): bump the development group with 2 updates (#164) #184

Workflow file for this run

name: CI-CD
on:
pull_request:
branches:
- main
push:
branches:
- main
# run CI every Monday at 12:25 UTC
schedule:
- cron: "25 12 * * 1"
jobs:
test:
name: Unit tests / Node.js ${{ matrix.node-version }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
node-version:
- 16
- 18
- 20
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Install Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm run coverage
- name: Send code coverage results to Coveralls
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949
with:
parallel: true
flag-name: Node.js ${{ matrix.node-version }} / ${{ matrix.os }}
coverage:
name: Code Coverage
runs-on: ubuntu-latest
timeout-minutes: 10
needs: test
steps:
- name: Let Coveralls know that all tests have finished
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949
with:
parallel-finished: true
build:
name: Build and lint
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: npm
- name: Install development dependencies
run: npm ci
- name: Build
run: npm run build
- name: Verify no un-staged changes
run: |
git status --porcelain
git diff-files --quiet
- name: Run lints
run: npm run lint
- name: Upload publish artifact
uses: actions/upload-artifact@v3
with:
name: publish-artifact
path: lib
e2e:
name: E2E tests / Node.js ${{ matrix.node-version }}
runs-on: ubuntu-latest
timeout-minutes: 10
needs: build
strategy:
fail-fast: false
matrix:
node-version:
- 16
- 18
- 20
services:
verdaccio:
image: verdaccio/verdaccio:5
ports:
- 4873:4873
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Install Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install production dependencies
run: npm install --production
- name: Download publish artifact
uses: actions/download-artifact@v3
with:
name: publish-artifact
path: lib
- id: setup
name: Login to local registry and set up fixture package
shell: bash
run: |
echo "token=$(./e2e/00-login.sh)" >> "$GITHUB_OUTPUT"
echo "package=$(./e2e/01-setup-package.sh ./e2e/fixture/cool\ package 0.0.1)" >> "$GITHUB_OUTPUT"
- name: Run CLI end-to-end test
shell: bash
env:
TOKEN: ${{ steps.setup.outputs.token }}
PACKAGE: ${{ steps.setup.outputs.package }}
run: |
./e2e/02-publish.sh "${PACKAGE}" ${TOKEN}
./e2e/03-verify.sh "${PACKAGE}"
./e2e/02-publish.sh "${PACKAGE}" ${TOKEN}
./e2e/01-setup-package.sh "${PACKAGE}" 0.0.2
./e2e/02-publish.sh "${PACKAGE}" ${TOKEN}
./e2e/03-verify.sh "${PACKAGE}"
- id: action-no-publish
name: Publish with already published version
uses: ./
with:
registry: http://localhost:4873
package: ${{ steps.setup.outputs.package }}/package.json
token: ${{ steps.setup.outputs.token }}
- name: Check action output
if: ${{ steps.action-no-publish.outputs.type }}
run: |
echo "::error::Expected release type to be '', got '${{ steps.action-no-publish.outputs.type }}'"
exit 1
- name: Create new version for Action end-to-end test
shell: bash
run: ./e2e/01-setup-package.sh "${{ steps.setup.outputs.package }}" 0.0.3
- id: action-publish
name: Publish a new version
uses: ./
with:
registry: http://localhost:4873
package: ${{ steps.setup.outputs.package }}/package.json
token: ${{ steps.setup.outputs.token }}
- name: Check release output
if: ${{ steps.action-publish.outputs.type != 'patch' }}
run: |
echo "::error::Expected release type to be 'patch', got '${{ steps.action-publish.outputs.type }}'"
exit 1
deploy:
if: ${{ github.ref == 'refs/heads/main' }}
name: Publish
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
id-token: write
needs:
- test
- build
- e2e
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Download publish artifact
uses: actions/download-artifact@v3
with:
name: publish-artifact
path: lib
- name: Publish to NPM
uses: ./
with:
token: ${{ secrets.NPM_TOKEN }}