-
-
Notifications
You must be signed in to change notification settings - Fork 44
147 lines (116 loc) · 4.42 KB
/
integration.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Integration testing
on: [push]
jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup pnpm
uses: pnpm/action-setup@v2
- name: Use Node.js v18.x
uses: actions/setup-node@v3
with:
node-version: v18.x
registry-url: 'https://npm.pkg.github.com'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build package
run: pnpm build
env:
LIBRARY_NAME: '@effector/patronum'
- name: Fetch latest package version
id: latest-package-json
run: echo "::set-output name=latest::$(yarn npm info @effector/patronum -f version --json)"
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Resolve latest package version from json
uses: sergeysova/jq-action@v2
id: latest-package
with:
cmd: echo "::set-output name=latest-release::$(echo '${{ steps.latest-package-json.outputs.latest }}' | jq .version -r)"
- name: Resolve latest release version
if: ${{ steps.latest-package.outputs.latest-release == '' }}
uses: pozetroninc/github-action-get-latest-release@master
id: github-release
with:
repository: ${{ github.repository }}
excludes: draft
- name: Set version to package from github release
if: ${{ steps.latest-package.outputs.latest-release == '' }}
run: npm version --force --no-git-tag-version ${{ steps.github-release.outputs.release }}
working-directory: './dist/'
- name: Add commit SHA to package version
run: npm version --force --no-git-tag-version prerelease --preid=${{ github.sha }}
working-directory: './dist/'
- name: Publish to Github NPM registry
working-directory: './dist/'
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get version from package.json
uses: sergeysova/jq-action@v2
id: version
with:
cmd: 'jq .version dist/package.json -r'
- name: Published ${{ steps.version.outputs.value }}
run: echo @effector/patronum@${{ steps.version.outputs.value }}
outputs:
version: ${{ steps.version.outputs.value }}
custom:
needs: build
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup pnpm
uses: pnpm/action-setup@v2
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
registry-url: 'https://npm.pkg.github.com'
- name: Install integration dependencies
run: pnpm install
working-directory: ./integration/custom
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install patronum@${{ needs.build.outputs.version }} to integration package
run: pnpm add @effector/patronum@${{ needs.build.outputs.version }}
working-directory: ./integration/custom
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run integration tests
run: pnpm test
working-directory: ./integration/custom
cra:
needs: build
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup pnpm
uses: pnpm/action-setup@v2
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
registry-url: 'https://npm.pkg.github.com'
- name: Install integration dependencies
run: pnpm install
working-directory: ./integration/cra
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install patronum@${{ needs.build.outputs.version }} to integration package
run: pnpm add @effector/patronum@${{ needs.build.outputs.version }}
working-directory: ./integration/cra
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run integration tests
run: pnpm test
working-directory: ./integration/cra