Skip to content

Commit 6871fa0

Browse files
authored
ci: basic setup (#2)
1 parent a1dd282 commit 6871fa0

File tree

3 files changed

+144
-0
lines changed

3 files changed

+144
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Check Pull Request Title
2+
on:
3+
pull_request:
4+
types: ['opened', 'edited', 'reopened', 'synchronize']
5+
6+
jobs:
7+
check-title:
8+
runs-on: ubuntu-20.04
9+
steps:
10+
- uses: actions/checkout@v3.0.2
11+
- uses: pnpm/action-setup@v2.2.2
12+
- name: Use Node.js
13+
uses: actions/setup-node@v3.3.0
14+
with:
15+
node-version: 17
16+
check-latest: true
17+
cache: 'pnpm'
18+
- run: pnpm install
19+
- run: echo '${{ github.event.pull_request.title }}' | pnpm commitlint

.github/workflows/deploy.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Deploy
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
perform_deploy:
7+
required: true
8+
description: Confirm Deploy
9+
type: boolean
10+
11+
jobs:
12+
deploy:
13+
runs-on: ubuntu-20.04
14+
if: github.ref == 'refs/heads/main'
15+
steps:
16+
- uses: actions/checkout@v3.0.2
17+
with:
18+
fetch-depth: "0"
19+
persist-credentials: false
20+
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
21+
- name: Git Identity
22+
run: |
23+
git config --global user.name 'Scaleway Bot'
24+
git config --global user.email 'github@scaleway.com'
25+
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/$GITHUB_REPOSITORY
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
28+
- uses: pnpm/action-setup@v2.2.2
29+
- name: Use Node.js
30+
uses: actions/setup-node@v3.3.0
31+
with:
32+
node-version: 17
33+
check-latest: true
34+
- run: pnpm install
35+
- run: pnpm run build
36+
- run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
37+
env:
38+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
39+
- run: pnpm lerna publish -y --create-release github --ignore-scripts --no-verify-access
40+
env:
41+
HUSKY: 0
42+
GH_TOKEN: ${{ secrets.GH_TOKEN }}

.github/workflows/run_tests.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Run Tests
2+
3+
on: push
4+
5+
jobs:
6+
typecheck:
7+
runs-on: ubuntu-20.04
8+
steps:
9+
- uses: actions/checkout@v3.0.2
10+
- uses: pnpm/action-setup@v2.2.2
11+
- name: Use Node.js
12+
uses: actions/setup-node@v3.3.0
13+
with:
14+
node-version: 17
15+
check-latest: true
16+
cache: 'pnpm'
17+
- run: pnpm install
18+
- run: pnpm run build
19+
- run: pnpm tsc --noEmit
20+
lint:
21+
runs-on: ubuntu-20.04
22+
steps:
23+
- uses: actions/checkout@v3.0.2
24+
- uses: pnpm/action-setup@v2.2.2
25+
- name: Use Node.js
26+
uses: actions/setup-node@v3.3.0
27+
with:
28+
node-version: 17
29+
check-latest: true
30+
cache: 'pnpm'
31+
- run: pnpm install
32+
- run: pnpm run build
33+
- run: pnpm run lint
34+
test:
35+
runs-on: ubuntu-20.04
36+
strategy:
37+
matrix:
38+
node: [ '14', '16', '17' ]
39+
steps:
40+
- uses: actions/checkout@v3.0.2
41+
- uses: pnpm/action-setup@v2.2.2
42+
- name: Use Node.js
43+
uses: actions/setup-node@v3.3.0
44+
with:
45+
node-version: ${{ matrix.node }}
46+
check-latest: true
47+
cache: 'pnpm'
48+
- run: pnpm install
49+
- run: pnpm run build
50+
- run: pnpm run test:coverage
51+
- uses: codecov/codecov-action@v3.1.0
52+
deploy:
53+
runs-on: ubuntu-20.04
54+
needs: [test]
55+
if: github.ref == 'refs/heads/main'
56+
steps:
57+
- uses: actions/checkout@v3.0.2
58+
with:
59+
fetch-depth: "0"
60+
persist-credentials: false
61+
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
62+
- name: Git Identity
63+
run: |
64+
git config --global user.name 'Scaleway Bot'
65+
git config --global user.email 'github@scaleway.com'
66+
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/$GITHUB_REPOSITORY
67+
env:
68+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
69+
- uses: pnpm/action-setup@v2.2.2
70+
- name: Use Node.js
71+
uses: actions/setup-node@v3.3.0
72+
with:
73+
node-version: 17
74+
check-latest: true
75+
- run: pnpm install
76+
- run: pnpm run build
77+
- run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc
78+
env:
79+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
80+
- run: pnpm lerna publish -y --create-release github --ignore-scripts --no-verify-access
81+
env:
82+
HUSKY: 0
83+
GH_TOKEN: ${{ secrets.GH_TOKEN }}

0 commit comments

Comments
 (0)