Skip to content

Commit 67e31a4

Browse files
committed
Fleshing GHA out
1 parent dad1dbf commit 67e31a4

File tree

2 files changed

+81
-11
lines changed

2 files changed

+81
-11
lines changed

.github/workflows/push-or-pr.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Push or PR
2+
3+
on:
4+
push:
5+
branches: ["*"]
6+
pull_request:
7+
branches: ["main"]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Setup Go
17+
uses: actions/setup-go@v5
18+
with:
19+
go-version: "1.23.x"
20+
- run: go version
21+
22+
- name: Install dependencies
23+
run: go get .
24+
25+
- name: Go Tests
26+
run: go test -v ./...
27+
28+
- name: Build httptest
29+
env:
30+
GOOS: linux
31+
GOARCH: amd64
32+
run: go build
33+
34+
- name: Test httptest
35+
env:
36+
TEST_DIRECTORY: example-tests
37+
TEST_HOST: httpbin.org
38+
TEST_ENV: dev
39+
run: ./httptest
40+
41+
build:
42+
needs: [test]
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: Set up Docker
46+
uses: docker/setup-docker-action@v4
47+
with:
48+
daemon-config: |
49+
{
50+
"debug": true,
51+
"features": {
52+
"containerd-snapshotter": true
53+
}
54+
}
55+
56+
- name: Login to Docker Hub
57+
uses: docker/login-action@v3
58+
with:
59+
username: ${{ secrets.DOCKER_USERNAME }}
60+
password: ${{ secrets.DOCKER_PASSWORD }}
61+
62+
- name: Set up QEMU
63+
uses: docker/setup-qemu-action@v3
64+
65+
- name: Build and push
66+
uses: docker/build-push-action@v6
67+
with:
68+
platforms: linux/amd64,linux/arm64
69+
load: true
70+
tags: nytimes/httptest:dev
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
1-
name: CI
1+
name: Tagged Release
22

33
on:
4-
push:
5-
branches: ["main"]
6-
pull_request:
7-
branches: ["main"]
4+
release:
5+
types: [published]
86

97
jobs:
108
build:
119
runs-on: ubuntu-latest
1210

1311
steps:
14-
- name: Dump GitHub context
15-
env:
16-
GITHUB_CONTEXT: ${{ toJSON(github) }}
17-
run: echo "$GITHUB_CONTEXT"
18-
1912
- name: Set up Docker
2013
uses: docker/setup-docker-action@v4
2114
with:
@@ -27,6 +20,12 @@ jobs:
2720
}
2821
}
2922
23+
- name: Docker meta
24+
id: meta
25+
uses: docker/metadata-action@v5
26+
with:
27+
images: nytimes/httptest
28+
3029
- name: Login to Docker Hub
3130
uses: docker/login-action@v3
3231
with:
@@ -41,4 +40,5 @@ jobs:
4140
with:
4241
platforms: linux/amd64,linux/arm64
4342
load: true
44-
tags: nytimes/httptest:dev
43+
tags: ${{ steps.meta.outputs.tags }}
44+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)