Skip to content

Force Github Action to fail if command in ssh fails #5376

Force Github Action to fail if command in ssh fails

Force Github Action to fail if command in ssh fails #5376

Workflow file for this run

name: Go
on:
push:
branches: [main]
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "1.21.0"
- name: Run golangci-lint
uses: golangci/[email protected]
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.54.2
args: --timeout 3m0s --verbose --modules-download-mode readonly
- name: Run staticcheck # see: staticcheck.io
uses: dominikh/[email protected]
with:
version: "2023.1.2"
install-go: false
min-go-version: 1.21
- uses: ./.github/actions/mkcert
- name: Build
run: go build -v ./...
- name: Test
run: go test ./... -count=2 -shuffle=on -timeout 1m -v -failfast
- name: Check for race conditions
# Only executes when triggered by a push to the main branch
if: ${{ github.ref_name == 'main' }}
run: go test ./... -timeout 4m -v -failfast -race
- name: Archive logs
if: always()
uses: actions/upload-artifact@v2
with:
name: integration-test-logs
path: ./**/*.log
- name: Tidy
run: go mod tidy
- name: check git tree is clean
# This will fail the job if any previous step (re)generated a file
# that doesn't match what you checked in (or forgot to check in)
run: git diff --exit-code
- name: Notify slack fail
if: ${{ failure() && github.ref == 'refs/heads/main'}}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }}
uses: voxmedia/github-action-slack-notify-build@v1
with:
channel_id: C03G4AUGA7M
status: FAILED
color: danger