-
Notifications
You must be signed in to change notification settings - Fork 32
85 lines (74 loc) · 3.15 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
name: Node CI
on: [push]
jobs:
test:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"
name: Run unit tests
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- name: Setup .npmrc file for NPM registry
uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
- name: Cache node modules
uses: actions/cache@v3
with:
path: packages/create-plugin/generated/yarn.lock
key: yarn-generated-lock-${{ hashFiles('yarn.lock') }}
restore-keys: |
yarn-generated-lock-${{ hashFiles('yarn.lock') }}
- name: Install dependencies
run: yarn install --immutable --prefer-offline
- name: Check types
run: yarn typecheck
- name: Lint
run: yarn lint
- name: Unit tests
run: yarn test:ci
- name: '@grafana/create-plugin - test an app plugin generation'
run: yarn workspace @grafana/create-plugin run generate-app && (cd ./packages/create-plugin/generated && yarn install --prefer-offline && yarn build && yarn lint)
- name: '@grafana/create-plugin - test panel plugin generation'
run: yarn workspace @grafana/create-plugin run generate-panel && (cd ./packages/create-plugin/generated && yarn install --prefer-offline && yarn build && yarn lint)
- name: '@grafana/create-plugin - test datasource plugin generation'
run: yarn workspace @grafana/create-plugin run generate-datasource && (cd ./packages/create-plugin/generated && yarn install --prefer-offline && yarn build && yarn lint)
- name: '@grafana/sign-plugin - build'
run: yarn workspace @grafana/sign-plugin run build
- name: '@grafana/sign-plugin - sign generated plugin'
env:
GRAFANA_API_KEY: ${{ secrets.GRAFANA_API_KEY }}
run: node ../../sign-plugin/dist/bin/run.js --rootUrls http://www.example.com --signatureType private
working-directory: ./packages/create-plugin/generated
release:
runs-on: ubuntu-latest
needs: test
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"
name: Release packages
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GH_BOT_ACCESS_TOKEN }}
- name: Prepare repository
run: git fetch --unshallow --tags
- name: Setup environment
uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: 'https://registry.npmjs.org'
cache: 'yarn'
- name: Install dependencies
run: yarn install --immutable --prefer-offline
- name: Build
run: yarn build
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GH_BOT_ACCESS_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
run: yarn release