-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ci/cd): fix release pipeline and adding tests
- Loading branch information
1 parent
8b5c9cb
commit 22e99cd
Showing
10 changed files
with
137 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,15 +9,16 @@ on: | |
pull_request: | ||
|
||
env: | ||
TAG: "v0.0.0" # needed for goreleaser windows builds | ||
TAG: "v0.0.0" # needed for fake-prereleases | ||
REPO_FULL_NAME: ${{ github.event.repository.full_name }} | ||
INTEGRATION: "nginx" | ||
ORIGINAL_REPO_NAME: "newrelic/nri-nginx" | ||
DOCKER_LOGIN_AVAILABLE: ${{ secrets.OHAI_DOCKER_HUB_ID }} | ||
|
||
jobs: | ||
static-analysis: | ||
name: Run all static analysis checks | ||
runs-on: ubuntu-22.04 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: newrelic/newrelic-infra-checkers@v1 | ||
|
@@ -35,7 +36,7 @@ jobs: | |
|
||
test-nix: | ||
name: Run unit tests on *Nix | ||
runs-on: ubuntu-22.04 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Login to DockerHub | ||
|
@@ -49,7 +50,7 @@ jobs: | |
|
||
test-windows: | ||
name: Run unit tests on Windows | ||
runs-on: windows-2022 | ||
runs-on: windows-latest | ||
env: | ||
GOPATH: ${{ github.workspace }} | ||
defaults: | ||
|
@@ -72,7 +73,7 @@ jobs: | |
# can't run this step inside of container because of tests specific | ||
test-integration-nix: | ||
name: Run integration tests on *Nix | ||
runs-on: ubuntu-22.04 | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: src/github.com/${{env.ORIGINAL_REPO_NAME}} | ||
|
@@ -97,16 +98,68 @@ jobs: | |
GOPATH: ${{ github.workspace }} | ||
run: make integration-test | ||
|
||
test-build: | ||
name: Test binary compilation for all platforms:arch | ||
runs-on: ubuntu-22.04 | ||
test-build-nix: | ||
name: Test binary compilation and packaging for linux | ||
runs-on: ubuntu-latest | ||
env: | ||
GPG_MAIL: '[email protected]' | ||
GPG_PASSPHRASE: ${{ secrets.OHAI_GPG_PASSPHRASE }} | ||
GPG_PRIVATE_KEY_BASE64: ${{ secrets.OHAI_GPG_PRIVATE_KEY_BASE64 }} # base64 encoded | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Login to DockerHub | ||
if: ${{env.DOCKER_LOGIN_AVAILABLE}} | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.OHAI_DOCKER_HUB_ID }} | ||
password: ${{ secrets.OHAI_DOCKER_HUB_PASSWORD }} | ||
- run: | | ||
git tag "$TAG" | ||
if [ -z "$GPG_PASSPHRASE" ]; then | ||
echo NO_SIGN=true >> $GITHUB_ENV | ||
fi | ||
- name: Build all platforms:arch | ||
run: make ci/build | ||
run: make ci/fake-prerelease | ||
- name: Upload artifacts for next job | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: windows-packages | ||
path: dist/nri-*.zip | ||
|
||
test-build-windows: | ||
name: Create MSI | ||
runs-on: windows-latest | ||
needs: [test-build-nix] | ||
env: | ||
GOPATH: ${{ github.workspace }} | ||
PFX_CERTIFICATE_BASE64: ${{ secrets.OHAI_PFX_CERTIFICATE_BASE64 }} # base64 encoded | ||
PFX_CERTIFICATE_DESCRIPTION: 'New Relic' | ||
PFX_PASSPHRASE: ${{ secrets.OHAI_PFX_PASSPHRASE }} | ||
defaults: | ||
run: | ||
working-directory: src/github.com/${{ env.ORIGINAL_REPO_NAME }} | ||
strategy: | ||
matrix: | ||
goarch: [amd64,386] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
path: src/github.com/${{ env.ORIGINAL_REPO_NAME }} | ||
- shell: bash | ||
run: git tag "$TAG" | ||
|
||
- name: Download artifact from previous job | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: windows-packages | ||
path: src/github.com/${{ env.ORIGINAL_REPO_NAME }}/dist/ | ||
|
||
- name: Get PFX certificate from GH secrets | ||
shell: bash | ||
run: | | ||
if [ -z "$PFX_CERTIFICATE_BASE64" ]; then | ||
echo NO_SIGN=true >> $GITHUB_ENV | ||
else | ||
printf "%s" "$PFX_CERTIFICATE_BASE64" | base64 -d - > wincert.pfx | ||
fi | ||
- name: Extract .exe | ||
shell: pwsh | ||
run: build\windows\extract_exe.ps1 "$env:INTEGRATION" ${{ matrix.goarch }} "$env:TAG" | ||
- name: Create MSI | ||
shell: pwsh | ||
run: build\windows\package_msi.ps1 -integration "$env:INTEGRATION" -arch ${{ matrix.goarch }} -tag "$env:TAG" -pfx_passphrase "$env:PFX_PASSPHRASE" -pfx_certificate_description "$env:PFX_CERTIFICATE_DESCRIPTION" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
param ( | ||
[string]$INTEGRATION="none", | ||
[string]$ARCH="amd64", | ||
[string]$TAG="v0.0.0" | ||
) | ||
write-host "===> Creating dist folder" | ||
New-Item -ItemType directory -Path .\dist -Force | ||
|
||
$VERSION=${TAG}.substring(1) | ||
$exe_folder="nri-${INTEGRATION}_windows_${ARCH}" | ||
$zip_name="nri-${INTEGRATION}-${ARCH}.${VERSION}.zip" | ||
|
||
write-host "===> Expanding" | ||
expand-archive -path "dist\${zip_name}" -destinationpath "dist\${exe_folder}\" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters