Skip to content

Commit

Permalink
Acceptance testing framework (#139)
Browse files Browse the repository at this point in the history
* Baseline for acceptance tests

* Refine the acceptance testing framework and the test cases

* Run acceptance tests as part of the CI

* Update to Go v1.21 (CI)

* Downgrade to golang.org/x/[email protected]

* Use specific go build flag for acceptance tests
  • Loading branch information
joanlopez authored Nov 15, 2024
1 parent 8c64611 commit d41b4b1
Show file tree
Hide file tree
Showing 11 changed files with 522 additions and 20 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
name: Test & Build

on:
pull_request:
push:
paths:
- 'cmd/**'
- 'internal/**'
- 'acceptance/**'

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
go: ['1.20']
go: [ '1.21' ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
- name: Run Tests...
- name: Run unit tests
run: go test -v -vet=off -race ./...
- name: Build...
run: go build -race cmd/killgrave/main.go
- name: Run acceptance tests
run: make acceptance
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: '1.20'
go-version: '1.21'
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
if: startsWith(github.ref, 'refs/tags/')
Expand Down
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.PHONY: build
.PHONY: build acceptance

build:
go build -ldflags "-s -w -X 'github.com/friendsofgo/killgrave/internal/app/cmd._version=`git rev-parse --abbrev-ref HEAD`-`git rev-parse --short HEAD`'" -o bin/killgrave cmd/killgrave/main.go
go build -ldflags "-s -w -X 'github.com/friendsofgo/killgrave/internal/app/cmd._version=`git rev-parse --abbrev-ref HEAD`-`git rev-parse --short HEAD`'" -o bin/killgrave cmd/killgrave/main.go

acceptance: build
@(cd acceptance && go test -count=1 -tags=acceptance -v ./...)
Loading

0 comments on commit d41b4b1

Please sign in to comment.