Skip to content

Commit

Permalink
feat: run build and unit test for pull request (#63)
Browse files Browse the repository at this point in the history
* feat: run build and unit test for pull request

* fix: make kube-ratelimiter error
  • Loading branch information
xuqingyun authored Mar 25, 2024
1 parent 1c5fdde commit 7a52a11
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
32 changes: 32 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Build

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.17'

- name: Build
run: make build WHAT="cmd/kube-gateway cmd/kube-ratelimiter"

- name: Unit Test
run: go test ./... -coverprofile=coverage.out -coverpkg=./...
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
6 changes: 5 additions & 1 deletion cmd/kube-ratelimiter/post-build
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
#!/bin/bash
cp -r ${MAKE_RULES_WORKSPACE}/build/kube-ratelimiter/* "${MAKE_RULES_WORKSPACE}/output"

if [[ -d "${MAKE_RULES_WORKSPACE}/build/kube-ratelimiter/" ]]; then
cp -r ${MAKE_RULES_WORKSPACE}/build/kube-ratelimiter/* "${MAKE_RULES_WORKSPACE}/output"
fi

0 comments on commit 7a52a11

Please sign in to comment.