-
Notifications
You must be signed in to change notification settings - Fork 47
95 lines (89 loc) · 2.97 KB
/
release-integration.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
name: Release integration pipeline
on:
release:
types:
- prereleased
- released
tags:
- 'v*'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
INTEGRATION: "prometheus"
ORIGINAL_REPO_NAME: 'newrelic/nri-prometheus'
REPO_FULL_NAME: ${{ github.event.repository.full_name }}
TAG: ${{ github.event.release.tag_name }}
S3_PATH: s3://nr-downloads-main/infrastructure_agent
TAG_SUFFIX: "" # This suffix is used for pre-release only
jobs:
test-nix:
name: Run unit tests on *Nix
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Unit tests
run: make ci/test
test-windows:
name: Run unit tests on Windows
runs-on: windows-latest
env:
GOPATH: ${{ github.workspace }}
defaults:
run:
working-directory: src/github.com/${{env.ORIGINAL_REPO_NAME}}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: src/github.com/${{env.ORIGINAL_REPO_NAME}}
- name: Install Go
uses: actions/setup-go@v4
with:
go-version-file: 'src/github.com/${{ env.ORIGINAL_REPO_NAME }}/go.mod'
- name: Running unit tests
shell: pwsh
run: |
.\build\windows\unit_tests.ps1
integration-release:
name: Use goreleaser for releasing
runs-on: ubuntu-latest
needs: [ test-nix, test-windows ]
steps:
- name: checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: setup Go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.FSI_DOCKERHUB_USERNAME }}
password: ${{ secrets.FSI_DOCKERHUB_TOKEN }}
- name: Add pre-release tag
if: ${{ github.event.release.prerelease }}
run: |
echo "TAG_SUFFIX=-pre" >> $GITHUB_ENV
- name: do the release
# The release target is not being executed inside a container (ci/release) since the target
# compiles docker images (from goreleaser) and that cannot be done inside a container.
run: make release
env:
GENERATE_PACKAGES: true
UPLOAD_PACKAGES: ${{ github.event.release.prerelease }}
notify-failure:
if: ${{ always() && failure() }}
needs: [test-nix, test-windows, integration-release]
runs-on: ubuntu-latest
steps:
- name: Notify failure via Slack
uses: archive/github-actions-slack@master
with:
slack-bot-user-oauth-access-token: ${{ secrets.COREINT_SLACK_TOKEN }}
slack-channel: ${{ secrets.COREINT_SLACK_CHANNEL }}
slack-text: "❌ `${{ env.ORIGINAL_REPO_NAME }}`: [release pipeline failed](${{ github.server_url }}/${{ env.ORIGINAL_REPO_NAME }}/actions/runs/${{ github.run_id }})."