Skip to content
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
36 changes: 18 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@ name: build
on: [push]

jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- name: git clone
uses: actions/checkout@v4
build:
name: build
runs-on: ubuntu-latest
steps:
- name: git clone
uses: actions/checkout@v4

- name: set up go
uses: actions/setup-go@v5
with:
go-version: 1.23.4
- name: set up go
uses: actions/setup-go@v5
with:
go-version: 1.24.0

- name: go build
run: go build -v
- name: go build
run: go build -v

- name: go test
run: go test -v -cover -coverpkg=./... -race ./...
- name: go test
run: go test -v -cover -coverpkg=./... -race ./...

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.63.4
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.63.4
52 changes: 25 additions & 27 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
name: publish

on:
release:
types: [created]
push:
tags:
- "*"

permissions:
contents: write

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: git clone
uses: actions/checkout@v4
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: set up go
uses: actions/setup-go@v5
with:
go-version: 1.23.4
- name: Unshallow repo
run: git fetch --prune --unshallow

- name: compile
run: |
echo "go version:"
go version
echo "go env:"
go env
bash material/scripts/buildall.sh
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.24.x

- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/gotz*
file_glob: true
tag: ${{ github.ref }}
overwrite: true
body: "gotz binaries"
- name: Run goreleaser
uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BREW_TOKEN: ${{ secrets.BREW_BUMP_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
gotz
gotz.exe
build/
dist/
31 changes: 31 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
builds:
- env:
- CGO_ENABLED=0
goos:
- freebsd
- windows
- darwin
- linux
goarch:
- amd64
- arm
- arm64
- "386"
ldflags:
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
checksum:
name_template: "checksums.txt"
changelog:
use: github-native
sort: asc
brews:
- name: gotz
homepage: "https://github.com/merschformann/gotz"
description: "A simple CLI timezone conversion assistant, written in Go"
repository:
owner: merschformann
name: gotz-brew
token: "{{ .Env.BREW_TOKEN }}"
commit_author:
name: merschbotmann
email: bot.merschformann@gmail.com
1 change: 1 addition & 0 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tabWidth: 2
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func main() {
}
}
// Parse flags
config, rt, changed, err := core.ParseFlags(config, Version)
config, rt, changed, err := core.ParseFlags(config, GetReleaseInfo().Version)
if err != nil {
fmt.Println("error parsing flags:", err)
os.Exit(1)
Expand Down
90 changes: 45 additions & 45 deletions tests/testdata/static_default.json
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
{
"config_version": "1.0",
"timezones": [
{
"Name": "New York",
"TZ": "America/New_York"
},
{
"Name": "Berlin",
"TZ": "Europe/Berlin"
},
{
"Name": "Shanghai",
"TZ": "Asia/Shanghai"
},
{
"Name": "Sydney",
"TZ": "Australia/Sydney"
}
],
"style": {
"symbols": "rectangles",
"colorize": false,
"day_segments": {
"morning": 6,
"day": 8,
"evening": 18,
"night": 22
},
"coloring": {
"StaticColorMorning": "red",
"StaticColorDay": "yellow",
"StaticColorEvening": "red",
"StaticColorNight": "blue",
"StaticColorForeground": "",
"DynamicColorMorning": "red",
"DynamicColorDay": "yellow",
"DynamicColorEvening": "red",
"DynamicColorNight": "blue",
"DynamicColorForeground": "",
"DynamicColorBackground": ""
}
"config_version": "1.0",
"timezones": [
{
"Name": "New York",
"TZ": "America/New_York"
},
"tics": false,
"stretch": true,
"hours12": false,
"live": false
{
"Name": "Berlin",
"TZ": "Europe/Berlin"
},
{
"Name": "Shanghai",
"TZ": "Asia/Shanghai"
},
{
"Name": "Sydney",
"TZ": "Australia/Sydney"
}
],
"style": {
"symbols": "rectangles",
"colorize": false,
"day_segments": {
"morning": 6,
"day": 8,
"evening": 18,
"night": 22
},
"coloring": {
"StaticColorMorning": "red",
"StaticColorDay": "yellow",
"StaticColorEvening": "red",
"StaticColorNight": "blue",
"StaticColorForeground": "",
"DynamicColorMorning": "red",
"DynamicColorDay": "yellow",
"DynamicColorEvening": "red",
"DynamicColorNight": "blue",
"DynamicColorForeground": "",
"DynamicColorBackground": ""
}
},
"tics": false,
"stretch": true,
"hours12": false,
"live": false
}
90 changes: 45 additions & 45 deletions tests/testdata/static_hours12.json
Original file line number Diff line number Diff line change
@@ -1,48 +1,48 @@
{
"config_version": "1.0",
"timezones": [
{
"Name": "New York",
"TZ": "America/New_York"
},
{
"Name": "Berlin",
"TZ": "Europe/Berlin"
},
{
"Name": "Shanghai",
"TZ": "Asia/Shanghai"
},
{
"Name": "Sydney",
"TZ": "Australia/Sydney"
}
],
"style": {
"symbols": "rectangles",
"colorize": false,
"day_segments": {
"morning": 6,
"day": 8,
"evening": 18,
"night": 22
},
"coloring": {
"StaticColorMorning": "red",
"StaticColorDay": "yellow",
"StaticColorEvening": "red",
"StaticColorNight": "blue",
"StaticColorForeground": "",
"DynamicColorMorning": "red",
"DynamicColorDay": "yellow",
"DynamicColorEvening": "red",
"DynamicColorNight": "blue",
"DynamicColorForeground": "",
"DynamicColorBackground": ""
}
"config_version": "1.0",
"timezones": [
{
"Name": "New York",
"TZ": "America/New_York"
},
"tics": false,
"stretch": true,
"hours12": true,
"live": false
{
"Name": "Berlin",
"TZ": "Europe/Berlin"
},
{
"Name": "Shanghai",
"TZ": "Asia/Shanghai"
},
{
"Name": "Sydney",
"TZ": "Australia/Sydney"
}
],
"style": {
"symbols": "rectangles",
"colorize": false,
"day_segments": {
"morning": 6,
"day": 8,
"evening": 18,
"night": 22
},
"coloring": {
"StaticColorMorning": "red",
"StaticColorDay": "yellow",
"StaticColorEvening": "red",
"StaticColorNight": "blue",
"StaticColorForeground": "",
"DynamicColorMorning": "red",
"DynamicColorDay": "yellow",
"DynamicColorEvening": "red",
"DynamicColorNight": "blue",
"DynamicColorForeground": "",
"DynamicColorBackground": ""
}
},
"tics": false,
"stretch": true,
"hours12": true,
"live": false
}
Loading
Loading