Skip to content

Commit

Permalink
feat: add codecv0 and codecv1 (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
colinlyguo authored May 7, 2024
1 parent 0e5bf18 commit 1674090
Show file tree
Hide file tree
Showing 21 changed files with 28,891 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
### Purpose or design rationale of this PR

*Describe your change. Make sure to answer these three questions: What does this PR do? Why does it do it? How does it do it?*


### PR title

Your PR title must follow [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/#summary) (as we are doing squash merge for each PR), so it must start with one of the following [types](https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#type):

- [ ] build: Changes that affect the build system or external dependencies (example scopes: yarn, eslint, typescript)
- [ ] ci: Changes to our CI configuration files and scripts (example scopes: vercel, github, cypress)
- [ ] docs: Documentation-only changes
- [ ] feat: A new feature
- [ ] fix: A bug fix
- [ ] perf: A code change that improves performance
- [ ] refactor: A code change that doesn't fix a bug, or add a feature, or improves performance
- [ ] style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
- [ ] test: Adding missing tests or correcting existing tests


### Breaking change label

Does this PR have the `breaking-change` label?

- [ ] No, this PR is not a breaking change
- [ ] Yes
62 changes: 62 additions & 0 deletions .github/workflows/codec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: codec

on:
push:
branches:
- main
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review

jobs:
check:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.20.x
- name: Checkout code
uses: actions/checkout@v2
- name: Lint
run: |
rm -rf $HOME/.cache/golangci-lint
make lint
goimports-lint:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.20.x
- name: Checkout code
uses: actions/checkout@v2
- name: Install goimports
run: go install golang.org/x/tools/cmd/goimports@latest
- run: goimports -local github.com/scroll-tech/da-codec/encoding/ -w .
- run: go mod tidy
# If there are any diffs from goimports or go mod tidy, fail.
- name: Verify no changes from goimports and go mod tidy
run: |
if [ -n "$(git status --porcelain)" ]; then
exit 1
fi
tests:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.20.x
- name: Checkout code
uses: actions/checkout@v2
- name: Test codec packages
working-directory: '.'
run: |
make test
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,22 @@

# Go workspace file
go.work

# Built binaries
build/bin

coverage.txt
*.integration.txt

# Visual Studio Code
.vscode

# IntelliJ
.idea

# MacOS
.DS_Store

# misc
sftp-config.json
*~
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.PHONY: fmt lint test

lint:
GOBIN=$(PWD)/build/bin go run ./build/lint.go

fmt:
go mod tidy
goimports -w .
gofumpt -l -w .

test:
go test -v -race -gcflags="-l" -ldflags="-s=false" -coverprofile=coverage.txt -covermode=atomic ./...
Loading

0 comments on commit 1674090

Please sign in to comment.