[RHCLOUD-34712] style(commit): add commitlint to hook and ci #143
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
install: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: nrwl/nx-set-shas@v4 | |
# cache node modules for all jobs to use | |
- uses: './.github/actions/node-cache' | |
# cache cypress runner | |
- uses: './.github/actions/cypress-cache' | |
- name: Install deps | |
run: npm ci | |
commitlint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install commitlint | |
run: | | |
npm install conventional-changelog-conventionalcommits | |
npm install commitlint@latest | |
- name: Validate current commit (last commit) with commitlint | |
if: github.event_name == 'push' | |
run: npx commitlint --last --verbose | |
- name: Validate PR commits with commitlint | |
if: github.event_name == 'pull_request' | |
run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose | |
lint: | |
needs: [install] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: './.github/actions/lint' | |
test: | |
runs-on: ubuntu-latest | |
needs: [install] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: './.github/actions/test-unit' | |
test-component: | |
runs-on: ubuntu-latest | |
needs: [install] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: './.github/actions/test-component' | |
build: | |
runs-on: ubuntu-latest | |
needs: [install] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: nrwl/nx-set-shas@v4 | |
- uses: './.github/actions/node-cache' | |
- name: Install deps | |
run: npm i | |
- name: Build affected | |
run: npx nx affected -t build | |
test-e2e: | |
runs-on: ubuntu-latest | |
needs: [install, build] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: './.github/actions/test-e2e' | |
release: | |
runs-on: ubuntu-latest | |
needs: [install, lint, test, build, test-e2e, test-component] | |
if: github.event_name != 'pull_request' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ssh-key: ${{ secrets.BOTH_AUTH_KEY }} | |
- uses: './.github/actions/release' | |
with: | |
gh_token: ${{ secrets.GITHUB_TOKEN }} | |
npm_token: ${{ secrets.NPM_TOKEN }} | |
gh_name: ${{ secrets.GH_NAME }} | |
gh_email: ${{ secrets.GH_EMAIL }} | |