Skip to content

Commit

Permalink
ci: gh workflows (#2)
Browse files Browse the repository at this point in the history
## Description

- Add Github Workflows 

## Checklist before requesting a review

- [x] I have conducted a self-review of my code.
- [x] I have conducted a QA.
  • Loading branch information
0xnigir1 authored Sep 9, 2024
1 parent f6a68b1 commit 7ff6ed5
Show file tree
Hide file tree
Showing 7 changed files with 148 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "Install dependencies"
description: "Prepare repository and all dependencies"

runs:
using: "composite"
steps:
- name: Use pnpm
uses: pnpm/action-setup@v4
with:
run_install: false

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

- name: Install dependencies
run: pnpm install --frozen-lockfile
21 changes: 21 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
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: Setup environment and install dependencies
uses: ./.github/actions/setup

- name: Run Build
run: pnpm build
32 changes: 32 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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: Setup environment and install dependencies
uses: ./.github/actions/setup

- name: Run Prettier
run: pnpm format

- name: Run Linter
run: pnpm lint
28 changes: 28 additions & 0 deletions .github/workflows/main-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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

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

on:
workflow_call:

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

- name: Setup environment and install dependencies
uses: ./.github/actions/setup

- name: Run integration tests
run: pnpm test:integration
20 changes: 20 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Tests

on:
workflow_call:

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

- name: Setup environment and install dependencies
uses: ./.github/actions/setup

- name: Run tests with coverage
run: pnpm test:cov
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# ts-turborepo-boilerplate

## Features

### Github workflows CI
Lint code and check commit messages format on every push.

Run all tests and see the coverage before merging changes.


## Tech stack
- [pnpm](https://pnpm.io/): package and workspace manager
- [turborepo](https://turbo.build/repo/docs): for managing the monorepo and the build system
Expand Down

0 comments on commit 7ff6ed5

Please sign in to comment.