use github action

This commit is contained in:
rsteube 2022-01-28 01:07:31 +01:00
parent e667d4e713
commit eec5236b39
6 changed files with 75 additions and 87 deletions

View File

@ -1,84 +0,0 @@
version: 2.1
workflows:
main:
jobs:
- build:
filters:
tags:
ignore: /.*/
- doc:
filters:
branches:
only: /master/
tags:
ignore: /.*/
tags:
jobs:
- release:
# Only run this job on git tag pushes
filters:
branches:
ignore: /.*/
tags:
only: /v[0-9]+(\.[0-9]+)*(-.*)*/
commands:
run_tests:
steps:
- run:
name: "build"
command: |
go generate ./...
go get -t -v ./...
PATH=$PATH:$PWD/bin go test -v ./...
cd cmd/carapace
go build
go vet
jobs:
build:
docker:
- image: circleci/golang:latest
environment:
GO111MODULE: "on"
steps:
- checkout
- run_tests
- run:
name: "Check formatting"
command: diff -u <(echo -n) <(gofmt -d -s .)
- run:
name: "staticcheck"
command: go install honnef.co/go/tools/cmd/staticcheck@2021.1.1 && staticcheck ./...
- run:
name: "caralint"
command: go run ./cmd/caralint completers/*/cmd/*.go
doc:
docker:
- image: ghcr.io/rsteube/carapace
steps:
- checkout
- run:
name: "build docs"
command: |
sed -i 's/\[output.linkcheck\]/#[output.linkcheck]/' docs/book.toml
sh .circleci/completers.sh > docs/src/completers.md
mdbook build docs
sh .circleci/badge.sh > docs/book/badge.svg
- run:
name: "push gh-pages"
command: |
cd docs/book/
git init
git config user.name rsteube
git config user.email rsteube@users.noreply.github.com
git add .
git commit -m "initial commit [ci skip]"
git push --force https://rsteube:${GITHUB_TOKEN}@github.com/rsteube/carapace-bin.git master:gh-pages
release:
docker:
- image: circleci/golang:latest
steps:
- checkout
- run: AUR_KEY=$(echo $AUR_KEY | base64 -d)
- run: cd cmd/carapace && go generate ./... && curl -sL https://git.io/goreleaser | bash

70
.github/workflows/go.yml vendored Normal file
View File

@ -0,0 +1,70 @@
name: Go
on:
pull_request:
push:
jobs:
build:
runs-on: ubuntu-latest
container: ghcr.io/rsteube/carapace
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Generate
run: go generate ./cmd/...
- name: Build
run: go build -v ./cmd/...
- 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@2021.1.1 && staticcheck ./...
- name: "caralint"
run: go run ./cmd/caralint completers/*/cmd/*.go
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
if: startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AUR_KEY: ${{ secrets.AUR_KEY }}
GORELEASER_GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
doc:
runs-on: ubuntu-latest
container: ghcr.io/rsteube/carapace
steps:
- uses: actions/checkout@v2
- name: "build docs"
run: |
sed -i 's/\[output.linkcheck\]/#[output.linkcheck]/' docs/book.toml
sh .github/completers.sh > docs/src/completers.md
mdbook build docs
sh .github/badge.sh > docs/book/badge.svg
- 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 rsteube@users.noreply.github.com
git add .
git commit -m "initial commit [ci skip]"
git push --force https://rsteube:${GITHUB_TOKEN}@github.com/rsteube/carapace-bin.git master:gh-pages

6
.gitignore vendored
View File

@ -1,8 +1,8 @@
completers_release
completers/*/*_completer
cmd/carapace/carapace
cmd/carapace/dist
cmd/carapace/cmd/completers.go
cmd/carapace/cmd/completers_release.go
cmd/caraparse/caraparse
completers/*/*_completer
completers_release
dist
docs/book

View File

@ -1,6 +1,7 @@
before:
hooks:
- go mod download
- go generate ./cmd/...
builds:
- env:
- CGO_ENABLED=0
@ -8,6 +9,7 @@ builds:
- linux
- windows
- darwin
main: ./cmd/carapace
binary: carapace
tags:
- release