@@ -2,8 +2,8 @@ name: Release
22
33on :
44 push :
5- tags :
6- - " v*.*.* " # Run workflow on version tags, e.g. v1.0.0.
5+ branches :
6+ - main
77
88jobs :
99 release :
@@ -13,19 +13,14 @@ jobs:
1313 - uses : actions/checkout@v2
1414
1515 - name : Setup Node.js environment
16- uses : actions/setup-node@v2.1.2
16+ uses : actions/setup-node@v2
1717 with :
18- node-version : " 14.x"
19-
20- - name : Setup Go environment
21- uses : actions/setup-go@v2
22- with :
23- go-version : " 1.15"
18+ node-version : " 14.17"
2419
2520 - name : Get yarn cache directory path
2621 id : yarn-cache-dir-path
2722 run : echo "::set-output name=dir::$(yarn cache dir)"
28-
23+
2924 - name : Cache yarn cache
3025 uses : actions/cache@v2
3126 id : cache-yarn-cache
3429 key : ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
3530 restore-keys : |
3631 ${{ runner.os }}-yarn-
37-
32+
3833 - name : Cache node_modules
3934 id : cache-node-modules
4035 uses : actions/cache@v2
@@ -44,41 +39,51 @@ jobs:
4439 restore-keys : |
4540 ${{ runner.os }}-${{ matrix.node-version }}-nodemodules-
4641
47- - name : Install dependencies
48- run : yarn install --frozen-lockfile;
49- if : |
50- steps.cache-yarn-cache.outputs.cache-hit != 'true' ||
51- steps.cache-node-modules.outputs.cache-hit != 'true'
52-
53- - name : Build and test frontend
42+ - name : Build plugin
5443 run : yarn build
5544
56- - name : Check for backend
57- id : check-for-backend
45+ - name : Sign plugin
5846 run : |
59- if [ -f "Magefile.go" ]
60- then
61- echo "::set-output name=has-backend::true"
62- fi
47+ # We only have a single dependency, grafana-toolkit
48+ # So we install next to where it's needed
49+ yarn
50+ yarn sign
51+ env :
52+ GRAFANA_API_KEY : ${{ secrets.GRAFANA_API_KEY }} # Requires a Grafana API key from Grafana.com.
6353
64- - name : Test backend
65- if : steps.check-for-backend.outputs.has-backend == 'true'
66- uses : magefile/mage-action@v1
54+ # We reuse the same tests from the other repo, after all, why not?
55+ # TODO: run other tests that are valid here
56+ # eg: checking README etc
57+ - name : Run grafana server
58+ run : docker-compose -f pyroscope/grafana-plugin/panel/docker-compose.yml up -d
59+ - name : Run tests
60+ run : yarn --cwd pyroscope cy:panel:ci
61+ env :
62+ CYPRESS_VIDEO : true
63+ CYPRESS_COMPARE_SNAPSHOTS : true
64+ - uses : actions/upload-artifact@v2
65+ if : always()
66+ with :
67+ name : cypress-screenshots
68+ path : pyroscope/cypress/screenshots
69+ - uses : actions/upload-artifact@v2
70+ if : always()
6771 with :
68- version : latest
69- args : coverage
72+ name : cypress-videos
73+ path : pyroscope/cypress/videos
74+ - uses : actions/upload-artifact@v2
75+ if : always()
76+ with :
77+ name : cypress-snapshots
78+ # TODO: scope to only store screenshots that refer to grafana
79+ path : pyroscope/cypress/snapshots
7080
71- - name : Build backend
81+ # Setup the go environment, since the grafana plugin linter isn't distributed as a binary
82+ - name : Setup Go environment
7283 if : steps.check-for-backend.outputs.has-backend == 'true'
73- uses : magefile/mage-action@v1
84+ uses : actions/setup-go@v2
7485 with :
75- version : latest
76- args : buildAll
77-
78- - name : Sign plugin
79- run : yarn sign
80- env :
81- GRAFANA_API_KEY : ${{ secrets.GRAFANA_API_KEY }} # Requires a Grafana API key from Grafana.com.
86+ go-version : " 1.16"
8287
8388 - name : Get plugin metadata
8489 id : metadata
@@ -99,15 +104,6 @@ jobs:
99104
100105 echo ::set-output name=github-tag::${GITHUB_REF#refs/*/}
101106
102- - name : Read changelog
103- id : changelog
104- run : |
105- awk '/^## / {s++} s == 1 {print}' CHANGELOG.md > release_notes.md
106- echo "::set-output name=path::release_notes.md"
107-
108- - name : Check package version
109- run : if [ "v${{ steps.metadata.outputs.plugin-version }}" != "${{ steps.metadata.outputs.github-tag }}" ]; then printf "\033[0;31mPlugin version doesn't match tag name\033[0m\n"; exit 1; fi
110-
111107 - name : Package plugin
112108 id : package-plugin
113109 run : |
@@ -118,11 +114,24 @@ jobs:
118114
119115 - name : Lint plugin
120116 run : |
117+ export PATH="$(go env GOPATH)/bin/:$PATH"
118+
121119 git clone https://github.com/grafana/plugin-validator
122- pushd ./plugin-validator/cmd/plugincheck
120+ pushd ./plugin-validator/pkg/ cmd/plugincheck2
123121 go install
124122 popd
125- plugincheck ${{ steps.metadata.outputs.archive }}
123+ plugincheck2 -config lint.config.yaml ${{ steps.metadata.outputs.archive }}
124+ # until here it's pretty much the same as ci.yml
125+ # TODO: share the code somehow
126+
127+ # #########################
128+ # Release Specific Stuff #
129+ # #########################
130+ - name : Read changelog
131+ id : changelog
132+ run : |
133+ awk '/^## / {s++} s == 1 {print}' CHANGELOG.md > release_notes.md
134+ echo "::set-output name=path::release_notes.md"
126135
127136 - name : Create release
128137 id : create_release
@@ -159,6 +168,5 @@ jobs:
159168
160169 - name : Publish to Grafana.com
161170 run : |
162- echo A draft release has been created for your plugin. Please review and publish it. Then submit your plugin to grafana.com/plugins by opening a PR to https://github.com/grafana/grafana-plugin-repository with the following entry:
163- echo
164- 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": "https://github.com/${{ github.repository }}/releases/download/v${{ steps.metadata.outputs.plugin-version }}/${{ steps.metadata.outputs.archive }}", "md5": "${{ steps.package-plugin.outputs.checksum }}" } } } ] }' | jq .
171+ echo "A draft release has been created for your plugin. Please review and publish it."
172+ echo "To publish a new version, follow https://github.com/grafana/grafana-plugin-repository#maintain-your-plugin"
0 commit comments