|
1 |
| -name: CI |
| 1 | +name: Lint |
2 | 2 |
|
3 | 3 | env:
|
4 | 4 | CYPRESS_CACHE_FOLDER: cypress/cache
|
|
8 | 8 | branches:
|
9 | 9 | - main
|
10 | 10 | jobs:
|
11 |
| - build: |
| 11 | + lint: |
12 | 12 | runs-on: ubuntu-latest
|
13 | 13 | steps:
|
14 |
| - - uses: actions/checkout@v2 |
15 |
| - |
16 |
| - - name: Setup Node.js environment |
17 |
| - uses: actions/setup-node@v2 |
18 |
| - with: |
19 |
| - node-version: "14.17" |
20 |
| - |
21 |
| - - name: Get yarn cache directory path |
22 |
| - id: yarn-cache-dir-path |
23 |
| - run: echo "::set-output name=dir::$(yarn cache dir)" |
24 |
| - |
25 |
| - - name: Cache yarn cache |
26 |
| - uses: actions/cache@v2 |
27 |
| - id: cache-yarn-cache |
28 |
| - with: |
29 |
| - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} |
30 |
| - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} |
31 |
| - restore-keys: | |
32 |
| - ${{ runner.os }}-yarn- |
33 |
| - - name: Cache node_modules |
34 |
| - id: cache-node-modules |
35 |
| - uses: actions/cache@v2 |
36 |
| - with: |
37 |
| - path: node_modules |
38 |
| - key: ${{ runner.os }}-${{ matrix.node-version }}-node-modules-${{ hashFiles('**/yarn.lock') }} |
39 |
| - restore-keys: | |
40 |
| - ${{ runner.os }}-${{ matrix.node-version }}-node-modules- |
41 |
| -
|
42 |
| - - name: Pull dependencies |
43 |
| - run: yarn |
44 |
| - - name: Cache Cypress Binary |
45 |
| - id: cache-cypress-binary |
46 |
| - uses: actions/cache@v2 |
47 |
| - with: |
48 |
| - path: cypress/cache |
49 |
| - key: cypress-binary-${{ hashFiles('yarn.lock') }} |
50 |
| - - run: yarn cypress install |
51 |
| - - name: Sign plugin |
52 |
| - run: yarn sign |
53 |
| - env: |
54 |
| - GRAFANA_API_KEY: ${{ secrets.GRAFANA_API_KEY }} # Requires a Grafana API key from Grafana.com. |
55 |
| - |
56 |
| - # Smoke test |
57 |
| - # We already tested it extensively in the other repository |
58 |
| - - name: Run grafana server |
59 |
| - run: docker-compose -f docker-compose.yml up -d |
60 |
| - |
61 |
| - - name: Run tests |
62 |
| - run: yarn cy:ci |
63 |
| - env: |
64 |
| - CYPRESS_VIDEO: true |
65 |
| - - uses: actions/upload-artifact@v2 |
66 |
| - if: always() |
67 |
| - with: |
68 |
| - name: cypress-screenshots |
69 |
| - path: pyroscope/cypress/screenshots |
70 |
| - - uses: actions/upload-artifact@v2 |
71 |
| - if: always() |
| 14 | + - uses: actions/checkout@v3 |
| 15 | + - uses: ./.github/actions/setup-node/ |
| 16 | + - run: yarn sign |
| 17 | + - uses: ./.github/actions/package-plugin/ |
| 18 | + id: package-plugin |
72 | 19 | with:
|
73 |
| - name: cypress-videos |
74 |
| - path: pyroscope/cypress/videos |
75 |
| - |
76 |
| - # Setup the go environment, since the grafana plugin linter isn't distributed as a binary |
77 |
| - - name: Setup Go environment |
78 |
| - if: steps.check-for-backend.outputs.has-backend == 'true' |
79 |
| - uses: actions/setup-go@v2 |
| 20 | + grafana-token: ${{ secrets.GRAFANA_API_KEY }} |
| 21 | + - uses: ./.github/actions/lint-plugin/ |
80 | 22 | with:
|
81 |
| - go-version: "1.16" |
82 |
| - |
83 |
| - - name: Get plugin metadata |
84 |
| - id: metadata |
85 |
| - run: | |
86 |
| - sudo apt-get install jq |
87 |
| -
|
88 |
| - export GRAFANA_PLUGIN_ID=$(cat dist/plugin.json | jq -r .id) |
89 |
| - export GRAFANA_PLUGIN_VERSION=$(cat dist/plugin.json | jq -r .info.version) |
90 |
| - export GRAFANA_PLUGIN_TYPE=$(cat dist/plugin.json | jq -r .type) |
91 |
| - export GRAFANA_PLUGIN_ARTIFACT=${GRAFANA_PLUGIN_ID}-${GRAFANA_PLUGIN_VERSION}.zip |
92 |
| - export GRAFANA_PLUGIN_ARTIFACT_CHECKSUM=${GRAFANA_PLUGIN_ARTIFACT}.md5 |
93 |
| -
|
94 |
| - echo "::set-output name=plugin-id::${GRAFANA_PLUGIN_ID}" |
95 |
| - echo "::set-output name=plugin-version::${GRAFANA_PLUGIN_VERSION}" |
96 |
| - echo "::set-output name=plugin-type::${GRAFANA_PLUGIN_TYPE}" |
97 |
| - echo "::set-output name=archive::${GRAFANA_PLUGIN_ARTIFACT}" |
98 |
| - echo "::set-output name=archive-checksum::${GRAFANA_PLUGIN_ARTIFACT_CHECKSUM}" |
99 |
| -
|
100 |
| - echo ::set-output name=github-tag::${GITHUB_REF#refs/*/} |
101 |
| -
|
102 |
| - - name: Package plugin |
103 |
| - id: package-plugin |
104 |
| - run: | |
105 |
| - mv dist ${{ steps.metadata.outputs.plugin-id }} |
106 |
| - zip ${{ steps.metadata.outputs.archive }} ${{ steps.metadata.outputs.plugin-id }} -r |
107 |
| - md5sum ${{ steps.metadata.outputs.archive }} > ${{ steps.metadata.outputs.archive-checksum }} |
108 |
| - echo "::set-output name=checksum::$(cat ./${{ steps.metadata.outputs.archive-checksum }} | cut -d' ' -f1)" |
109 |
| -
|
110 |
| - - name: Lint plugin |
111 |
| - run: | |
112 |
| - export PATH="$(go env GOPATH)/bin/:$PATH" |
113 |
| -
|
114 |
| - git clone https://github.com/grafana/plugin-validator |
115 |
| - pushd ./plugin-validator/pkg/cmd/plugincheck2 |
116 |
| - go install |
117 |
| - popd |
118 |
| - plugincheck2 -config lint.config.yaml ${{ steps.metadata.outputs.archive }} |
| 23 | + file: ${{ steps.package-plugin.outputs.archive }} |
| 24 | + enable-version-analyzer: false |
0 commit comments