Skip to content

Commit

Permalink
chore: set up github workflows (#8)
Browse files Browse the repository at this point in the history
# 🤖 Linear

Closes GRT-34

## Description
Set up GitHub workflows with the following jobs:

- build
- lint
- test
  • Loading branch information
0xyaco authored Jul 18, 2024
1 parent 7eb706b commit 795bb9f
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 3 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build

on:
workflow_call:

jobs:
build:
name: Run Build
runs-on: ubuntu-latest

steps:
- name: Check out github repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Use PNPM
uses: pnpm/action-setup@v4
with:
run_install: false

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run Build
run: pnpm build
43 changes: 43 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Lint

on:
workflow_call:

jobs:
commitlint:
name: Lint Commit Messages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v5
with:
commitDepth: 1

lint:
name: Run Linters
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Use PNPM
uses: pnpm/action-setup@v4
with:
run_install: false

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run Prettier
run: pnpm format

- name: Run Linter
run: pnpm lint
24 changes: 24 additions & 0 deletions .github/workflows/main-workflows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Main Workflow

on:
pull_request:
types: [opened, synchronize]
branches:
- dev
- main

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

jobs:
build:
uses: ./.github/workflows/build.yml

lint:
uses: ./.github/workflows/lint.yml
needs: build

test:
uses: ./.github/workflows/test.yml
needs: lint
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Tests

on:
workflow_call:

jobs:
unit:
name: Run unit tests
runs-on: ubuntu-latest
steps:
- name: Check out github repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Use PNPM
uses: pnpm/action-setup@v4
with:
run_install: false

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run tests
run: pnpm test
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test": "turbo run test",
"prepare": "husky",
"lint": "turbo run lint",
"format": "turbo run format"
"format": "turbo run format",
"build": "turbo run build"
},
"keywords": [],
"author": "",
Expand Down
3 changes: 2 additions & 1 deletion turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"lint:fix": {},
"format": {},
"format:fix": {},
"test": {}
"test": {},
"build": {}
},
"globalDependencies": [".eslintrc", ".prettierrc"]
}

0 comments on commit 795bb9f

Please sign in to comment.