Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create task #19

Merged
merged 14 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/format.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Format
on:
pull_request:
push:
branches:
- main
tags:
- v*

jobs:
fmt:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4

- name: fmt
run: make fmt

lint:
runs-on: ubuntu-latest
env:
GOPRIVATE: ${{ inputs.go-private }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
cache: true

- name: Lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: --timeout=3m

vet:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4

- name: vet
run: make vet
24 changes: 24 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Go Test
on:
pull_request:
push:
branches:
- main
tags:
- v*

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
cache: true

- name: Test
run: make test
32 changes: 24 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
# Generated by Cargo
# will have compiled files and executables
/target/
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock
# Test binary, built with `go test -c`
*.test

# These are backup files generated by rustfmt
**/*.rs.bk
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
coverage.html
*.tx

# Dependency directories (remove the comment below to include it)
# vendor/

# Go workspace file
go.work

# IDEs
.idea/
30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.PHONY: build

tidy:
go mod tidy

generate:
buf generate

fmt:
go fmt ./...

vet:
go vet -v ./...

lint:
buf lint
golangci-lint -v run

build:
go build

test:
go test -race -covermode=atomic -coverprofile=coverage.tx -v ./...
go tool cover -func=coverage.tx -o=coverage.out

test-html:
go test -race -covermode=atomic -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o=coverage.html

all: generate tidy fmt vet lint test
77 changes: 77 additions & 0 deletions api/api.swagger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
swagger: "2.0"
info:
title: api/tasks/v1/tasks.proto
version: version not set
tags:
- name: TasksService
consumes:
- application/json
produces:
- application/json
paths:
/v1/tasks:
post:
summary: CreateTask creates a Task.
operationId: TasksService_CreateTask
responses:
"200":
description: A successful response.
schema:
$ref: '#/definitions/v1Task'
default:
description: An unexpected error response.
schema:
$ref: '#/definitions/rpcStatus'
parameters:
- name: task
description: Task is the the task to create.
in: body
required: true
schema:
$ref: '#/definitions/v1Task'
required:
- task
tags:
- TasksService
definitions:
protobufAny:
type: object
properties:
'@type':
type: string
additionalProperties: {}
rpcStatus:
type: object
properties:
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
$ref: '#/definitions/protobufAny'
v1Task:
type: object
properties:
id:
type: string
format: int64
title:
type: string
description:
type: string
deadline:
type: string
format: date-time
completedAt:
type: string
format: date-time
createTime:
type: string
format: date-time
updateTime:
type: string
format: date-time
Loading
Loading