-
Notifications
You must be signed in to change notification settings - Fork 2
109 lines (96 loc) · 3.81 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: CI
on:
push:
branches: [main]
tags:
- "v*"
pull_request:
workflow_dispatch:
jobs:
build:
name: Build and test
permissions:
contents: read
packages: read
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- run: |
CMETRICS_VERSION=$(sed -n 's/^ARG CMETRICS_VERSION=\(.*\)/\1/p' testdata/Dockerfile)
CMETRICS_RELEASE=$(sed -n 's/^ARG CMETRICS_RELEASE=\(.*\)/\1/p' testdata/Dockerfile)
echo "Using release: CMETRICS_RELEASE"
echo "Using version: CMETRICS_VERSION"
wget https://github.com/calyptia/cmetrics/releases/download/${CMETRICS_RELEASE}/cmetrics_${CMETRICS_VERSION}_${TARGETARCH}-headers.deb
wget https://github.com/calyptia/cmetrics/releases/download/${CMETRICS_RELEASE}/cmetrics_${CMETRICS_VERSION}_${TARGETARCH}.deb
sudo dpkg -i *.deb
rm *.deb
shell: bash
env:
TARGETARCH: amd64
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Go mod download
run: go mod download
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.CI_USERNAME }}
password: ${{ secrets.CI_PAT }}
- name: Cache Golang Docker Image
run: docker pull golang:latest
- name: Cache ghcr.io/calyptia/internal/core-fluent-bit Docker Image
run: docker pull ghcr.io/calyptia/internal/core-fluent-bit:main
- name: Unit tests
run: |
# go test -v -covermode=atomic -coverprofile=coverage.out ./...
go test -v -covermode=atomic -coverprofile=coverage.out \
-run \^TestInputCallbackCtrlC\$ ./
go test -v -covermode=atomic -coverprofile=coverage.out \
-run \^TestInputCallbackDangle\$ ./
go test -v -covermode=atomic -coverprofile=coverage.out \
-run \^TestInputCallbackInfinite\$ ./
go test -v -covermode=atomic -coverprofile=coverage.out \
-run \^TestInputCallbackInfiniteLatency\$ ./
go test -v -covermode=atomic -coverprofile=coverage.out \
-run \^TestInputCallbackInfiniteConcurrent\$ ./
go test -v -covermode=atomic -coverprofile=coverage.out \
-run \^TestPlugin\$ ./
go test -v -covermode=atomic -coverprofile=coverage.out \
-run \^TestInputCallbackInfiniteConcurrent\$ ./
go test -v -covermode=atomic -coverprofile=coverage.out \
./configloader/
go test -v -covermode=atomic -coverprofile=coverage.out \
./output/
- name: Upload coverage to Codecov
if: startsWith(github.ref, 'refs/tags/')
uses: codecov/codecov-action@v5
with:
file: ./coverage.out
flags: ${{ runner.os }}
token: ${{ secrets.CODECOV_TOKEN }}
- name: Install Syft for sboms
if: startsWith(github.ref, 'refs/tags/')
run: curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
shell: bash
- name: Import GPG key
if: startsWith(github.ref, 'refs/tags/')
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.CALYPTIA_GPG_KEY }}
passphrase: ${{ secrets.CALYPTIA_GPG_KEY_PASSPHRASE }}
- name: Run GoReleaser
if: startsWith(github.ref, 'refs/tags/')
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.CI_PAT }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}