-
Notifications
You must be signed in to change notification settings - Fork 10
132 lines (117 loc) · 3.49 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: CI
# Inspiration:
# https://github.com/alexdiliberto/ember-transformicons/blob/master/.github/workflows/ci.yml
on:
pull_request:
push:
# filtering branches here prevents duplicate builds from pull_request and push
branches:
- master
- main
env:
CI: true
jobs:
install_dependencies:
name: Install Dependencies
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: wyvox/action-setup-pnpm@v3
#############################################################
lint:
name: Lint JS
runs-on: ubuntu-latest
needs: ['install_dependencies']
steps:
- uses: actions/checkout@v4
- uses: wyvox/action-setup-pnpm@v3
- run: pnpm lint:js
lint_docs:
name: Lint Docs
runs-on: ubuntu-latest
needs: ['install_dependencies']
steps:
- uses: actions/checkout@v4
- uses: wyvox/action-setup-pnpm@v3
- run: pnpm lint:docs
lint_readme:
name: README up to date
runs-on: ubuntu-latest
needs: ['install_dependencies']
steps:
- uses: actions/checkout@v4
- uses: wyvox/action-setup-pnpm@v3
- run: pnpm run update && git diff --exit-code README.md docs/
#############################################################
tests_setup:
name: Tests' Setup
runs-on: ubuntu-latest
needs: ['install_dependencies']
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- uses: wyvox/action-setup-pnpm@v3
- id: set-matrix
run: |
matrix_json=$(node ./ci-test-matrix.mjs)
echo "matrix=$matrix_json" >> $GITHUB_OUTPUT
tests:
name: ${{ matrix.name }}
runs-on: ubuntu-latest
needs: ['tests_setup']
strategy:
fail-fast: false
matrix: ${{fromJson(needs.tests_setup.outputs.matrix)}}
steps:
- uses: actions/checkout@v4
- uses: wyvox/action-setup-pnpm@v3
with:
node-version: ${{ matrix.node }}
pnpm-version: ${{ matrix.pnpm }}
- name: "Use ${{ matrix.eslint }}"
run: |
pnpm remove eslint
pnpm add ${{ matrix.eslint }} -w
pnpm install
- name: Test with node@${{ matrix.node }} & pnpm@${{ matrix.pnpm }}
run: |
echo "Matrix Info"
echo "Intended: node@${{ matrix.node }}, eslint@${{ matrix.eslint }}, pnpm@${{ matrix.pnpm }}"
echo "node: $(node -v)"
echo "pnpm: $(pnpm --version)"
echo "pnpm why eslint"
pnpm why eslint
pnpm test
smoke-tests:
name: Smoke Tests
runs-on: ubuntu-latest
needs: ['install_dependencies']
steps:
- uses: actions/checkout@v4
- uses: wyvox/action-setup-pnpm@v3
- run: pnpm --filter './smoke-tests/**' exec eslint .
# https://github.com/changesets/action
release:
name: Release
timeout-minutes: 5
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs:
- tests
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: wyvox/action-setup-pnpm@v3
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
# This expects you to have a script called release which does a build for your packages
# and calls changeset publish
publish: pnpm release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}