Skip to content

Commit 20d3f87

Browse files
committed
Add gateway image workflow
1 parent 3315a20 commit 20d3f87

1 file changed

Lines changed: 71 additions & 0 deletions

File tree

.github/workflows/gateway.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Gateway
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
tags:
9+
- "v*"
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
packages: write
15+
16+
env:
17+
CARGO_TERM_COLOR: always
18+
REGISTRY: ghcr.io
19+
IMAGE_NAME: ${{ github.repository }}
20+
21+
jobs:
22+
test:
23+
runs-on: ubuntu-latest
24+
services:
25+
postgres:
26+
image: postgres:16
27+
env:
28+
POSTGRES_DB: agent_gateway_test
29+
POSTGRES_USER: agent_gateway_admin
30+
POSTGRES_PASSWORD: agent_gateway_dev
31+
ports:
32+
- 5432:5432
33+
options: >-
34+
--health-cmd "pg_isready -U agent_gateway_admin -d agent_gateway_test"
35+
--health-interval 5s
36+
--health-timeout 5s
37+
--health-retries 12
38+
env:
39+
TEST_DATABASE_URL: postgres://agent_gateway_admin:agent_gateway_dev@localhost:5432/agent_gateway_test
40+
steps:
41+
- uses: actions/checkout@v5
42+
- uses: dtolnay/rust-toolchain@stable
43+
- uses: Swatinem/rust-cache@v2
44+
- run: cargo test --locked
45+
46+
image:
47+
runs-on: ubuntu-latest
48+
needs: test
49+
if: github.event_name != 'pull_request'
50+
steps:
51+
- uses: actions/checkout@v5
52+
- uses: docker/setup-buildx-action@v3
53+
- uses: docker/login-action@v3
54+
with:
55+
registry: ${{ env.REGISTRY }}
56+
username: ${{ github.actor }}
57+
password: ${{ secrets.GITHUB_TOKEN }}
58+
- id: meta
59+
uses: docker/metadata-action@v5
60+
with:
61+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
62+
tags: |
63+
type=ref,event=branch
64+
type=ref,event=tag
65+
type=sha
66+
- uses: docker/build-push-action@v6
67+
with:
68+
context: .
69+
push: true
70+
tags: ${{ steps.meta.outputs.tags }}
71+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)