Skip to content

Commit 368b927

Browse files
authored
Merge pull request jimeh#44 from jimeh/sign-package-and-notarize
Sign, Package and Notarize
2 parents d7c59ba + 87d2d67 commit 368b927

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+4576
-22
lines changed

.github/workflows/ci.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
name: CI
3+
on: [push]
4+
5+
jobs:
6+
lint:
7+
name: Lint
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- name: golangci-lint
12+
uses: golangci/golangci-lint-action@v2
13+
with:
14+
version: v1.40
15+
env:
16+
VERBOSE: "true"
17+
18+
tidy:
19+
name: Tidy
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v2
23+
- uses: actions/setup-go@v2
24+
with:
25+
go-version: 1.16
26+
- uses: actions/cache@v2
27+
with:
28+
path: ~/go/pkg/mod
29+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
30+
restore-keys: |
31+
${{ runner.os }}-go-
32+
- name: Check if mods are tidy
33+
run: make check-tidy
34+
35+
test:
36+
name: Test
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v2
40+
- uses: actions/setup-go@v2
41+
with:
42+
go-version: 1.16
43+
- uses: actions/cache@v2
44+
with:
45+
path: ~/go/pkg/mod
46+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
47+
restore-keys: |
48+
${{ runner.os }}-go-
49+
- name: Run tests
50+
run: make test
51+
env:
52+
VERBOSE: "true"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
.DS_Store
2+
.envrc
23
Formula/*
34
Gemfile.lock
5+
bin
46
builds
57
sources
68
tarballs

.golangci.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
linters-settings:
2+
funlen:
3+
lines: 100
4+
statements: 150
5+
goconst:
6+
min-occurrences: 5
7+
gocyclo:
8+
min-complexity: 20
9+
govet:
10+
check-shadowing: true
11+
enable-all: true
12+
disable:
13+
- fieldalignment
14+
lll:
15+
line-length: 80
16+
tab-width: 4
17+
maligned:
18+
suggest-new: true
19+
misspell:
20+
locale: US
21+
22+
linters:
23+
disable-all: true
24+
enable:
25+
- bodyclose
26+
- deadcode
27+
- depguard
28+
- dupl
29+
- errcheck
30+
- exportloopref
31+
- funlen
32+
- gochecknoinits
33+
- goconst
34+
- gocritic
35+
- gocyclo
36+
- gofumpt
37+
- goimports
38+
- goprintffuncname
39+
- goprintffuncname
40+
- gosec
41+
- gosimple
42+
- govet
43+
- ineffassign
44+
- lll
45+
- misspell
46+
- nakedret
47+
- nlreturn
48+
- noctx
49+
- nolintlint
50+
- revive
51+
- sqlclosecheck
52+
- staticcheck
53+
- structcheck
54+
- typecheck
55+
- unconvert
56+
- unused
57+
- varcheck
58+
- whitespace
59+
60+
issues:
61+
include:
62+
# - EXC0002 # disable excluding of issues about comments from golint
63+
exclude:
64+
- Using the variable on range scope `tt` in function literal
65+
- Using the variable on range scope `tc` in function literal
66+
exclude-rules:
67+
- path: "_test\\.go"
68+
linters:
69+
- funlen
70+
- dupl
71+
- goconst
72+
- source: "^//go:generate "
73+
linters:
74+
- lll
75+
- source: "`json:"
76+
linters:
77+
- lll
78+
79+
run:
80+
skip-dirs:
81+
- builds
82+
- sources
83+
- tarballs
84+
timeout: 2m
85+
allow-parallel-runners: true
86+
modules-download-mode: readonly

Brewfile.ci

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# frozen_string_literal: true
2+
3+
brew 'python'

Makefile

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,187 @@
1+
PIP := $(shell command -v pip3 || command -v pip)
2+
SOURCES := $(shell \
3+
find * \
4+
-not -path 'sources/*' \
5+
-not -path 'builds/*' \( \
6+
-name "*.go" -or \
7+
-name "go.mod" -or \
8+
-name "go.sum" -or \
9+
-name "Makefile" -or \
10+
-type f -path 'internal/*' -or \
11+
-type f -path 'cmd/*' -or \
12+
-type f -path 'pkg/*' \
13+
\) | grep -v '.DS_Store' \
14+
)
15+
16+
#
17+
# Environment
18+
#
19+
20+
# Verbose output
21+
ifdef VERBOSE
22+
V = -v
23+
endif
24+
25+
BINDIR := bin
26+
TOOLDIR := $(BINDIR)/tools
27+
28+
# Global environment variables for all targets
29+
SHELL ?= /bin/bash
30+
SHELL := env \
31+
GO111MODULE=on \
32+
GOBIN=$(CURDIR)/$(BINDIR) \
33+
CGO_ENABLED=0 \
34+
PATH='$(CURDIR)/$(BINDIR):$(CURDIR)/$(TOOLDIR):$(PATH)' \
35+
$(SHELL)
36+
37+
#
38+
# Defaults
39+
#
40+
41+
# Default target
42+
.DEFAULT_GOAL := build
43+
44+
#
45+
# Bootstrap
46+
#
47+
48+
bootstrap: bootstrap-brew
49+
bootstrap-ci: bootstrap-brew bootstrap-brew-ci bootstrap-pip
50+
51+
bootstrap-brew:
52+
brew bundle
53+
54+
bootstrap-brew-ci:
55+
brew bundle --file Brewfile.ci
56+
57+
bootstrap-pip:
58+
$(PIP) install -r requirements-ci.txt
59+
60+
#
61+
# Tools
62+
#
63+
64+
# external tool
65+
define tool # 1: binary-name, 2: go-import-path
66+
TOOLS += $(TOOLDIR)/$(1)
67+
68+
$(TOOLDIR)/$(1): Makefile
69+
GOBIN="$(CURDIR)/$(TOOLDIR)" go install "$(2)"
70+
endef
71+
72+
$(eval $(call tool,gofumpt,mvdan.cc/gofumpt@latest))
73+
$(eval $(call tool,golangci-lint,github.com/golangci/golangci-lint/cmd/[email protected]))
74+
$(eval $(call tool,gomod,github.com/Helcaraxan/gomod@latest))
75+
76+
.PHONY: tools
77+
tools: $(TOOLS)
78+
79+
#
80+
# Build
81+
#
82+
83+
LDFLAGS := -w -s
84+
85+
VERSION ?= $(shell git describe --tags --exact 2>/dev/null)
86+
COMMIT ?= $(shell git rev-parse HEAD 2>/dev/null)
87+
DATE ?= $(shell date '+%FT%T%z')
88+
89+
ifeq ($(VERSION),)
90+
VERSION = 0.0.0-dev
91+
endif
92+
93+
CMDDIR := cmd
94+
BINS := $(shell test -d "$(CMDDIR)" && cd "$(CMDDIR)" && \
95+
find * -maxdepth 0 -type d -exec echo $(BINDIR)/{} \;)
96+
97+
.PHONY: build
98+
build: $(BINS)
99+
100+
$(BINS): $(BINDIR)/%: $(SOURCES)
101+
mkdir -p "$(BINDIR)"
102+
cd "$(CMDDIR)/$*" && go build -a $(V) \
103+
-o "$(CURDIR)/$(BINDIR)/$*" \
104+
-ldflags "$(LDFLAGS) \
105+
-X main.version=$(VERSION) \
106+
-X main.commit=$(COMMIT) \
107+
-X main.date=$(DATE)"
108+
109+
#
110+
# Development
111+
#
112+
113+
TEST ?= $$(go list ./... | grep -v 'sources/' | grep -v 'builds/')
114+
115+
.PHONY: clean
116+
clean:
117+
rm -rf $(BINARY) $(TOOLS)
118+
rm -f ./go.mod.tidy-check ./go.sum.tidy-check
119+
120+
.PHONY: test
121+
test:
122+
CGO_ENABLED=1 go test $(V) -count=1 -race $(TESTARGS) $(TEST)
123+
124+
.PHONY: lint
125+
lint: $(TOOLDIR)/golangci-lint
126+
golangci-lint $(V) run
127+
128+
.PHONY: format
129+
format: $(TOOLDIR)/gofumpt
130+
gofumpt -w .
131+
132+
.PHONY: gen
133+
gen:
134+
go generate $$(go list ./... | grep -v 'sources/' | grep -v 'builds/')
135+
136+
#
137+
# Dependencies
138+
#
139+
140+
.PHONY: deps
141+
deps:
142+
$(info Downloading dependencies)
143+
go mod download
144+
145+
.PHONY: deps-update
146+
deps-update:
147+
$(info Downloading dependencies)
148+
go get -u -t ./...
149+
150+
.PHONY: deps-analyze
151+
deps-analyze: $(TOOLDIR)/gomod
152+
gomod analyze
153+
154+
.PHONY: tidy
155+
tidy:
156+
go mod tidy $(V)
157+
158+
.PHONY: verify
159+
verify:
160+
go mod verify
161+
162+
.SILENT: check-tidy
163+
.PHONY: check-tidy
164+
check-tidy:
165+
cp go.mod go.mod.tidy-check
166+
cp go.sum go.sum.tidy-check
167+
go mod tidy
168+
( \
169+
diff go.mod go.mod.tidy-check && \
170+
diff go.sum go.sum.tidy-check && \
171+
rm -f go.mod go.sum && \
172+
mv go.mod.tidy-check go.mod && \
173+
mv go.sum.tidy-check go.sum \
174+
) || ( \
175+
rm -f go.mod go.sum && \
176+
mv go.mod.tidy-check go.mod && \
177+
mv go.sum.tidy-check go.sum; \
178+
exit 1 \
179+
)
180+
181+
#
182+
# Release
183+
#
184+
1185
.PHONY: new-version
2186
new-version: check-npx
3187
npx standard-version

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ Options:
8181
--no-frame-refocus Apply no-frame-refocus patch (default: disabled)
8282
--[no-]github-auth Make authenticated GitHub API requests if GITHUB_TOKEN environment variable is set.(default: enabled)
8383
--work-dir DIR Specify a working directory where tarballs, sources, and builds will be stored and worked with
84+
-o, --output DIR Output directory for finished builds (default: <work-dir>/builds)
85+
--build-name NAME Override generated build name
86+
--dist-include x,y,z List of extra files to copy from Emacs source into build folder/archive (default: COPYING)
87+
--[no-]archive Enable/disable creating *.tbz archive (default: enabled)
88+
--[no-]archive-keep Enable/disable keeping source folder for archive (default: disabled)
8489
--plan FILE Follow given plan file, instead of using given git ref/sha
8590
```
8691

0 commit comments

Comments
 (0)