Skip to content

Commit 33a1169

Browse files
author
Soft-Serve
committed
feat(ci): restructuring workflows
1 parent 0f02fad commit 33a1169

7 files changed

Lines changed: 43 additions & 46 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
name: Docker build
1+
name: Docker test builds
22

33
on:
44
push:
5-
branches: [main, golang]
5+
branches: [main]
66
pull_request:
77
branches: [main]
88

99
jobs:
10-
build:
11-
name: Docker Build
10+
docker:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
image: [gitops, repo-server]
15+
name: docker build
1216
runs-on: ubuntu-latest
13-
if: github.event_name == 'push' || github.event_name == 'pull_request'
1417
steps:
1518
- uses: actions/checkout@v4
1619
- name: Set up QEMU
@@ -23,5 +26,4 @@ jobs:
2326
with:
2427
platforms: linux/amd64
2528
push: false
26-
- name: Image digest
27-
run: echo ${{ steps.docker_build.outputs.digest }}
29+
file: docker/${{ matrix.image }}/Dockerfile

.github/workflows/golang-tests.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@ on:
99
jobs:
1010
test:
1111
name: Golang tests
12-
strategy:
13-
fail-fast: false
14-
matrix:
15-
os: [ubuntu-latest, windows-latest, macos-latest]
16-
runs-on: ${{ matrix.os }}
12+
runs-on: ubuntu-latest
1713
steps:
1814
- uses: actions/checkout@v4
1915
- name: Set up QEMU
@@ -24,7 +20,7 @@ jobs:
2420
with:
2521
go-version: 1.24
2622
- name: start soft-serve
27-
run: .//hack/soft-serve/start.sh
23+
run: ./hack/soft-serve/start.sh
2824
- name: run golang tests
2925
env:
3026
SOPS_AGE_KEY_FILE: ${{ github.workspace }}/test_assets/keys.txt

.github/workflows/publish-homebrew.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ jobs:
1919
- name: print sha256
2020
run: cat sha256.txt
2121
- name: publish homebrew formula
22-
run: ./.github/scripts/homebrew/publish.sh -u mxcd -t ${{ secrets.CI_PAT }} -v ${{ github.ref_name }} -s $(cat sha256.txt)
22+
run: ./hack/homebrew/publish.sh -u mxcd -t ${{ secrets.CI_PAT }} -v ${{ github.ref_name }} -s $(cat sha256.txt)
Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
name: Build
1+
name: Release
22

33
on:
44
push:
55
tags:
66
- 2.*
77

88
jobs:
9-
test:
9+
binaries:
1010
name: Build
1111
strategy:
1212
fail-fast: false
@@ -42,3 +42,26 @@ jobs:
4242
file: ${{ github.workspace }}/cmd/gitops/gitops${{ matrix.artifact_suffix }}
4343
asset_name: gitops_${{ matrix.os_name }}_${{ matrix.arch }}${{ matrix.artifact_suffix }}
4444
tag: ${{ github.ref }}
45+
docker:
46+
strategy:
47+
fail-fast: false
48+
matrix:
49+
image: [gitops, repo-server]
50+
name: docker build
51+
runs-on: ubuntu-latest
52+
permissions:
53+
packages: write
54+
steps:
55+
- uses: actions/checkout@v4
56+
- name: Set up QEMU
57+
uses: docker/setup-qemu-action@v2
58+
- name: Set up Docker Buildx
59+
uses: docker/setup-buildx-action@v2
60+
- name: Build
61+
id: docker_build
62+
uses: docker/build-push-action@v4
63+
with:
64+
platforms: linux/amd64
65+
push: true
66+
tags: ghcr.io/mxcd/gitops/${{ matrix.image }}:${{ github.ref_name }}
67+
file: docker/${{ matrix.image }}/Dockerfile

docker/repo-server/Dockerfile

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,5 @@
1-
FROM golang:1.24-alpine AS builder
2-
3-
RUN apk add --no-cache \
4-
build-base \
5-
cmake \
6-
openssl-dev \
7-
libssh2-dev \
8-
zlib-dev \
9-
curl \
10-
git
11-
12-
WORKDIR /tmp
13-
RUN curl -L https://github.com/libgit2/libgit2/archive/refs/tags/v1.5.0.tar.gz | tar xz && \
14-
cd libgit2-1.5.0 && \
15-
cmake . -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=/usr && \
16-
cmake --build . --target install
17-
18-
WORKDIR /go/src/github.com/libgit2
19-
RUN git clone https://github.com/libgit2/git2go.git && \
20-
cd git2go && \
21-
git checkout v34.0.0 && \
22-
git submodule update --init
23-
24-
ENV CGO_CFLAGS="-I/usr/include"
25-
ENV CGO_LDFLAGS="-L/usr/lib -lz -lssl -lcrypto"
26-
ENV LD_LIBRARY_PATH="/usr/lib"
1+
FROM golang:1.24-alpine3.20 AS builder
2+
RUN apk add --no-cache git
273

284
WORKDIR /usr/src
295
COPY go.mod /usr/src/go.mod
@@ -34,10 +10,10 @@ COPY cmd cmd
3410
COPY internal internal
3511

3612
WORKDIR /usr/src/cmd/repo-server
37-
RUN go build -o repo-server -ldflags="-s -w" .
13+
RUN go build -o server -ldflags="-s -w" .
3814

39-
FROM alpine:3.21
15+
FROM alpine:3.20
4016
WORKDIR /usr/bin
41-
COPY --from=builder /usr/src/cmd/repo-server/repo-server .
42-
ENTRYPOINT ["/usr/bin/repo-server"]
17+
COPY --from=builder /usr/src/cmd/repo-server/server .
18+
ENTRYPOINT ["/usr/bin/server"]
4319
EXPOSE 8080

0 commit comments

Comments
 (0)