CI #1
This file contains hidden or 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: CI | |
on: | |
push: | |
branches: [ main, master ] | |
pull_request: | |
branches: [ main, master ] | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
description: 'Enable debug mode' | |
required: false | |
default: 'false' | |
type: boolean | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: Print workflow trigger info | |
run: | | |
echo "Workflow triggered by: ${{ github.event_name }}" | |
echo "Branch: ${{ github.ref_name }}" | |
echo "Debug mode: ${{ github.event.inputs.debug_enabled }}" | |
- name: Get dependencies | |
run: go mod download | |
- name: Verify dependencies | |
run: go mod verify | |
- name: Build | |
run: go build -v ssh.go | |
- name: Run go vet | |
run: go vet ssh.go | |
- name: Run tests | |
run: go test -v ./... || echo "No tests found" | |
- name: Debug information | |
if: ${{ github.event.inputs.debug_enabled == 'true' }} | |
run: | | |
echo "=== Debug Information ===" | |
echo "Go version: $(go version)" | |
echo "Current directory: $(pwd)" | |
echo "Files in directory:" | |
ls -la | |
echo "Go modules:" | |
go list -m all | |
echo "Environment variables:" | |
env | grep -E "(GO|PATH)" | sort | |
- name: Run staticcheck | |
uses: dominikh/staticcheck-action@v1.3.0 | |
with: | |
version: "2023.1.6" | |
install-go: false |