forked from containers/prometheus-podman-exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.cirrus.yml
94 lines (85 loc) · 2.64 KB
/
.cirrus.yml
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
---
env:
DEST_BRANCH: "main"
CIRRUS_SHELL: "/bin/bash"
timeout_in: 30m
# Run on PRs and main branch post submit only. Don't run tests when tagging.
only_if: $CIRRUS_TAG == '' && ($CIRRUS_PR != '' || $CIRRUS_BRANCH == 'main')
clone_script: &full_clone |
if [ -z "$CIRRUS_PR" ]; then
git clone --recursive --branch=$CIRRUS_BRANCH https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git $CIRRUS_WORKING_DIR
git reset --hard $CIRRUS_CHANGE_IN_REPO
else
git clone --recursive https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git $CIRRUS_WORKING_DIR
git fetch origin pull/$CIRRUS_PR/head:pull/$CIRRUS_PR
git reset --hard $CIRRUS_CHANGE_IN_REPO
fi
precommit_test_task:
name: "Precommit"
alias: precommit
clone_script: *full_clone
container:
image: python:3.10
script: |
python3 -m pip install pre-commit
pre-commit run -a
vendor_task:
name: "Vendoring"
alias: vendor
clone_script: *full_clone
container:
image: golang:1.18
script: |
go mod tidy
go mod vendor
go mod verify
bash ./hack/tree_status.sh
gofmt_task:
name: "Gofmt"
alias: gofmt
clone_script: *full_clone
container:
image: golang:1.18
script: |
SRC=$(find . -type f -name '*.go' -not -path "./vendor/*")
gofmt -w ${SRC}
golangci_lint_task:
name: "Golangci-lint"
alias: lint
clone_script: *full_clone
container:
image: golang:1.18
script: |
make .install.golangci-lint
make lint
build_package_task:
name: "Binaries and RPM Package"
clone_script: |
dnf -y install git-core
if [ -z "$CIRRUS_PR" ]; then
git clone --recursive --branch=$CIRRUS_BRANCH https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git $CIRRUS_WORKING_DIR
git reset --hard $CIRRUS_CHANGE_IN_REPO
else
git clone --recursive https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git $CIRRUS_WORKING_DIR
git fetch origin pull/$CIRRUS_PR/head:pull/$CIRRUS_PR
git reset --hard $CIRRUS_CHANGE_IN_REPO
fi
depends_on:
- vendor
- precommit
- gofmt
- lint
container:
image: fedora:36
script: |
sh hack/install_dep.sh
rpkg local
rpm -ivh /tmp/rpkg/prometheus-podman-exporter-*/x86_64/prometheus-podman-exporter-*.x86_64.rpm
rpm -qil prometheus-podman-exporter
mv /tmp/rpkg/prometheus-podman-exporter-*/x86_64/prometheus-podman-exporter-*.x86_64.rpm ./
make binary
mv bin/prometheus-podman-exporter ./
always:
binary_artifacts:
path: "*prometheus-podman-exporter*"
type: application/octet-stream