Skip to content

Commit

Permalink
Add linter and misspell and publish artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
empire committed Mar 26, 2021
1 parent 81cfb53 commit 96737a6
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 7 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: golangci-lint
on:
push:
tags:
- v*
branches:
- main
- test-actions
pull_request:
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v2
with:
go-version: ~1.16
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
skip-go-installation: true
21 changes: 21 additions & 0 deletions .github/workflows/misspell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: misspell
on:
push:
tags:
- v*
branches:
- master
- main
- test-actions
pull_request:
jobs:
misspell:
name: spellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: misspell
uses: reviewdog/action-misspell@v1
with:
github_token: ${{ secrets.github_token }}
locale: "US"
16 changes: 13 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,30 @@ jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Go
-
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16

- name: Run GoReleaser
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

-
name: Upload assets
uses: actions/upload-artifact@v2
with:
name: go-tse
path: dist/*
68 changes: 68 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
before:
hooks:
- go mod tidy
- go generate ./...

builds:
- main: ./cmd/tse-download/main.go
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
dockers:
-
goos: linux
goarch: amd64
goarm: ''

# Templates of the Docker image names.
image_templates:
- "empire/go-tse:latest"
- "empire/go-tse:{{ .Tag }}"
- "empire/go-tse:v{{ .Major }}"

# Skips the docker push. Could be useful if you also do draft releases.
# If set to auto, the release will not be pushed to the docker repository
# in case there is an indicator for prerelease in the tag e.g. v1.0.0-rc1
# Defaults to false.
skip_push: false

# Path to the Dockerfile (from the project root).
dockerfile: Dockerfile

# Whether to use `docker buildx build` instead of `docker build`.
# You probably want to set it to true when using flags like `--platform`.
# If true, will also add `--load` to the build flags.
# Defaults to false.
use_buildx: true

# Template of the docker build flags.
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--platform=linux/arm64"
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM scratch
ENTRYPOINT ["/go-tse"]
COPY go-tse /
File renamed without changes.
9 changes: 5 additions & 4 deletions tse.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ const (
)

func DownloadAll(path string) {
os.Mkdir("/tmp/symbols", 0755)
ids := make(chan string, 10)
if err := os.Mkdir("/tmp/symbols", 0755); !(err == nil || os.IsExist(err)) {
log.Fatal(err)
}
ids := make(chan string)
for i := 0; i < 10; i++ {
go download(ids)
}
Expand Down Expand Up @@ -87,6 +89,5 @@ func downloadFile(url, fileName string) error {
df = df.Rename(newName, oldName)
}
df = df.Drop([]string{"<PER>", "<OPEN>", "<TICKER>"})
df.WriteCSV(file)
return df.Err
return df.WriteCSV(file)
}

0 comments on commit 96737a6

Please sign in to comment.