-
Notifications
You must be signed in to change notification settings - Fork 159
Move test-pr flow to Github actions #550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
af53444
f568491
dd1bb72
e1febc3
8384baa
c815d53
0979808
6ef6d7f
3de56e4
0f4c863
5df483a
4a0f829
35c06d7
99ba5af
1b35e52
1f888c4
e2d7ebb
589b8de
fb6bb36
e83ae32
f2bdc50
e3f21d0
2be7656
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
name: test-pr | ||
on: | ||
pull_request: ~ | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
|
||
jobs: | ||
test-pr: | ||
runs-on: ubuntu-latest | ||
services: | ||
grafana: | ||
image: grafana/grafana-enterprise:latest | ||
env: | ||
GF_FEATURE_TOGGLES_ENABLE: 'renderAuthJWT' | ||
GF_PATHS_PROVISIONING: '/scripts/drone/provisioning' | ||
volumes: | ||
- /var/run/docker | ||
grabpl: | ||
image: byrnedo/alpine-curl:0.1.8 | ||
|
||
steps: | ||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
|
||
- name: Load secrets | ||
uses: grafana/shared-workflows/actions/get-vault-secrets@main | ||
Check warningCode scanning / CodeQL Unpinned tag for a non-immutable Action in workflow Medium test
Unpinned 3rd party Action 'test-pr' step
Uses Step Error loading related location Loading |
||
with: | ||
repo_secrets: | | ||
SRCCLR_API_TOKEN=github_actions:srcclr_api_token | ||
|
||
- name: grabpl | ||
run: | | ||
mkdir -p bin | ||
curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.0.20/grabpl | ||
chmod +x bin/grabpl | ||
|
||
- uses: actions/cache@v4 | ||
id: grabpl-cache | ||
with: | ||
key: grabpl-${{ runner.os }}-${{ hashFiles('**/binary.url') }} | ||
path: bin/grabpl | ||
restore-keys: | | ||
grabpl-${{ runner.os }}- | ||
grabpl- | ||
|
||
- name: install-node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '18' | ||
|
||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | ||
|
||
- name: Cache yarn cache | ||
uses: actions/cache@v4 | ||
id: cache-yarn-cache | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
|
||
- name: Cache node_modules | ||
id: cache-node-modules | ||
uses: actions/cache@v4 | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-${{ matrix.node-version }}-nodemodules-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ matrix.node-version }}-nodemodules- | ||
|
||
- name: yarn-install | ||
run: yarn install --frozen-lockfile --no-progress | ||
env: | ||
PUPPETEER_CACHE_DIR: /tmp/src/cache | ||
|
||
- name: yarn-build | ||
run: yarn build | ||
|
||
- uses: grafana/shared-workflows/actions/login-to-gar@main | ||
Check warningCode scanning / CodeQL Unpinned tag for a non-immutable Action in workflow Medium test
Unpinned 3rd party Action 'test-pr' step
Uses Step: login-to-gar Error loading related location Loading |
||
id: login-to-gar | ||
|
||
- name: run-puppeter-image | ||
run: | | ||
docker pull us-docker.pkg.dev/grafanalabs-dev/grafana-ci/docker-puppeteer:2.0.0 | ||
docker run us-docker.pkg.dev/grafanalabs-dev/grafana-ci/docker-puppeteer:2.0.0 | ||
|
||
- name: wait-for-grafana | ||
run: | | ||
for i in {1..10}; do | ||
if docker exec grafana curl -sf http://localhost:3000; then | ||
echo "Grafana is ready!" | ||
exit 0 | ||
fi | ||
echo "Waiting for container to be ready..." | ||
sleep 10 | ||
done | ||
echo "Container failed to start in time" >&2 | ||
exit 1 | ||
|
||
- name: yarn-test | ||
run: yarn test-ci | ||
env: | ||
CI: "true" | ||
PUPPETEER_CACHE_DIR: /tmp/src/cache | ||
|
||
- name: security-scan | ||
run: | | ||
echo "Starting veracode scan..." | ||
export _JAVA_OPTIONS=-Xmx4g | ||
mkdir -p ci/jobs/security_scan | ||
curl -sSL https://download.sourceclear.com/ci.sh | sh -s scan --skip-compile --quick --allow-dirty | ||
env: | ||
SRCCLR_API_TOKEN: ${{ env.SRCCLR_API_TOKEN }} | ||
|
||
packaging: | ||
runs-on: ubuntu-latest | ||
container: grafana/grafana-plugin-ci:1.9.6 | ||
needs: [test-pr] | ||
strategy: | ||
matrix: | ||
packaging: | ||
- linux-x64-glibc | ||
- darwin-x64-unknown | ||
- win32-x64-unknown | ||
- linux-x64-glibc-no-chromium | ||
- alpine-x64-no-chromium | ||
|
||
steps: | ||
- uses: actions/cache@v4 | ||
with: | ||
path: bin/grabpl | ||
key: grabpl-${{ runner.os }}-${{ hashFiles('**/binary.url') }} | ||
|
||
- name: Load secrets | ||
uses: grafana/shared-workflows/actions/get-vault-secrets@main | ||
Check warningCode scanning / CodeQL Unpinned tag for a non-immutable Action in workflow Medium test
Unpinned 3rd party Action 'test-pr' step
Uses Step Error loading related location Loading |
||
with: | ||
repo_secrets: | | ||
GRAFANA_API_KEY=github_actions:grafana_api_key | ||
|
||
- name: package-${{ matrix.packaging }} | ||
run: . | | ||
./scripts/package_target.sh ${{ matrix.packaging }} | ||
bin/grabpl build-plugin-manifest ./dist/plugin-${{ matrix.packaging }} || true | ||
./scripts/archive_target.sh ${{ matrix.packaging }} | ||
env: | ||
GRAFANA_API_KEY: ${{ env.GRAFANA_API_KEY }} |
Check failure
Code scanning / zizmor
id-token: write is overly broad at the workflow level Error test