mirror of
https://github.com/lukaszraczylo/graphql-monitoring-proxy.git
synced 2026-10-20 06:28:13 +00:00
Use shared PR workflow.
This commit is contained in:
+7
-100
@@ -1,109 +1,16 @@
|
|||||||
name: Run tests on PR
|
name: Pull Request
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- "main"
|
- main
|
||||||
push:
|
push:
|
||||||
paths-ignore:
|
|
||||||
- "**/**.md"
|
|
||||||
- "**/**.yaml"
|
|
||||||
- "static/**"
|
|
||||||
branches:
|
branches:
|
||||||
|
- "**"
|
||||||
- "!main"
|
- "!main"
|
||||||
|
|
||||||
env:
|
|
||||||
GO_VERSION: ">=1.21"
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
# deployments permission to deploy GitHub pages website
|
|
||||||
deployments: write
|
|
||||||
# contents permission to update benchmark contents in gh-pages branch
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# This job is responsible for preparation of the build
|
pr-checks:
|
||||||
# environment variables.
|
uses: lukaszraczylo/shared-actions/.github/workflows/go-pr.yaml@main
|
||||||
prepare:
|
with:
|
||||||
name: Preparing build context
|
go-version: "1.24"
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repo
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install Go
|
|
||||||
uses: actions/setup-go@v5
|
|
||||||
id: cache
|
|
||||||
with:
|
|
||||||
go-version: ${{env.GO_VERSION}}
|
|
||||||
cache-dependency-path: "**/*.sum"
|
|
||||||
|
|
||||||
- name: Go get dependencies
|
|
||||||
if: steps.cache.outputs.cache-hit != 'true'
|
|
||||||
run: |
|
|
||||||
go get ./...
|
|
||||||
|
|
||||||
# This job is responsible for running tests and linting the codebase
|
|
||||||
test:
|
|
||||||
name: "Unit testing"
|
|
||||||
# needs: [prepare]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container: golang:1
|
|
||||||
# container: github/super-linter:v4
|
|
||||||
needs: [prepare]
|
|
||||||
|
|
||||||
# services:
|
|
||||||
# # Label used to access the service container
|
|
||||||
# redis:
|
|
||||||
# # Docker Hub image
|
|
||||||
# image: redis
|
|
||||||
# # Set health checks to wait until redis has started
|
|
||||||
# options: >-
|
|
||||||
# --health-cmd "redis-cli ping"
|
|
||||||
# --health-interval 10s
|
|
||||||
# --health-timeout 5s
|
|
||||||
# --health-retries 5
|
|
||||||
# ports:
|
|
||||||
# # Maps the container port to the host machine
|
|
||||||
# - 6379:6379
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Install Go
|
|
||||||
uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version: ${{env.GO_VERSION}}
|
|
||||||
cache-dependency-path: "**/*.sum"
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
apt-get update
|
|
||||||
apt-get install ca-certificates make -y
|
|
||||||
update-ca-certificates
|
|
||||||
go mod tidy
|
|
||||||
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
|
||||||
|
|
||||||
- name: Run unit tests
|
|
||||||
run: |
|
|
||||||
CI_RUN=${CI} make test
|
|
||||||
|
|
||||||
- name: Run benchmark
|
|
||||||
run: |
|
|
||||||
go test -bench=. -benchmem ./... -run=^# | tee output.txt
|
|
||||||
|
|
||||||
- name: Store benchmark result
|
|
||||||
uses: benchmark-action/github-action-benchmark@v1
|
|
||||||
with:
|
|
||||||
tool: "go"
|
|
||||||
output-file-path: output.txt
|
|
||||||
fail-on-alert: true
|
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
comment-on-alert: true
|
|
||||||
summary-always: true
|
|
||||||
# auto-push only if it's on main branch
|
|
||||||
auto-push: false
|
|
||||||
gh-pages-branch: "main"
|
|
||||||
benchmark-data-dir-path: "docs/bench"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user