forked from czerwonk/junos_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (59 loc) · 1.9 KB
/
anx-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
on:
push:
branches:
- anx-prod
pull_request:
branches:
- "**"
name: anx-ci
jobs:
test:
strategy:
matrix:
go-version: ["1.21.x"]
platform: [ubuntu-latest, macos-latest, windows-latest, ubuntu-20.04]
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
if: success()
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v3
- name: Build
run: go build
- name: Run tests
run: go test ./... -v -covermode=count
publish:
needs: test
runs-on: ubuntu-20.04
env:
S3_URL: ${{ vars.S3_URL }}
S3_BUCKET: ${{ vars.S3_BUCKET }}
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }}
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.21
- name: Build
run: go build .
- uses: actions/upload-artifact@v3
with:
name: junos_exporter
path: junos_exporter
- uses: actions/setup-python@v4
- name: publish anx-prod to s3://$S3_BUCKET/public/junos_exporter/$GITHUB_REF_NAME/junos_exporter
run: |
pip install s4cmd
s4cmd --force put --endpoint-url https://$S3_URL junos_exporter s3://$S3_BUCKET/public/junos_exporter/$GITHUB_REF_NAME/junos_exporter
if: github.ref_type == 'tag' || github.ref == 'refs/heads/anx-prod'
- name: "publish feature-branch to s3://$S3_BUCKET/public/junos_exporter/staging/junos_exporter"
run: |
pip install s4cmd
s4cmd --force put --endpoint-url https://$S3_URL -f junos_exporter s3://$S3_BUCKET/public/junos_exporter/staging/junos_exporter
# value only there if pull_request or pull_request_target
if: github.head_ref