Workflow file for this run
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: Run .NET tests and Lint Dockerfile | ||
on: | ||
pull_request: | ||
types: [assigned, opened, synchronize, reopened] | ||
jobs: | ||
test_dot_net: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: Azure/login@v1 | ||
with: | ||
creds: ${{ secrets.AZURE_CREDENTIALS }} | ||
- name: Fetch secrets from key vault | ||
uses: azure/CLI@v1 | ||
id: fetch-secrets | ||
with: | ||
inlineScript: | | ||
SECRET_VALUE=$(az keyvault secret show --name "SLACK-WEBHOOK" --vault-name "${{ secrets.INFRA_KEY_VAULT}}" --query "value" -o tsv) | ||
echo "::add-mask::$SECRET_VALUE" | ||
echo "SLACK-WEBHOOK=$SECRET_VALUE" >> $GITHUB_OUTPUT | ||
- name: set-up-environment | ||
uses: DFE-Digital/github-actions/set-up-environment@master | ||
- name: Setup .NET Core | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: '7.0' | ||
- name: Install dependencies | ||
run: dotnet restore | ||
- name: Build | ||
run: dotnet build --configuration Release --no-restore /warnaserror | ||
- name: Spin Up Stack | ||
run: docker-compose up -d | ||
- name: Test | ||
run: dotnet test --no-restore --verbosity normal | ||
- name: Lint Dockerfile | ||
uses: brpaz/hadolint-action@master | ||
with: | ||
dockerfile: "Dockerfile" | ||
- name: Slack Notification | ||
if: failure() && github.ref == 'refs/heads/master' | ||
uses: rtCamp/action-slack-notify@master | ||
env: | ||
SLACK_COLOR: ${{env.SLACK_FAILURE }} | ||
SLACK_MESSAGE: Pipeline Failure carrying out job ${{github.job}} | ||
SLACK_TITLE: 'Failure: ${{ github.workflow }}' | ||
SLACK_WEBHOOK: ${{ steps.fetch-secrets.outputs.SLACK-WEBHOOK }} |