Skip to content

Commit

Permalink
feat: Add test runner to all pull requests against master (#204)
Browse files Browse the repository at this point in the history
This PR adds a new ci/cd workflow that runs when a PR is made against master.

You will (likely) want to enable a few repository options in github to ensure this isn't bypassed, but it's up to you:

- Branch protection on master which requires a PR to merge
- CI/CD must pass before merging a PR
  • Loading branch information
colinsenner authored Jan 4, 2025
1 parent 1253aa7 commit 167cb90
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# This workflow will: build gomud for multiple os/architectures
# archive the binaries and create a new release for users to easily download

name: Go
name: Build and release

on:
push:
branches: ["master", "ci-cd-releases"]
branches: [master]
workflow_dispatch:

permissions:
contents: write
Expand All @@ -14,14 +15,22 @@ env:
RELEASE_FILENAME: go-mud-release

jobs:
# test:
# runs-on: ubuntu-latest
# steps:
# - name: Test
# run: go test -v ./...
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.23"

- name: Run tests
run: go test ./...

build:
runs-on: ubuntu-latest
needs: "test"
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -59,7 +68,7 @@ jobs:

release:
runs-on: ubuntu-latest
needs: build
needs: "build"
steps:
- uses: actions/checkout@v4

Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: run-tests

on:
pull_request:
branches: [master]
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.23"

- name: Run tests
run: go test ./...
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.vscode
private-notes.txt
**/users/*
**/config-overrides.yaml
bin/
**/config-overrides.yaml

0 comments on commit 167cb90

Please sign in to comment.