Skip to content

Commit

Permalink
ci: optimize minutes (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
prgres authored Jul 1, 2024
1 parent 0252fbd commit b86c91d
Show file tree
Hide file tree
Showing 8 changed files with 114 additions and 7 deletions.
File renamed without changes.
4 changes: 4 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ name: build

on:
pull_request:
paths-ignore:
- ".github"
push:
branches:
- main
paths-ignore:
- ".github"

jobs:
build:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
name: "CodeQL"

on:
push:
branches: ["main"]
schedule:
- cron: "17 22 * * 6"

Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/commitlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: "[all] lint"

on:
pull_request:
types:
- opened
- synchronize
- reopened
- edited
- reopened
- synchronize
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
commitlint:
name: Commitlint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install commitlint
run: |
pnpm install
- 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'
env:
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
COMMITS: ${{ github.event.pull_request.commits }}
run: |
npx commitlint \
--from "${HEAD_SHA}"~"${COMMITS}" \
--to "${HEAD_SHA}" \
--verbose
- name: Validate PR name with commitlint
if: github.event_name == 'pull_request'
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
echo "${PR_TITLE}" | npx commitlint
36 changes: 36 additions & 0 deletions .github/workflows/github-acitons-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: "[github-actions] lint"

on:
push:
branches:
- main
paths:
- ".github/**"
pull_request:
paths:
- ".github/**"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash

permissions:
contents: read

jobs:
actionlint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Check workflow files
run: |
echo "::add-matcher::.github/actionlint-matcher.json"
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
./actionlint -color
shell: bash
6 changes: 5 additions & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
name: golangci-lint
on:
push:
paths-ignore:
- ".github"
tags:
- v*
branches:
- main
pull_request:
paths-ignore:
- ".github"

permissions:
contents: read
Expand All @@ -18,7 +22,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.21'
go-version: "1.21"
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/osv-scanner.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: OSV Scanner

on:
push:
branches: ["main"]
schedule:
- cron: "17 22 * * 6"

permissions:
security-events: write
Expand Down
3 changes: 1 addition & 2 deletions lefthook.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
pre-push:
commands:
backend-lint:
root: backend/
tags: backend
root: /
glob: "*.go"
run: golangci-lint run

Expand Down

0 comments on commit b86c91d

Please sign in to comment.