Skip to content

Commit 3d97ce9

Browse files
committed
clean up GHA workflows
1 parent 1693f12 commit 3d97ce9

File tree

6 files changed

+29
-411
lines changed

6 files changed

+29
-411
lines changed

.github/workflows/README.md

Lines changed: 0 additions & 81 deletions
This file was deleted.

.github/workflows/bundle-stats.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 17 additions & 196 deletions
Original file line numberDiff line numberDiff line change
@@ -12,230 +12,51 @@ on:
1212

1313
jobs:
1414
build:
15-
name: Build, lint and unit tests
1615
runs-on: ubuntu-latest
1716
permissions:
1817
contents: read
1918
outputs:
2019
plugin-id: ${{ steps.metadata.outputs.plugin-id }}
2120
plugin-version: ${{ steps.metadata.outputs.plugin-version }}
22-
has-e2e: ${{ steps.check-for-e2e.outputs.has-e2e }}
23-
has-backend: ${{ steps.check-for-backend.outputs.has-backend }}
2421
env:
2522
GRAFANA_ACCESS_POLICY_TOKEN: ${{ secrets.GRAFANA_ACCESS_POLICY_TOKEN }}
2623
steps:
2724
- uses: actions/checkout@v5
2825
with:
2926
persist-credentials: false
30-
- name: Setup Node.js environment
31-
uses: actions/setup-node@v6
32-
with:
33-
node-version: '22'
34-
cache: 'npm'
35-
36-
- name: Install dependencies
37-
run: npm ci
38-
39-
- name: Check types
40-
run: npm run typecheck
41-
- name: Lint
42-
run: npm run lint
43-
- name: Unit tests
44-
run: npm run test:ci
45-
- name: Build frontend
46-
run: npm run build
47-
48-
- name: Check for backend
49-
id: check-for-backend
50-
run: |
51-
if [ -f "Magefile.go" ]
52-
then
53-
echo "has-backend=true" >> $GITHUB_OUTPUT
54-
fi
55-
56-
- name: Setup Go environment
57-
if: steps.check-for-backend.outputs.has-backend == 'true'
58-
uses: actions/setup-go@v6
59-
with:
60-
go-version: '1.22'
6127

62-
- name: Test backend
63-
if: steps.check-for-backend.outputs.has-backend == 'true'
64-
uses: magefile/mage-action@6f50bbb8ea47d56e62dee92392788acbc8192d0b # v3.1.0
28+
- uses: actions/setup-node@v6
6529
with:
66-
version: latest
67-
args: coverage
68-
69-
- name: Build backend
70-
if: steps.check-for-backend.outputs.has-backend == 'true'
71-
uses: magefile/mage-action@6f50bbb8ea47d56e62dee92392788acbc8192d0b # v3.1.0
72-
with:
73-
version: latest
74-
args: buildAll
30+
node-version: '20'
31+
cache: 'npm'
7532

76-
- name: Check for E2E
77-
id: check-for-e2e
78-
run: |
79-
if [ -f "playwright.config.ts" ]
80-
then
81-
echo "has-e2e=true" >> $GITHUB_OUTPUT
82-
fi
33+
- run: npm ci
34+
- run: npm run typecheck
35+
- run: npm run lint
36+
- run: npm run test:ci
37+
- run: npm run build
8338

8439
- name: Sign plugin
8540
run: npm run sign
8641
if: ${{ env.GRAFANA_ACCESS_POLICY_TOKEN != '' }}
8742

43+
- name: Package plugin
44+
run: npm run package
45+
8846
- name: Get plugin metadata
8947
id: metadata
9048
run: |
91-
sudo apt-get install jq
92-
93-
export GRAFANA_PLUGIN_ID=$(cat dist/plugin.json | jq -r .id)
94-
export GRAFANA_PLUGIN_VERSION=$(cat dist/plugin.json | jq -r .info.version)
95-
export GRAFANA_PLUGIN_ARTIFACT=${GRAFANA_PLUGIN_ID}-${GRAFANA_PLUGIN_VERSION}.zip
96-
97-
echo "plugin-id=${GRAFANA_PLUGIN_ID}" >> $GITHUB_OUTPUT
98-
echo "plugin-version=${GRAFANA_PLUGIN_VERSION}" >> $GITHUB_OUTPUT
99-
echo "archive=${GRAFANA_PLUGIN_ARTIFACT}" >> $GITHUB_OUTPUT
100-
101-
- name: Package plugin
102-
id: package-plugin
103-
run: |
104-
mv dist ${PLUGIN_ID}
105-
zip ${ARCHIVE} ${PLUGIN_ID} -r
106-
env:
107-
ARCHIVE: ${{ steps.metadata.outputs.archive }}
108-
PLUGIN_ID: ${{ steps.metadata.outputs.plugin-id }}
49+
echo "plugin-id=$(node -p "require('./src/plugin.json').id")" >> $GITHUB_OUTPUT
50+
echo "plugin-version=$(node -p "require('./src/plugin.json').info.version")" >> $GITHUB_OUTPUT
10951
110-
- name: Check plugin.json
52+
- name: Validate plugin
11153
run: |
11254
docker run --pull=always \
113-
-v $PWD/${ARCHIVE}:/archive.zip \
55+
-v $PWD/cybertec-pev-panel.zip:/archive.zip \
11456
grafana/plugin-validator-cli -analyzer=metadatavalid /archive.zip
115-
env:
116-
ARCHIVE: ${{ steps.metadata.outputs.archive }}
11757
118-
- name: Archive Build
119-
uses: actions/upload-artifact@v5
58+
- uses: actions/upload-artifact@v5
12059
with:
12160
name: ${{ steps.metadata.outputs.plugin-id }}-${{ steps.metadata.outputs.plugin-version }}
122-
path: ${{ steps.metadata.outputs.plugin-id }}
61+
path: cybertec-pev-panel.zip
12362
retention-days: 5
124-
125-
resolve-versions:
126-
name: Resolve e2e images
127-
runs-on: ubuntu-latest
128-
permissions:
129-
contents: read
130-
timeout-minutes: 3
131-
needs: build
132-
if: ${{ needs.build.outputs.has-e2e == 'true' }}
133-
outputs:
134-
matrix: ${{ steps.resolve-versions.outputs.matrix }}
135-
steps:
136-
- name: Checkout
137-
uses: actions/checkout@v5
138-
with:
139-
persist-credentials: false
140-
141-
- name: Resolve Grafana E2E versions
142-
id: resolve-versions
143-
uses: grafana/plugin-actions/e2e-version@e2e-version/v1.1.2
144-
145-
playwright-tests:
146-
needs: [resolve-versions, build]
147-
timeout-minutes: 15
148-
permissions:
149-
contents: read
150-
id-token: write
151-
pull-requests: write
152-
strategy:
153-
fail-fast: false
154-
matrix:
155-
GRAFANA_IMAGE: ${{fromJson(needs.resolve-versions.outputs.matrix)}}
156-
name: e2e test ${{ matrix.GRAFANA_IMAGE.name }}@${{ matrix.GRAFANA_IMAGE.VERSION }}
157-
runs-on: ubuntu-latest
158-
steps:
159-
- uses: actions/checkout@v5
160-
with:
161-
persist-credentials: false
162-
163-
- name: Download plugin
164-
uses: actions/download-artifact@v6
165-
with:
166-
path: dist
167-
name: ${{ needs.build.outputs.plugin-id }}-${{ needs.build.outputs.plugin-version }}
168-
169-
- name: Execute permissions on binary
170-
if: needs.build.outputs.has-backend == 'true'
171-
run: |
172-
chmod +x ./dist/gpx_*
173-
174-
- name: Setup Node.js environment
175-
uses: actions/setup-node@v6
176-
with:
177-
node-version: '22'
178-
cache: 'npm'
179-
180-
- name: Install dev dependencies
181-
run: npm ci
182-
183-
- name: Start Grafana
184-
run: |
185-
docker compose pull
186-
ANONYMOUS_AUTH_ENABLED=false DEVELOPMENT=false GRAFANA_VERSION=${{ matrix.GRAFANA_IMAGE.VERSION }} GRAFANA_IMAGE=${{ matrix.GRAFANA_IMAGE.NAME }} docker compose up -d
187-
188-
- name: Wait for grafana server
189-
uses: grafana/plugin-actions/wait-for-grafana@wait-for-grafana/v1.0.2
190-
with:
191-
url: http://localhost:3000/login
192-
193-
- name: Install Playwright Browsers
194-
run: npm exec playwright install chromium --with-deps
195-
196-
- name: Run Playwright tests
197-
id: run-tests
198-
run: npm run e2e
199-
200-
- name: Upload e2e test summary
201-
uses: grafana/plugin-actions/playwright-gh-pages/upload-report-artifacts@upload-report-artifacts/v1.0.1
202-
if: ${{ always() && !cancelled() }}
203-
with:
204-
upload-report: false
205-
github-token: ${{ secrets.GITHUB_TOKEN }}
206-
test-outcome: ${{ steps.run-tests.outcome }}
207-
208-
- name: Docker logs
209-
if: ${{ always() && steps.run-tests.outcome == 'failure' }}
210-
run: |
211-
docker logs cybertec-pev-panel >& grafana-server.log
212-
213-
- name: Stop grafana docker
214-
run: docker compose down
215-
216-
# Uncomment this step to upload the server log to Github artifacts. Remember Github artifacts are public on the Internet if the repository is public.
217-
# - name: Upload server log
218-
# uses: actions/upload-artifact@v4
219-
# if: ${{ always() && steps.run-tests.outcome == 'failure' }}
220-
# with:
221-
# name: ${{ matrix.GRAFANA_IMAGE.NAME }}-v${{ matrix.GRAFANA_IMAGE.VERSION }}-${{github.run_id}}-server-log
222-
# path: grafana-server.log
223-
# retention-days: 5
224-
225-
publish-report:
226-
if: ${{ always() && !cancelled() }}
227-
permissions:
228-
contents: write
229-
id-token: write
230-
pull-requests: write
231-
needs: [playwright-tests]
232-
runs-on: ubuntu-latest
233-
steps:
234-
- uses: actions/checkout@v5
235-
with:
236-
# required for playwright-gh-pages
237-
persist-credentials: true
238-
- name: Publish report
239-
uses: grafana/plugin-actions/playwright-gh-pages/deploy-report-pages@deploy-report-pages/v1.0.1
240-
with:
241-
github-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/cp-update.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)