Skip to content

arrr

arrr #9124

Workflow file for this run

name: Go
on:
pull_request:
push:
jobs:
build:
runs-on: ubuntu-latest
container: ghcr.io/carapace-sh/go:1.23.1
steps:
- name: shallow clone
uses: actions/checkout@v4
if: "!startsWith(github.ref, 'refs/tags/')"
- name: deep clone
uses: actions/checkout@v4
if: startsWith(github.ref, 'refs/tags/')
with:
fetch-depth: 0
- name: fix git safe.directory
run: git config --global --add safe.directory '*'
- name: Generate
run: go generate ./cmd/...
- name: Build
run: ls cmd/ | xargs -I'{}' sh -c "cd ./cmd/{} && go build -v ."
- uses: actions/upload-artifact@v4
with:
name: carapace
path: ./cmd/carapace/carapace
retention-days: 1
- name: Test
run: go test -v ./cmd/...
- name: "Check formatting"
run: '[ "$(gofmt -d -s . | tee -a /dev/stderr)" = "" ]'
- name: "staticcheck"
run: go install honnef.co/go/tools/cmd/staticcheck@latest && staticcheck ./...
- name: "carapace-lint"
run: go run ./cmd/carapace-lint completers/*/cmd/*.go
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
if: startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AUR_KEY: ${{ secrets.AUR_KEY }}
FURY_TOKEN: ${{ secrets.FURY_TOKEN }}
GORELEASER_GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
doc:
runs-on: ubuntu-latest
container: ghcr.io/carapace-sh/carapace
needs: build
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: carapace
path: ./cmd/carapace
- name: Cache linkcheck
uses: actions/cache@v3
with:
path: ./docs/book/linkcheck/cache.json
- name: "build docs"
run: |
chmod +x cmd/carapace/carapace
sed -i 's/\[output.linkcheck\]/#[output.linkcheck]/' docs/book.toml
sh .github/completers.sh > docs/src/completers.md
sh .github/conditions.sh > docs/src/variable/conditions.md
sh .github/macros.sh > docs/src/spec/macros.md
mdbook build docs
sh .github/badge.sh > docs/book/badge.svg
sh .github/macros-badge.sh > docs/book/macros-badge.svg
sh docs/postprocessor/opengraph.sh
- name: "push gh-pages"
if: github.ref == 'refs/heads/master'
run: |
cd docs/book/
git init
git config user.name rsteube
git config user.email [email protected]
git add .
git commit -m "initial commit [ci skip]"
git push --force https://rsteube:${GITHUB_TOKEN}@github.com/carapace-sh/carapace-bin.git master:gh-pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
winget:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: build
steps:
- uses: vedantmgoyal2009/winget-releaser@v2
with:
identifier: rsteube.Carapace
max-versions-to-keep: 5
installers-regex: '_windows_amd64\.zip$'
fork-user: rsteube-bot
token: ${{ secrets.WINGET_TOKEN }}