Nightly Build #289
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
name: Nightly Build | |
on: | |
schedule: | |
- cron: '0 10 * * *' # Run every day at 10AM UTC | |
jobs: | |
run-linting-and-unit-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.21.x | |
- name: Run linting | |
id: update | |
run: | | |
make prepare | |
make lint | |
make fmt-check | |
make imports-check | |
- name: Run unit tests | |
run: | | |
make coverage-ci | |
# TODO Display test report | |
- name: Notify Slack on Failure | |
uses: slackapi/[email protected] | |
if: failure() | |
with: | |
payload: | | |
{ | |
"attachments": [ | |
{ | |
"color": "#E92020", | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "@oncall-growth-eng! There has been a failure that needs your attention. :rotating_light:\n*GitHub Workflow Failure*\ngo-sdk/nightly-build\n*Workflow Run*\n https://github.com/lacework/go-sdk/actions/runs/${{ github.run_id }}" | |
} | |
} | |
] | |
} | |
] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_GROWTH_ENG_ALERTS }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | |
run-integration-tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# To run integration tests with different tags in parallel | |
index: [0, 1, 2, 3, 4] | |
steps: | |
# To wait for the existing nightly-build run to complete to avoid running same integration tests at the same time | |
- name: Turnstyle | |
uses: softprops/turnstyle@v1 | |
with: | |
same-branch-only: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN }} | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.21.x | |
- name: Build cross-platform binaries | |
run: | | |
make prepare | |
make build | |
- name: Run integration tests | |
env: | |
CI_ACCOUNT: ${{ secrets.CI_ACCOUNT }} | |
CI_SUBACCOUNT: ${{ secrets.CI_SUBACCOUNT }} | |
CI_API_KEY: ${{ secrets.CI_API_KEY }} | |
CI_API_SECRET: ${{ secrets.CI_API_SECRET }} | |
LW_INT_TEST_AWS_ACC: ${{ secrets.LW_INT_TEST_AWS_ACC }} | |
LW_CLI_BIN: lacework | |
run: | | |
make integration-only-subset index=${{ matrix.index }} | |
- name: Notify Slack on Failure | |
uses: slackapi/[email protected] | |
if: failure() | |
with: | |
payload: | | |
{ | |
"attachments": [ | |
{ | |
"color": "#E92020", | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "@oncall-growth-eng! There has been a failure that needs your attention. :rotating_light:\n*GitHub Workflow Failure*\ngo-sdk/nightly-build\n*Workflow Run*\n https://github.com/lacework/go-sdk/actions/runs/${{ github.run_id }}" | |
} | |
} | |
] | |
} | |
] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_GROWTH_ENG_ALERTS }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK |