Skip to content

CI: retry dependency downloads and stabilize the quoted deadlock fixture #145

CI: retry dependency downloads and stabilize the quoted deadlock fixture

CI: retry dependency downloads and stabilize the quoted deadlock fixture #145

name: Azure SQL Database smoke test
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
# Also after the merge. A pull request from a fork never gets these secrets --
# GitHub withholds them, which is what stops a fork's code from reading the
# password -- so this job is skipped there and a fork's change would otherwise
# reach dev with no Azure coverage at all. Running on dev catches that within
# minutes of it landing. After the fact, but it is the only option that does
# not involve handing credentials to unreviewed code.
push:
branches: [dev]
# One at a time. The target is a single shared Azure SQL Database, and this
# installs procedures into it; concurrent runs would overwrite each other
# mid-test. Queue rather than cancel, so a run already talking to the database
# is allowed to finish.
concurrency:
group: azure-sql-smoke-test
cancel-in-progress: false
permissions:
contents: read
jobs:
azure-smoke-test:
name: Azure SQL Database
runs-on: ubuntu-22.04
# Generous: serverless Azure SQL DB auto-pauses, and waking it can take
# several minutes before the first successful connection.
timeout-minutes: 30
# Skipped rather than failed on forks, where secrets are not available.
# A missing secret would otherwise look like a broken Azure database.
#
# The push half matters: on a push there is no pull_request in the event, so
# the fork test alone would be comparing against nothing and would skip every
# dev run -- making the trigger above a no-op.
if: >-
github.event_name == 'push'
|| github.event.pull_request.head.repo.full_name == github.repository
env:
AZURE_SQL_SERVER: ${{ secrets.AZURE_SQL_SERVER }}
AZURE_SQL_DATABASE: ${{ secrets.AZURE_SQL_DATABASE }}
AZURE_SQL_USER: ${{ secrets.AZURE_SQL_USER }}
AZURE_SQL_PASSWORD: ${{ secrets.AZURE_SQL_PASSWORD }}
steps:
- name: Check out repository
uses: actions/checkout@v5
- name: Confirm the Azure credentials are present
run: |
missing=""
[[ -n "$AZURE_SQL_SERVER" ]] || missing+="AZURE_SQL_SERVER "
[[ -n "$AZURE_SQL_DATABASE" ]] || missing+="AZURE_SQL_DATABASE "
[[ -n "$AZURE_SQL_USER" ]] || missing+="AZURE_SQL_USER "
[[ -n "$AZURE_SQL_PASSWORD" ]] || missing+="AZURE_SQL_PASSWORD "
if [[ -n "$missing" ]]; then
echo "::error::Missing repository secrets: $missing"
echo "::error::Set them under Settings -> Secrets and variables -> Actions."
exit 1
fi
echo "All four Azure secrets are present."
- name: Install sqlcmd
run: |
curl -sSL -O https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
sudo env ACCEPT_EULA=Y apt-get install -y mssql-tools18 unixodbc-dev
echo "/opt/mssql-tools18/bin" >> "$GITHUB_PATH"
- name: Install and run sp_Blitz on Azure SQL Database
run: bash .github/scripts/run-azure-smoke-test.sh