CI #527
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 | |
| permissions: {} | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| merge_group: | |
| types: | |
| - checks_requested | |
| jobs: | |
| lint: | |
| timeout-minutes: 10 | |
| name: lint | |
| permissions: | |
| contents: read | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | |
| with: | |
| persist-credentials: false | |
| - uses: ./.github/actions/setup-go | |
| - name: Run lints | |
| run: ./scripts/lint | |
| build-artifacts: | |
| timeout-minutes: 10 | |
| name: build artifacts | |
| permissions: | |
| contents: read | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | |
| with: | |
| persist-credentials: false | |
| - uses: ./.github/actions/setup-go | |
| - name: Test vulnerability scan coverage | |
| run: ./scripts/govulncheck-test | |
| - name: Check shipped CLI for reachable vulnerabilities | |
| run: ./scripts/govulncheck | |
| - name: Test verified GoReleaser installer | |
| run: ./scripts/test-goreleaser-installer | |
| - name: Set up verified GoReleaser | |
| id: goreleaser | |
| uses: ./.github/actions/setup-goreleaser | |
| - name: Generate release inputs | |
| run: | | |
| mkdir -p completions | |
| go run ./cmd/openai/main.go @completion bash > completions/openai.bash | |
| go run ./cmd/openai/main.go @completion zsh > completions/openai.zsh | |
| go run ./cmd/openai/main.go @completion fish > completions/openai.fish | |
| go run ./cmd/openai/main.go @manpages -o man | |
| for directory in completions man man/man1; do | |
| [[ -d "$directory" && ! -L "$directory" ]] || exit 1 | |
| done | |
| for path in completions/openai.bash completions/openai.zsh completions/openai.fish man/man1/openai.1.gz; do | |
| [[ -f "$path" && ! -L "$path" ]] || exit 1 | |
| size="$(wc -c < "$path")" | |
| [[ "$size" -gt 0 && "$size" -le 10485760 ]] || exit 1 | |
| done | |
| exclude_file="$(git rev-parse --git-path info/exclude)" | |
| printf '%s\n' \ | |
| '/completions/openai.bash' \ | |
| '/completions/openai.zsh' \ | |
| '/completions/openai.fish' \ | |
| '/man/man1/openai.1.gz' \ | |
| >> "$exclude_file" | |
| - name: Run GoReleaser | |
| run: | | |
| "$GORELEASER_EXECUTABLE" release --snapshot --clean --skip=publish | |
| env: | |
| GORELEASER_EXECUTABLE: ${{ steps.goreleaser.outputs.executable }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| build: | |
| timeout-minutes: 10 | |
| name: build | |
| needs: | |
| - build-artifacts | |
| if: always() | |
| permissions: {} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Require successful build | |
| env: | |
| BUILD_RESULT: ${{ needs.build-artifacts.result }} | |
| run: | | |
| if [[ "$BUILD_RESULT" != "success" ]]; then | |
| echo "Build artifacts failed: $BUILD_RESULT" | |
| exit 1 | |
| fi | |
| test: | |
| timeout-minutes: 10 | |
| name: test | |
| permissions: | |
| contents: read | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | |
| with: | |
| persist-credentials: false | |
| - uses: ./.github/actions/setup-go | |
| - name: Run tests | |
| run: ./scripts/test |