-
Notifications
You must be signed in to change notification settings - Fork 7
152 lines (135 loc) · 4.35 KB
/
push-and-pr.workflow.yaml
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
148
149
150
151
152
name: Push checks
on:
push:
branches:
- master
- beta
- "[0-9]+-dev"
pull_request:
jobs:
lint:
name: Lint
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: npm ci
- name: Run lint
run: npm run lint
check-types:
name: Check types
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: npm ci
- name: Run types tests
run: npm run test:types
functional-tests:
name: Functional Tests
runs-on: ubuntu-22.04
needs: [lint, check-types]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 16
- name: docker pull
run: docker compose --profile backend pull
- name: docker install dependencies
run: docker compose run --no-deps kuzzle /bin/bash -c "npm ci"
- name: docker backend
run: |
# Continue when error
set +e
export BACKEND_COMMAND="npm run build && npm run prod";
docker compose --profile backend up -d --wait
exitcode="$?"
[[ "$exitcode" == "0" ]] || docker compose logs kuzzle
exit "$exitcode"
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm run test:functional
release-device-manager:
name: Release package
runs-on: ubuntu-22.04
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/beta' || github.ref == 'refs/heads/2-dev') }}
needs: [functional-tests]
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "lts/*"
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
SEMANTIC_RELEASE_NPM_PUBLISH: "true"
SEMANTIC_RELEASE_SLACK_WEBHOOK: ${{ secrets.SEMANTIC_RELEASE_SLACK_WEBHOOK }}
run: npx semantic-release
release-types:
name: Release type package
runs-on: ubuntu-22.04
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/beta' || github.ref == 'refs/heads/2-dev') }}
needs: [release-device-manager]
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "lts/*"
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
run: npm ci
- name: Build type package
run: npm -prefix ./types run build
- name: Publish package
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: cd types && npm publish
documentation_deploy:
needs: [release-device-manager]
name: Documentation - Deploy
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.ACCESS_TOKEN_CI }}
- name: Extract references from context
shell: bash
id: extract-refs
run: |
version=$(jq -r .version package.json | cut -d. -f 1)
echo "major-version=$(($version == 0 ? 1 : $version))" >> $GITHUB_OUTPUT
echo "repo=$(echo $GITHUB_REPOSITORY | cut -d/ -f 2)" >> $GITHUB_OUTPUT
- uses: convictional/trigger-workflow-and-wait@v1.6.3
with:
owner: kuzzleio
repo: documentation
github_token: ${{ secrets.ACCESS_TOKEN_CI }}
workflow_file_name: child_repo.workflow.yml
ref: ${{ github.ref_name == 'master' && 'master' || 'develop' }}
client_payload: '{"repo_name":"${{ steps.extract-refs.outputs.repo }}","branch":"${{ github.ref_name }}","version":"${{ steps.extract-refs.outputs.major-version }}"}'