Skip to content

Commit

Permalink
Add a simple CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Y0sh1dk committed Dec 10, 2023
1 parent 7a8e906 commit 29ad73e
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 3 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CI

on:
push:
branches:
- main
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Install Task
uses: arduino/setup-task@v1

- name: Check go fmt
run: |
task check-format
- name: Check linting
run: |
task lint
build:
needs: [lint]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Install Task
uses: arduino/setup-task@v1

- name: Build Binary
run: |
task build
- uses: stefanzweifel/git-auto-commit-action@v5
if: github.event_name == 'pull_request'
with:
commit_message: Update compiled binaries
file_pattern: "bin/*"
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
linters:
enable-all: true
fast: false
10 changes: 8 additions & 2 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ tasks:
golang:{{ .GO_VERSION }} \
{{ .COMMAND }}
compile:
build:
<<: *go-docker
desc: Compile the application
desc: Build the application
vars:
COMMAND: go build -o bin/{{ .GIT_REPO_NAME }} *.go

Expand All @@ -48,6 +48,12 @@ tasks:
vars:
COMMAND: go fmt ./...

check-format:
<<: *go-docker
desc: Format the application
vars:
COMMAND: bash -c 'if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi'

lint:
desc: Lint the application
deps:
Expand Down

0 comments on commit 29ad73e

Please sign in to comment.