Skip to content

Commit

Permalink
GitHub actions: fixes broken actions workflows and adds PR tests (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmcb authored Jul 13, 2023
1 parent b0a1b12 commit b149565
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 8 deletions.
51 changes: 43 additions & 8 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,52 @@
name: Test and build
name: Lint, test, and build

on: [push]
on:
push:
branches:
- main
pull_request:
types:
- opened
- edited
- synchronize
- reopened

permissions:
# So golangci-lint can read the contents of the lint yaml file
contents: read

jobs:
build:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: 1.20.x
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.53

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: 1.20
- name: Build
run: go build -v ./...
go-version: 1.20.x
- name: Test
run: go test -v ./...
run: make test

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: 1.20.x
- name: Build go binary
run: make build
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This is where the "make local" target drops build artifacts
build/

# explicitly ignore env files to ensure secrets aren't being accidentally committed
.env
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.PHONY: all lint test run local build setup-test-env teardown-test-env

ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))

all: lint test build
Expand All @@ -17,6 +19,9 @@ test:
run:
go run main.go

local:
go build -o build/pizza-oven main.go

build:
docker build . -t pizza-oven:latest

Expand Down

0 comments on commit b149565

Please sign in to comment.