Nightly code check #544
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 code check | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 2 * * *' # 2 am UTC every day | |
jobs: | |
code-check: | |
uses: ./.github/workflows/code-check.yml | |
tests: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false # finish all jobs even if one fails | |
max-parallel: 2 | |
matrix: | |
os: ['macos-13', 'windows-latest', 'ubuntu-latest'] | |
go-version: ['1.16', '1.17', '1.18', '1.19'] | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Install go tools | |
run: go get golang.org/x/tools/cmd/cover | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.9" | |
- name: Setup database and engine | |
id: setup | |
uses: firebolt-db/integration-testing-setup@v1 | |
with: | |
firebolt-username: ${{ secrets.FIREBOLT_STG_USERNAME }} | |
firebolt-password: ${{ secrets.FIREBOLT_STG_PASSWORD }} | |
api-endpoint: "api.staging.firebolt.io" | |
region: "us-east-1" | |
instance-type: "B2" | |
- name: Run integration tests | |
env: | |
USER_NAME: ${{ secrets.FIREBOLT_STG_USERNAME }} | |
PASSWORD: ${{ secrets.FIREBOLT_STG_PASSWORD }} | |
DATABASE_NAME: ${{ steps.setup.outputs.database_name }} | |
ENGINE_NAME: ${{ steps.setup.outputs.engine_name }} | |
ENGINE_URL: ${{ steps.setup.outputs.engine_url }} | |
STOPPED_ENGINE_NAME: ${{ steps.setup.outputs.stopped_engine_name }} | |
STOPPED_ENGINE_URL: ${{ steps.setup.outputs.stopped_engine_url }} | |
FIREBOLT_ENDPOINT: "api.staging.firebolt.io" | |
ACCOUNT_NAME: "firebolt" | |
SERVICE_ACCOUNT_CLIENT_ID: ${{ secrets.FIREBOLT_CLIENT_ID_STAGING }} | |
SERVICE_ACCOUNT_CLIENT_SECRET: ${{ secrets.FIREBOLT_CLIENT_SECRET_STAGING }} | |
LONG_TEST_VALUE: ${{ vars.LONG_TEST_VALUE }} | |
run: | | |
go test . -timeout=30m -v -coverprofile cover.out --tags=integration_v0 | |
- name: Extract coverage percent | |
id: coverage | |
continue-on-error: true | |
run: | | |
percentage=$(go tool cover -func=cover.out | tail -n 1 | awk '{print $3}' | awk -F'%' '{ print $1 }') | |
percentage_whole=$(echo "${percentage%.*}") | |
colour=$(if [ $percentage_whole -ge 80 ]; then echo "green"; else echo "orange"; fi) | |
echo "colour=$colour" >> $GITHUB_OUTPUT | |
echo "covered=$percentage_whole" >> $GITHUB_OUTPUT | |
- name: Create Coverage Badge | |
uses: schneegans/[email protected] | |
continue-on-error: true | |
with: | |
auth: ${{ secrets.GIST_PAT }} | |
gistID: 764079ffbd558d515e250e6528179824 | |
filename: firebolt-go-sdk-coverage.json | |
label: Coverage | |
message: ${{steps.coverage.outputs.covered}}% | |
color: ${{steps.coverage.outputs.colour}} | |
- name: Slack Notify of failure | |
if: failure() | |
id: slack | |
uses: firebolt-db/action-slack-nightly-notify@v1 | |
with: | |
os: ${{ matrix.os }} | |
programming-language: GO | |
language-version: ${{ matrix.go-version }} | |
notifications-channel: 'ecosystem-ci-notifications' | |
slack-api-key: ${{ secrets.SLACK_BOT_TOKEN }} |