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

feat: switch to WASM module #4

Merged
merged 1 commit into from
Oct 22, 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
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: gomod
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
on:
push:
tags:
- '*'

name: release
jobs:
release:

runs-on: ubuntu-latest
env:
GO_VERSION: "1.21"

steps:
- name: Install Go
if: success()
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

- name: Checkout code
uses: actions/checkout@v4

- name: Cache Go modules
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40 changes: 40 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
on:
push:
branches:
- main
pull_request:

name: run tests
jobs:
test:

runs-on: ubuntu-latest
env:
GOOS: js
GOARCH: wasm
GO_VERSION: "1.21"
GOLANGCI_LINT_VERSION: v1.55.0

steps:
- name: Install Go
if: success()
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

- name: Checkout code
uses: actions/checkout@v4

- name: Cache Go modules
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-

- name: Run linter
uses: golangci/golangci-lint-action@v3
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}
skip-pkg-cache: true
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/vendor/*
!/vendor/modules.txt
/dist
36 changes: 22 additions & 14 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,51 @@
run:
tests: false
timeout: 5m
deadline: 5m

linters-settings:
cyclop:
max-complexity: 20
skip-tests: true
funlen:
lines: 80
gofumpt:
extra-rules: true

linters:
enable-all: true
disable:
- interfacebloat
- sqlclosecheck # not relevant (SQL)
- rowserrcheck # not relevant (SQL)
- execinquery # not relevant (SQL)
- interfacer # deprecated
- scopelint # deprecated
- maligned # deprecated
- golint # deprecated
- durationcheck
- deadcode # deprecated
- exhaustivestruct # deprecated
- ifshort # deprecated
- nosnakecase # deprecated
- structcheck # deprecated
- varcheck # deprecated
- cyclop # duplicate of gocyclo
- depguard
- exhaustive
- exhaustivestruct
- exhaustruct
- forcetypeassert
- funlen
- gochecknoglobals
- gochecknoinits
- gocognit
- gocyclo
- goerr113
- gomnd
- ireturn
- nestif
- nlreturn
- nilerr
- noctx
- nonamedreturns
- tagliatelle
- varnamelen
- wrapcheck
- wsl

issues:
exclude-use-default: false
exclude:
- 'ST1000: at least one file in a package should have a package comment'
exclude-rules:
- path: module/client.go
linters:
- noctx
- 'package-comments: should have a package comment'
35 changes: 35 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
project_name: calendar
dist: dist

gomod:
proxy: true

builds:
- main: ./
binary: "{{ .ProjectName }}"
goos:
- js
goarch:
- wasm
env:
- CGO_ENABLED=0

archives:
- format: binary
name_template: '{{ .Binary }}'

changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^doc:'
- '^tests:'
- '^test:'
- '^chore:'

checksum:
name_template: '{{ .ProjectName }}_checksums.txt'

snapshot:
name_template: "{{ .Tag }}"
36 changes: 36 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
GOOS=js
GOARCH=wasm

export GOOS
export GOARCH

# Format all files
fmt:
@echo "==> Formatting source"
@gofmt -s -w $(shell find . -type f -name '*.go' -not -path "./vendor/*")
@echo "==> Done"
.PHONY: fmt

# Tidy the go.mod file
tidy:
@echo "==> Cleaning go.mod"
@go mod tidy
@echo "==> Done"
.PHONY: tidy

# Lint the project
lint:
@echo "==> Linting Go files"
@golangci-lint run ./...
.PHONY: lint

# Run all tests
test:
@go test -cover ./...
.PHONY: test

# Build the commands
build:
@goreleaser release --clean --snapshot
.PHONY: build

6 changes: 5 additions & 1 deletion assets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
text-align: left;
}

.calendar table {
font-size: inherit;
}

.calendar .time {
color: #fff;
font-family: "Roboto Condensed", sans-serif;
Expand All @@ -10,7 +14,7 @@
}

.calendar .time::after {
content: "\\00B7";
content: "·";
font-family: "Roboto Condensed", sans-serif;
font-weight: 400;
}
Expand Down
Loading
Loading