update anx-prod from upstream #60
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
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] | |
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-latest | |
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 }} | |
CGO_LDFLAGS: "-Xlinker -rpath=/lib/x86_64-linux-gnu" | |
steps: | |
- uses: actions/checkout@v3 | |
# Install ca-certificates package and update certificates | |
- name: Update CA certificates | |
run: | | |
apt-get update | |
apt-get install -y ca-certificates | |
update-ca-certificates | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.21 | |
- name: Build | |
run: go build -buildvcs=false . | |
- 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 |