Skip to content

Commit 6587c08

Browse files
committed
ci: merged the test and build into one workflow.
1 parent 3cf0e66 commit 6587c08

File tree

3 files changed

+87
-80
lines changed

3 files changed

+87
-80
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.github/workflows/ci-cd.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: "CI/CD Pipeline"
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- "stable"
7+
push:
8+
branches:
9+
- "stable"
10+
tags:
11+
- 'v*'
12+
13+
env:
14+
REGISTRY: ghcr.io
15+
IMAGE_NAME: ${{ github.repository }}
16+
17+
jobs:
18+
test:
19+
name: "Build and Test"
20+
runs-on: "ubuntu-24.04"
21+
steps:
22+
- name: "Checkout repository"
23+
uses: "actions/checkout@v3"
24+
25+
- name: "Setup Go"
26+
uses: "actions/setup-go@v3"
27+
with:
28+
go-version: "1.24"
29+
30+
- name: "Install python3-pytest"
31+
run: "sudo apt install -y python3-pytest"
32+
33+
- name: "Make install"
34+
run: "make install"
35+
36+
- name: "Make test"
37+
run: "make test"
38+
39+
- name: "Make smoke"
40+
run: "make smoke"
41+
42+
- name: "Make irctest"
43+
run: "make irctest"
44+
45+
docker:
46+
name: "Build and Push Docker Image"
47+
runs-on: ubuntu-latest
48+
needs: test
49+
# Only run docker build on push events (not PRs) and after tests pass
50+
if: github.event_name != 'pull_request'
51+
steps:
52+
- name: "Checkout repository"
53+
uses: actions/checkout@v3
54+
55+
- name: "Authenticate to container registry"
56+
uses: docker/login-action@v2
57+
with:
58+
registry: ${{ env.REGISTRY }}
59+
username: ${{ github.repository_owner }}
60+
password: ${{ secrets.GITHUB_TOKEN }}
61+
62+
- name: "Extract metadata"
63+
id: meta
64+
uses: docker/metadata-action@v4
65+
with:
66+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
67+
tags: |
68+
type=ref,event=branch
69+
type=ref,event=tag
70+
type=semver,pattern={{version}}
71+
type=semver,pattern={{major}}.{{minor}}
72+
type=raw,value=latest,enable={{is_default_branch}}
73+
74+
- name: "Setup Docker buildx driver"
75+
id: buildx
76+
uses: docker/setup-buildx-action@v2
77+
78+
- name: "Build and push Docker image"
79+
uses: docker/build-push-action@v3
80+
with:
81+
context: .
82+
push: true
83+
platforms: linux/amd64,linux/arm64
84+
tags: ${{ steps.meta.outputs.tags }}
85+
labels: ${{ steps.meta.outputs.labels }}
86+
cache-from: type=gha
87+
cache-to: type=gha,mode=max

.github/workflows/docker-image.yml

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)