vendor ssh #222
Workflow file for this run
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: | |
| pull_request: | |
| branches: [main] | |
| types: [opened, reopened, synchronize] | |
| push: | |
| branches: [main] | |
| env: | |
| GO_VERSION: "1.24" | |
| jobs: | |
| test: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Run unit tests (Linux) | |
| if: runner.os != 'Windows' | |
| run: make test | |
| - name: Run unit tests (Windows) | |
| if: runner.os == 'Windows' | |
| shell: bash | |
| run: go test -tags mcp ./cmd/... ./internal/... -v | |
| - name: Run go vet | |
| run: go vet ./... | |
| - name: Run go fmt check (Linux only) | |
| if: runner.os != 'Windows' | |
| run: | | |
| if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then | |
| echo "The following files are not formatted:" | |
| gofmt -s -l . | |
| exit 1 | |
| fi | |
| build-test: | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| binary: ./bin/vers | |
| - os: macos-latest | |
| binary: ./bin/vers | |
| - os: windows-latest | |
| binary: ./bin/vers.exe | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Build binary | |
| shell: bash | |
| run: | | |
| if [ "$RUNNER_OS" == "Windows" ]; then | |
| CGO_ENABLED=0 go build -ldflags "-s -w" -o bin/vers.exe ./cmd/vers | |
| else | |
| make build | |
| fi | |
| - name: Test binary | |
| shell: bash | |
| run: | | |
| ${{ matrix.binary }} --version | |
| ${{ matrix.binary }} --help | |
| integration-tests: | |
| if: github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| env: | |
| VERS_URL: ${{ secrets.VERS_URL }} | |
| VERS_API_KEY: ${{ secrets.VERS_API_KEY }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: ${{ env.GO_VERSION }} | |
| - name: Run integration tests | |
| run: make test-integration |