Skip to content

Commit 36762ec

Browse files
committed
Update workflows
1 parent 64b37f5 commit 36762ec

File tree

2 files changed

+62
-15
lines changed

2 files changed

+62
-15
lines changed

.github/workflows/ci.yml

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,13 @@ on:
77
jobs:
88
build:
99
runs-on: ubuntu-latest
10-
strategy:
11-
matrix:
12-
node-version: [12.x]
1310
steps:
1411
- uses: actions/checkout@v2
1512

1613
- name: Setup Node.js environment
1714
uses: actions/setup-node@v2.1.2
1815
with:
19-
node-version: ${{ matrix.node-version }}
16+
node-version: '12.x'
2017

2118
- name: Get yarn cache directory path
2219
id: yarn-cache-dir-path
@@ -43,5 +40,33 @@ jobs:
4340
- name: Install dependencies
4441
run: yarn install --frozen-lockfile
4542

46-
- name: Build and test
43+
- name: Build and test frontend
4744
run: yarn build
45+
46+
- name: Check for backend
47+
id: check-for-backend
48+
run: |
49+
if [ -f "Magefile.go" ]
50+
then
51+
echo "::set-output name=has-backend::true"
52+
fi
53+
54+
- name: Setup Go environment
55+
if: steps.check-for-backend.outputs.has-backend == 'true'
56+
uses: actions/setup-go@v2
57+
with:
58+
go-version: '1.14'
59+
60+
- name: Test backend
61+
if: steps.check-for-backend.outputs.has-backend == 'true'
62+
uses: magefile/mage-action@v1
63+
with:
64+
version: latest
65+
args: coverage
66+
67+
- name: Build backend
68+
if: steps.check-for-backend.outputs.has-backend == 'true'
69+
uses: magefile/mage-action@v1
70+
with:
71+
version: latest
72+
args: buildAll

.github/workflows/release.yml

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ jobs:
1717
with:
1818
node-version: '12.x'
1919

20+
- name: Setup Go environment
21+
uses: actions/setup-go@v2
22+
with:
23+
go-version: '1.14'
24+
2025
- name: Get yarn cache directory path
2126
id: yarn-cache-dir-path
2227
run: echo "::set-output name=dir::$(yarn cache dir)"
@@ -45,9 +50,31 @@ jobs:
4550
steps.cache-yarn-cache.outputs.cache-hit != 'true' ||
4651
steps.cache-node-modules.outputs.cache-hit != 'true'
4752
48-
- name: Build plugin
53+
- name: Build and test frontend
4954
run: yarn build
5055

56+
- name: Check for backend
57+
id: check-for-backend
58+
run: |
59+
if [ -f "Magefile.go" ]
60+
then
61+
echo "::set-output name=has-backend::true"
62+
fi
63+
64+
- name: Test backend
65+
if: steps.check-for-backend.outputs.has-backend == 'true'
66+
uses: magefile/mage-action@v1
67+
with:
68+
version: latest
69+
args: coverage
70+
71+
- name: Build backend
72+
if: steps.check-for-backend.outputs.has-backend == 'true'
73+
uses: magefile/mage-action@v1
74+
with:
75+
version: latest
76+
args: buildAll
77+
5178
- name: Sign plugin
5279
run: yarn run grafana-toolkit plugin:sign
5380
env:
@@ -83,18 +110,13 @@ jobs:
83110
md5sum ${{ steps.metadata.outputs.archive }} > ${{ steps.metadata.outputs.archive-checksum }}
84111
echo "::set-output name=checksum::$(cat ./${{ steps.metadata.outputs.archive-checksum }} | cut -d' ' -f1)"
85112
86-
- name: Setup Go environment
87-
uses: actions/setup-go@v2
88-
with:
89-
go-version: '1.14.12'
90-
91113
- name: Lint plugin
92114
run: |
93-
git clone https://github.com/grafana/plugin-validator;
94-
pushd ./plugin-validator/cmd/plugincheck;
115+
git clone https://github.com/grafana/plugin-validator
116+
pushd ./plugin-validator/cmd/plugincheck
95117
go install
96118
popd
97-
plugincheck ${{ steps.metadata.outputs.archive }};
119+
plugincheck ${{ steps.metadata.outputs.archive }}
98120
99121
- name: Create release
100122
id: create_release
@@ -133,4 +155,4 @@ jobs:
133155
run: |
134156
echo Publish your plugin to grafana.com/plugins by opening a PR to https://github.com/grafana/grafana-plugin-repository with the following entry:
135157
echo
136-
echo '{ "id": "${{ steps.metadata.outputs.plugin-id }}", "type": "${{ steps.metadata.outputs.plugin-type }}", "url": "https://github.com/${{ github.repository }}", "versions": [ { "version": "${{ steps.metadata.outputs.plugin-version }}", "commit": "${{ github.sha }}", "url": "https://github.com/${{ github.repository }}", "download": { "any": { "url": "${{ steps.upload-plugin-asset.outputs.browser_download_url }}", "md5": "${{ steps.metadata.package-plugin.checksum }}" } } } ] }' | jq .
158+
echo '{ "id": "${{ steps.metadata.outputs.plugin-id }}", "type": "${{ steps.metadata.outputs.plugin-type }}", "url": "https://github.com/${{ github.repository }}", "versions": [ { "version": "${{ steps.metadata.outputs.plugin-version }}", "commit": "${{ github.sha }}", "url": "https://github.com/${{ github.repository }}", "download": { "any": { "url": "${{ steps.upload-plugin-asset.outputs.browser_download_url }}", "md5": "${{ steps.package-plugin.outputs.checksum }}" } } } ] }' | jq .

0 commit comments

Comments
 (0)