Skip to content

Commit

Permalink
chore(ci): replace drone with git actions
Browse files Browse the repository at this point in the history
  • Loading branch information
rafi committed Sep 24, 2024
1 parent 3452ff8 commit d83676e
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 122 deletions.
120 changes: 0 additions & 120 deletions .drone.yml

This file was deleted.

32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Gits release workflow

on:
push:
tags:
- "*"

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Fetch Git tags
run: git fetch --force --prune --tags

- name: Build and Release
run: |
docker run \
--rm \
--privileged \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(pwd)/sysroot:/sysroot \
-v $(pwd):/go/src/${PKG_NAME} \
-w /go/src/${PKG_NAME} \
-e CGO_ENABLED=0 \
-e GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} \
ghcr.io/goreleaser/goreleaser-cross:v${GO_VERSION} \
release --clean
32 changes: 32 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Gits test workflow

on:
push:
branches: ["master", "next"]
pull_request:
branches: ["master", "next"]

jobs:
test:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: stable
- name: Unit-tests
run: make test-unit

golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: stable
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ Thumbs.db
Desktop.ini
/bin/
/.cache/
/dist/
/vendor/
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ linters:
- gci
- gofumpt
- gosec
- scopelint
enable:
- gosimple
- misspell
Expand Down
33 changes: 33 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

version: 2

before:
hooks:
- go mod tidy

builds:
- env:
- CGO_ENABLED=0
main: ./cmd/gits
goos:
- linux
- darwin

archives:
- format: tar.gz
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
2 changes: 1 addition & 1 deletion internal/cache/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func (cf *File) Save(key string, project domain.Project) error {
}
defer fp.Close()

_, err = io.WriteString(fp, string(cacheRaw))
_, err = fp.Write(cacheRaw)
if err != nil {
return fmt.Errorf("failed to read cache file: %w", err)
}
Expand Down

0 comments on commit d83676e

Please sign in to comment.