-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (91 loc) · 3.13 KB
/
Copy pathci.yaml
File metadata and controls
91 lines (91 loc) · 3.13 KB
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
---
name: CI
on:
pull_request:
branches:
- main
push:
branches:
- main
env:
# renovate: datasource=github-releases depName=golangci/golangci-lint versioning=semver-coerced
GOLANGCI_LINT_VERSION: "v2.6.2"
IMAGE: "ghcr.io/${{ github.repository }}"
REGISTRY: "ghcr.io"
TEST_TAG: "ghcr.io/${{ github.repository }}:test"
permissions:
contents: read
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
with:
fetch-depth: '0' # Required for go-header check to know correct mtime of files
- name: Set up Python
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6
- name: Set up Go
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6
with:
go-version-file: 'go.mod'
- name: Run pre-commit
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
env:
SKIP: golangci-lint-full
- name: Run golangci-lint
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}
- name: Run go tests
run: go test -v ./...
docker:
name: Docker
runs-on: ubuntu-latest
needs:
- 'tests'
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
- name: Set up QEMU
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3
- name: Log in to the Container registry
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build test image
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6
with:
load: true
tags: ${{ env.TEST_TAG }}
cache-from: type=gha
- name: Validate Container
id: validate
run: |
docker run --rm -i --entrypoint sh ${{ env.TEST_TAG }} < ci/validate.sh
- name: Extract metadata (tags, labels) for Docker
if: ${{ github.ref == 'refs/heads/main' }}
id: meta
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5
with:
images: ${{ env.IMAGE }}
tags: type=raw,value=latest
- name: Build and push image
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6
with:
cache-from: type=gha
cache-to: type=gha,mode=max
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}