Skip to content

Commit cce2bf3

Browse files
authored
feat: add ci workflow (#72)
* feat: add `ci` workflow - Introduced a new CI workflow to automate continuous integration. - Moved the content of the `npm-publish` workflow into the new CI workflow and removed the original `npm-publish` workflow. - Added a newline in the `automatic-comment` workflow for better readability. - Removed the `.github` folder from the `.prettierignore` file to ensure proper formatting. * chore: rename job from `production` to `deploy-to-production` * chore: update `ci` to `install` * chore: add `type` field in package.json * chore: set `fetch-depth` and `chache` properties * chore: remove `cache` property * chore: add `build:core` and `build:ci` commands in package.json * chore: remove `build:core` * chore: update `vitest.config.ts` file * chore: remove `cache` property in test * chore: add `build:ci` command in test job
1 parent 1f99746 commit cce2bf3

File tree

7 files changed

+65
-28
lines changed

7 files changed

+65
-28
lines changed

.github/workflows/automatic-comment.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
with:
1818
message: |
1919
Thank you, @${{ github.actor }}, for your contribution to [${{ github.repository }}](${{ github.event.repository.html_url }}).
20+
2021
Your submission will be reviewed by [@halvaradop][1]. We will provide feedback or approval as soon as possible.
2122
22-
[1]: https://github.com/halvaradop
23+
[1]: https://github.com/halvaradop

.github/workflows/ci.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: ci
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, closed]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: check out code
12+
uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 2
15+
16+
- uses: actions/setup-node@v4
17+
with:
18+
node-version: "18.x"
19+
- run: npm install
20+
- run: npm run build:ci
21+
22+
test:
23+
runs-on: ubuntu-latest
24+
needs: [build]
25+
steps:
26+
- uses: actions/checkout@v4
27+
- uses: actions/setup-node@v4
28+
with:
29+
node-version: "18.x"
30+
- run: npm install
31+
# rebuild the project to ensure that the test files are available
32+
- run: npm run build:ci
33+
- run: npm test
34+
35+
deploy-to-development:
36+
if: github.event.pull_request.merged == true && github.base_ref == 'master'
37+
runs-on: ubuntu-latest
38+
needs: [build, test]
39+
environment: development
40+
steps:
41+
- run: echo "Deploying to development environment"
42+
43+
deploy-to-production:
44+
if: github.event.pull_request.merged == true && github.base_ref == 'master' && startsWith(github.head_ref, 'release/')
45+
runs-on: ubuntu-latest
46+
needs: [build, test]
47+
environment: production
48+
steps:
49+
- uses: actions/checkout@v4
50+
- uses: actions/setup-node@v3
51+
with:
52+
node-version: "18.x"
53+
54+
- name: publish
55+
uses: JS-DevTools/npm-publish@v3
56+
with:
57+
token: ${{ secrets.NPM_TOKEN }}

.github/workflows/npm-publish.yaml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.prettierignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
.github
21
app
32
node_modules
43

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22
"name": "@halvaradop/tailwindcss-workspace",
33
"private": true,
44
"version": "0.0.0",
5+
"type": "module",
56
"description": "A monorepo projectmanage multiple packages with features and utilities for TailwindCSS.",
67
"scripts": {
78
"dev": "turbo dev --parallel",
89
"build": "turbo build --parallel",
10+
"build:core": "turbo build --filter @halvaradop/tailwindcss-core",
11+
"build:ci": "npm run build:core && npm run build",
912
"format": "prettier --cache --write .",
1013
"format:check": "prettier --cache --check .",
1114
"test": "turbo test --filter=!@halvaradop/tailwindcss-core",

turbo.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"cache": false
1212
},
1313
"test": {
14-
"cache": true,
14+
"cache": false,
1515
"inputs": ["test"]
1616
},
1717
"test:watch": {

vitest.config.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ import { defineConfig } from "vitest/config"
55
*/
66
export default defineConfig({
77
test: {
8-
include: ["packages/**/*.test.ts"],
98
coverage: {
109
provider: "v8",
1110
reporter: ["text", "html"],
12-
include: ["packages/**/*.ts"],
13-
exclude: ["node_modules", "packages/**/dist"],
11+
include: ["packages/**/*.ts", "!packages/**/*.config.ts"],
12+
exclude: ["**/node_modules", "**/dist"],
1413
},
1514
},
1615
})

0 commit comments

Comments
 (0)