-
Notifications
You must be signed in to change notification settings - Fork 13
125 lines (119 loc) · 3.49 KB
/
exporter-ci.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: Exporter CI
# this workflow will
# - check build and test the go codebase on every pull request
# - commit to the OBS development upstream whenever the main branch is updated
# - perform an OBS Submit Request to downstream whenever a GitHub release is published
# - attach build artifacts to GitHub releases
on:
push:
branches: [main]
paths-ignore:
- 'dashboards/**'
- 'packaging/obs/grafana-sap-netweaver-dashboards/**'
- '.github/workflows/dashboards*'
pull_request:
paths-ignore:
- 'dashboards/**'
- 'packaging/obs/grafana-sap-netweaver-dashboards/**'
- '.github/workflows/dashboards*'
workflow_dispatch:
release:
types: [ published ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
id: go
- name: static analysis
run: make static-checks
- name: test
run: make test
- name: build
run: make -j4 build-all
- name: compress
run: |
set -x
for FILE in build/bin/*; do
gzip $FILE
done
- uses: actions/upload-artifact@v2
with:
name: sap_host_exporter
path: build/bin
obs-commit:
needs: build
if: github.ref == 'refs/heads/main'
concurrency:
group: ${{ github.ref }}
runs-on: ubuntu-latest
container:
image: ghcr.io/trento-project/continuous-delivery:main
options: -u 0:0
env:
OBS_USER: ${{ secrets.OBS_USER }}
OBS_PASS: ${{ secrets.OBS_PASS }}
OBS_PROJECT: ${{ secrets.OBS_PROJECT }}
REVISION: ${{ github.sha }}
REPOSITORY: ${{ github.repository }}
GITHUB_OAUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: configure OSC
run: |
mkdir -p $HOME/.config/osc
cp /home/osc/.config/osc/oscrc $HOME/.config/osc
/scripts/init_osc_creds.sh
- run: git config --global --add safe.directory $(pwd)
- run: make exporter-obs-commit
obs-submit-request:
needs: build
if: github.event.release
concurrency:
group: ${{ github.ref }}
runs-on: ubuntu-latest
container:
image: ghcr.io/trento-project/continuous-delivery:main
options: -u 0:0
env:
OBS_USER: ${{ secrets.OBS_USER }}
OBS_PASS: ${{ secrets.OBS_PASS }}
OBS_PROJECT: ${{ secrets.OBS_PROJECT }}
PACKAGE_NAME: prometheus-sap_host_exporter
TARGET_PROJECT: ${{ secrets.OBS_DOWNSTREAM_PROJECT }}
REVISION: ${{ github.event.release.tag_name }}
REPOSITORY: ${{ github.repository }}
GITHUB_OAUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: configure OSC
run: |
mkdir -p $HOME/.config/osc
cp /home/osc/.config/osc/oscrc $HOME/.config/osc
/scripts/init_osc_creds.sh
- run: git config --global --add safe.directory $(pwd)
- run: make exporter-obs-workdir
- run: make exporter-obs-changelog
- run: make exporter-obs-commit
- run: /scripts/submit.sh
github-release-assets:
needs: build
if: github.event.release
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: sap_host_exporter
- uses: AButler/upload-release-assets@v2.0
with:
files: 'sap_host_exporter-*'
repo-token: ${{ secrets.GITHUB_TOKEN }}