Skip to content

Commit

Permalink
add basic CI GHA config
Browse files Browse the repository at this point in the history
  • Loading branch information
ecordell committed Aug 22, 2023
1 parent 7ac4fdc commit 8ed50c9
Show file tree
Hide file tree
Showing 7 changed files with 162 additions and 2 deletions.
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "monthly"
labels:
- "area/dependencies"
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "monthly"
labels:
- "area/dependencies"
20 changes: 20 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
"area/cli":
- "cmd/**/*"
"area/core":
- "pkg/**/*"
"area/dependencies":
- "Dockerfile"
- "go.mod"
- "go.sum"
"area/docs":
- "CODE-OF-CONDUCT.md"
- "CONTRIBUTING.md"
- "DCO"
- "LICENSE"
- "README.md"
"area/tooling":
- "**/*_test.go"
- ".github/**/*"
- ".*"
- "Dockerfile*"
81 changes: 81 additions & 0 deletions .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
name: "Build & Test"
on: # yamllint disable-line rule:truthy
push:
branches:
- "main"
pull_request:
branches:
- "*"
merge_group:
types:
- "checks_requested"
env:
GO_VERSION: "~1.20.7"
jobs:
paths-filter:
runs-on: "ubuntu-latest"
outputs:
codechange: "${{ steps.code-filter.outputs.codechange }}"
steps:
- uses: "actions/checkout@v2"
- uses: "dorny/paths-filter@v2"
id: "code-filter"
with:
filters: |
codechange:
- ".github/workflows/build-test.yaml"
- "Dockerfile"
- "go.mod"
- "go.sum"
- "cmd/**"
- "magefiles/**"
- "pkg/**"
- "e2e/**"
- "internal/**"
build:
name: "Build Binary"
runs-on: "ubuntu-latest"
needs: "paths-filter"
if: |
needs.paths-filter.outputs.codechange == 'true'
steps:
- uses: "actions/checkout@v3"
- uses: "authzed/actions/setup-go@main"
with:
go-version: "${{ env.GO_VERSION }}"
- uses: "authzed/actions/go-build@main"

unit:
name: "Unit"
runs-on: "ubuntu-latest-4-cores"
needs: "paths-filter"
if: |
needs.paths-filter.outputs.codechange == 'true'
steps:
- uses: "actions/checkout@v3"
- uses: "authzed/actions/setup-go@main"
with:
go-version: "${{ env.GO_VERSION }}"
- name: "Unit tests"
uses: "magefile/mage-action@v2"
with:
version: "latest"
args: "test:unit"

e2e:
name: "e2e Tests"
runs-on: "ubuntu-latest-4-cores"
needs: "paths-filter"
if: |
needs.paths-filter.outputs.codechange == 'true'
steps:
- uses: "actions/checkout@v3"
- uses: "authzed/actions/setup-go@main"
with:
go-version: "${{ env.GO_VERSION }}"
- name: "Unit tests"
uses: "magefile/mage-action@v2"
with:
version: "latest"
args: "test:e2e"
23 changes: 23 additions & 0 deletions .github/workflows/cla.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: "CLA"
on: # yamllint disable-line rule:truthy
issue_comment:
types:
- "created"
pull_request_target:
types:
- "opened"
- "closed"
- "synchronize"
merge_group:
types:
- "checks_requested"
jobs:
cla:
name: "Check Signature"
runs-on: "ubuntu-latest"
steps:
- uses: "authzed/actions/cla-check@main"
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
cla_assistant_token: "${{ secrets.CLA_ASSISTANT_ACCESS_TOKEN }}"
15 changes: 15 additions & 0 deletions .github/workflows/labeler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: "Pull Request Labeler"
on: # yamllint disable-line rule:truthy
pull_request_target:
merge_group:
types:
- "checks_requested"
jobs:
triage:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/labeler@v3"
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
sync-labels: true
3 changes: 2 additions & 1 deletion magefiles/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ const (
generatedKubeConfigPath = "proxy.kubeconfig"
)

func (Dev) Bootstrap(ctx context.Context) error {
// Up brings up a dev cluster with the proxy installed
func (Dev) Up(ctx context.Context) error {
var proxyHostPort int32
if _, err := os.Stat(kubeconfigPath); err != nil {
proxyHostPort, err = GetFreePort("localhost")
Expand Down
7 changes: 6 additions & 1 deletion magefiles/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ import (

type Test mg.Namespace

// Runs the end-to-end tests against a real apiserver
// Unit runs the unit tests
func (Test) Unit() error {
return RunSh("go", WithV())("test", "./...")
}

// E2e runs the end-to-end tests against a real apiserver
func (Test) E2e() error {
return RunSh("go", Tool())(
"run",
Expand Down

0 comments on commit 8ed50c9

Please sign in to comment.