diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml new file mode 100644 index 0000000..fc348c5 --- /dev/null +++ b/.github/actions/build/action.yml @@ -0,0 +1,12 @@ +name: Build +description: Build the package + +runs: + using: composite + steps: + - name: Setup + uses: ./.github/actions/setup + + - name: Build the package + shell: bash + run: pnpm build diff --git a/.github/actions/lint/action.yml b/.github/actions/lint/action.yml new file mode 100644 index 0000000..1148ab0 --- /dev/null +++ b/.github/actions/lint/action.yml @@ -0,0 +1,12 @@ +name: Lint +description: Run linting for the package + +runs: + using: composite + steps: + - name: Setup + uses: ./.github/actions/setup + + - name: Run linting + shell: bash + run: pnpm lint diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 0000000..3fbf14a --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,18 @@ +name: Setup +description: Setup Node.js and pnpm, and install dependencies + +runs: + using: composite + steps: + - name: Setup pnpm + uses: pnpm/action-setup@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: "pnpm" + + - name: Install dependencies + shell: bash + run: pnpm install --frozen-lockfile diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml new file mode 100644 index 0000000..05a84a0 --- /dev/null +++ b/.github/actions/test/action.yml @@ -0,0 +1,12 @@ +name: Test +description: Run tests for the package + +runs: + using: composite + steps: + - name: Setup + uses: ./.github/actions/setup + + - name: Run tests + shell: bash + run: pnpm test:coverage diff --git a/.github/workflows/analyse.yml b/.github/workflows/analyse.yml new file mode 100644 index 0000000..650bc3b --- /dev/null +++ b/.github/workflows/analyse.yml @@ -0,0 +1,50 @@ +name: Analyse package health + +on: + push: + branches: + - main + pull_request: + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + # Quality Gate Stage + lint: + name: Lint + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Lint + uses: ./.github/actions/lint + + test: + name: Test + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Test + uses: ./.github/actions/test + + # Build Stage + build: + name: Build + runs-on: ubuntu-latest + needs: [lint, test] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Build + uses: ./.github/actions/build