Repository navigation
77 lines (71 loc) · 2.8 KB
/
Copy pathci.yml
File metadata and controls
77 lines (71 loc) · 2.8 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
name: ci
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
test:
name: Test and lint
# Pushes to main run on the org runner; pull requests and everything else stay GitHub-hosted.
runs-on: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && fromJSON('["self-hosted","linux","x64"]') || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0
with:
go-version-file: go.mod
- run: go test -race -coverprofile=coverage.out ./...
- uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0
with:
version: v2.15.0
release-config:
name: Release config builds
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0
with:
go-version-file: go.mod
- uses: goreleaser/goreleaser-action@a4f02ab5355a589de60d917a659ce617ed19b3de # v7.3.0
with:
args: release --snapshot --clean
- name: Archives follow the Prometheus naming
run: |
ls dist/*.tar.gz
test -f dist/prometheus-noderings-sd-*.linux-amd64.tar.gz
tar -tzf dist/prometheus-noderings-sd-*.linux-amd64.tar.gz | grep -q '/prometheus-noderings-sd$'
image:
name: Container image builds
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4
- uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4
- uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7
with:
context: .
platforms: linux/amd64,linux/arm64
push: false
build-args: VERSION=ci
e2e:
name: End to end with Prometheus (live API)
# Calls the real NodeRings API (read-only). Runs when the NODERINGS_TOKEN
# secret is set, on pushes and manual runs (never for pull requests from forks).
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
needs: test
env:
NODERINGS_TOKEN: ${{ secrets.NODERINGS_TOKEN }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0
with:
go-version-file: go.mod
- name: Run
run: |
if [ -z "$NODERINGS_TOKEN" ]; then echo "NODERINGS_TOKEN is not set; skipping."; exit 0; fi
make e2e