Skip to content

Commit

Permalink
ci(workflow): add actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Sukaato committed Aug 10, 2024
1 parent 842f004 commit 10d7e87
Show file tree
Hide file tree
Showing 55 changed files with 9,315 additions and 8,990 deletions.
10 changes: 10 additions & 0 deletions .githooks/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

if [ -z "$(git log -1 --pretty=%B)" ]; then
echo "Erreur : Le message de commit ne peut pas être vide."
exit 1
fi

echo Validate commit message using "$(npx commitlint --version)"

npx commitlint --edit --verbose
11 changes: 11 additions & 0 deletions .githooks/h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env sh
n=$(basename "$0")
s=$(dirname "$(dirname "$0")")/$n

[ ! -f "$s" ] && exit 0

export PATH="node_modules/.bin:$PATH"
sh -e "$s" "$@"
c=$?

exit $c
9 changes: 9 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Core
cd packages/core
npm run format
npm run lint

# Vue
cd ../vue
npm run format
npm run lint
35 changes: 35 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Issue number: resolves #

---------

<!-- Please do not submit updates to dependencies unless it fixes an issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->


## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by this PR. -->

-
-
-

## Does this introduce a breaking change?

- [ ] Yes
- [ ] No

<!--
If this introduces a breaking change:
1. Describe the impact and migration path for existing applications below.
2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/CheeseGrinder/poppy-ui/blob/main/CONTRIBUTING.md#footer for more information.
-->


## Other information

<!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. -->
56 changes: 56 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# This is used with the label workflow which
# will triage pull requests and apply a label based on the
# paths that are modified in the pull request.
#
# For more information, see:
# https://github.com/actions/labeler

'package: core':
- changed-files:
- any-glob-to-any-file:
- 'packages/core/**/*'

'package: angular':
- changed-files:
- any-glob-to-any-file:
- 'packages/angular/**/*'
- 'packages/angular-*/**/*'

'package: react':
- changed-files:
- any-glob-to-any-file:
- 'packages/react/**/*'
- 'packages/react-*/**/*'

'package: vue':
- changed-files:
- any-glob-to-any-file:
- 'packages/vue/**/*'
- 'packages/vue-*/**/*'

'dependencies':
- changed-files:
- any-glob-to-any-file:
- './**/package.json'

'performance':
- head-branch:
- ^perf/
- ^performance/

'features':
- head-branch:
- ^feat/
- ^feature/

'bug':
- head-branch:
- ^fix/
- ^bug/

'documentation':
- head-branch:
- ^docs?/
- changed-files:
- any-glob-to-any-file:
- ./**/*.md
14 changes: 14 additions & 0 deletions .github/workflows/actions/archive-download/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Archive Download
description: Downloads and decompresses an archive from a previous job
inputs:
package:
description: Package name
node-version:
description: Node Version
runs:
using: composite
steps:
- uses: actions/download-artifact@v4
with:
name: ${{ inputs.package }}-${{ inputs.node-version }}
path: ./packages/${{ inputs.package }}/poppy-ui-${{ inputs.package }}-${{ inputs.node-version }}.tgz
24 changes: 24 additions & 0 deletions .github/workflows/actions/audit/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Audit
description: Audit provided package
inputs:
package:
description: Audited package
type: string
required: true
node-version:
description: Node version
type: string
required: false
default: 20.x

runs:
using: composite
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}

- run: npx audit-ci@latest --config ./audit-ci.json
working-directory: ./packages/${{ inputs.package }}
shell: bash
45 changes: 45 additions & 0 deletions .github/workflows/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build
description: Run build for specified package
inputs:
package:
description: The package to build.
type: string
required: true
node-version:
description: The version of node to use.
type: string
default: 20.x
required: false

runs:
using: composite
steps:
- uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}

- name: Install Dependencies
run: npx lerna exec --scope @poppy-ui/${{ inputs.package }} npm install
shell: bash

- name: Build
run: npm run build --if-present
working-directory: ./packages/${{ inputs.package }}
shell: bash

- name: Pack
run: npm pack
working-directory: ./packages/${{ inputs.package }}
shell: bash

- name: Rename tarball
run: |
PKG=$(ls poppy-ui-${{ inputs.package }}-*.tgz)
mv $PKG poppy-ui-${{ inputs.package }}.tgz
working-directory: ./packages/${{ inputs.package }}
shell: bash

- uses: actions/upload-artifact@v4
with:
name: ${{ inputs.package }}-${{ inputs.node-version }}
path: ./packages/${{ inputs.package }}/poppy-ui-${{ inputs.package }}-${{ inputs.node-version }}.tgz
43 changes: 43 additions & 0 deletions .github/workflows/actions/quality/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Quality
description: Run quality check for specified package
inputs:
package:
description: The package to check code quality. Must have a .prettierrc and .eslintrc.
type: string
required: true
node-version:
description: The version of node to use.
type: string
default: 20.x
required: false

runs:
using: composite
steps:
- uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}

- name: Install Dependencies
run: npx lerna exec --scope @poppy-ui/${{ inputs.package }} npm install
shell: bash

- name: Prettier
run: npm run format
working-directory: ./packages/${{ inputs.package }}
shell: bash

- name: Lint
run: npm run lint
working-directory: ./packages/${{ inputs.package }}
shell: bash

- name: Scan
uses: ajinabraham/njsscan-action@v7
with:
args: '. --sarif --output results.sarif || true'

- name: Upload report
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: results.sarif
19 changes: 19 additions & 0 deletions .github/workflows/assign-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Assign issues to triage

on:
issues:
types:
- opened

jobs:
auto-assign:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: 'Auto-assign issue'
uses: pozil/auto-assign-issue@v2.0.0
with:
assignees: sukaato
numOfAssignee: 1
allowSelfAssign: false
30 changes: 30 additions & 0 deletions .github/workflows/audit-core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Audit - Core

on:
push:
paths:
- packages/core/**
pull_request:
branches:
- main
schedule:
# Run every Monday-Friday
# at 6:00 UTC (6:00 am UTC)
- cron: '00 06 * * 1-5'

# When pushing a new commit we should
# cancel the previous test run to not
# consume more runners than we need to.
concurrency:
group: ${{ github.ref }}_audit_core
cancel-in-progress: true

jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Audit
uses: ./.github/workflows/actions/audit
with:
package: core
32 changes: 32 additions & 0 deletions .github/workflows/audit-vue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Audit - Vue

on:
push:
paths:
- packages/vue/**
- packages/vue-*/**
pull_request:
branches:
- main
schedule:
# Run every Monday-Friday
# at 6:00 UTC (6:00 am UTC)
- cron: '00 06 * * 1-5'

# When pushing a new commit we should
# cancel the previous test run to not
# consume more runners than we need to.
concurrency:
group: ${{ github.ref }}_audit_vue
cancel-in-progress: true

jobs:
audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Audit
uses: ./.github/workflows/actions/audit
with:
package: vue
Loading

0 comments on commit 10d7e87

Please sign in to comment.