Commit Graph

57 Commits

Author SHA1 Message Date
Qi Xiao
499b139741 tools/buildall.elv: Still generate sha256sum files for binaries.
They are used from CI workflows to ensure that the binaries are reproducible.
In theory they could be changed to compare the sha256sum files for the archive
files too, but it's too much of a hassle to create reproducible archive files.
2024-06-11 16:32:18 +01:00
Qi Xiao
6c62d738a2 tools/buildall.elv: Remove binary file by default. 2024-06-11 16:19:33 +01:00
Qi Xiao
7f24110d79 tools/buildall.elv: Add linux-riscv64. 2024-06-11 16:13:19 +01:00
Qi Xiao
77ffd8fe08 tools/pre-push: Set GOWORK=off. 2024-05-04 18:26:03 +01:00
Qi Xiao
deec3c06b2 tools/buildall.elv: Fix bin name in archive to "elvish" or "elvish.exe".
Fixing the filename makes it slightly simpler to install Elvish from the
official binary archives.
2024-02-26 15:46:54 +00:00
Qi Xiao
78bca90019 tools: Remove buildall.sh now that buildall.elv seems to be working. 2024-02-22 17:53:31 +00:00
Qi Xiao
7b7462f02c tools/buildall.elv: Remove code for passing -buildmode=pie.
The code for passing -buildmode=pie in buildall.sh didn't actually work -
"go env GOOS GOARCH" outputs two lines, while the grep pattern expects one line.

The buildall.elv script implements this correctly, and as a result this exposes
the fact that passing -buildmode=pie requires some extra work for
reproducibility - among other things, it causes the binaries to be dynamically
linked.

Just disable it for now to get reproducibility. We're not losing anything as
that was the (unintended) old behavior of buildall.sh anyway.
2024-02-22 17:34:19 +00:00
Qi Xiao
15328d585e tools: Convert run-race.sh to run-race.elv. 2024-02-22 13:57:21 +00:00
Qi Xiao
03006c95f1 tools: Convert buildall.sh to buildall.elv. 2024-02-22 13:40:05 +00:00
Qi Xiao
626c8a1514 tools/buildall.sh: Use gzip -f to overwrite existing archives.
Also remove -k because we don't need the intermediate .tar file.
2024-02-11 17:37:44 +00:00
Qi Xiao
d92ed96c51 tools/buildall.sh: Make the .tar.gz file reproducible too. 2024-02-11 17:35:40 +00:00
Qi Xiao
33190711eb tools/buildall.sh: Make zip file reproducible by fixing the mtime.
This fixes #1722.
2024-02-06 15:01:11 +01:00
Qi Xiao
7e0b6ee8e6 tools/pre-push: Include cross-compilation check for tests too. 2024-02-01 15:02:39 +00:00
Qi Xiao
fcc6d23f14 pkg/mods/doc: Convert links to language.html to absolute links.
For example, a link to language.html#number is converted to point to
https://elv.sh/ref/language.html#number instead. Such links are quite common in
elvdocs.

Also convert all link destinations that use ./language.html to use language.html
instead, and add a check in tools/check-disallowed.sh to ensure that remains the
case.
2023-01-02 01:35:41 +00:00
Qi Xiao
4a24084b38 Make tools/check-gen.sh fail if go generate fails.
Also configure the CI workflow to install stringer.
2022-12-29 23:33:16 +00:00
Qi Xiao
a537d12f40 Restructure check targets in Makefile.
- Consolidate all checks into a "all-checks" target in the Makefile, and use it
  from tools/pre-push and ci.yml.

- Remove trivial make targets, including "generate" and all the individual check
  targets.

- Remove the trivial script tools/lint.sh.

- Rename the "checkstyle" scripts to "check-fmt", which is more specific.
2022-12-29 23:23:42 +00:00
Qi Xiao
a7e92c3101 Fixup for #1630. 2022-12-29 05:22:57 +00:00
Kurtis Rader
a285ef54b4 Validate generated code is up to date
While working on a change to augment `make lint` to be more comprehensive I
noticed that `go generate ./...` produced unexpected errors on my system (see
below). This augments the CI environment checks to verify that the generated
code is up to date. This also augments the pre-push script to perform the
checks by the tools/check-content script run by the CI environment.

FWIW: The errors shown below were because my version of the
`stringer` tool was out of date (fixed by running `go install
golang.org/x/tools/stringer@latest`) Regardless, the point of this change
is that the pre-push script and the CI environment should verify that the
generated code is up to date. This change adds those checks.

> go generate ./...
stringer: internal error: package "fmt" without types was imported from
"src.elv.sh/pkg/getopt"
pkg/getopt/getopt.go:11: running "stringer": exit status 1
stringer: internal error: package "fmt" without types was imported from
"src.elv.sh/pkg/md"
pkg/md/md.go:163: running "stringer": exit status 1
stringer: internal error: package "fmt" without types was imported from
"src.elv.sh/pkg/parse"
pkg/parse/parse.go:11: running "stringer": exit status 1
Exception: go exited with 1
[tty 102], line 1: go generate ./...
2022-12-28 13:13:46 +00:00
Qi Xiao
ff169505be Format Markdown files with elvmdfmt. 2022-11-06 12:39:10 +00:00
Qi Xiao
775081b8cc Add tools/pre-push, intended to be used as a Git hook. 2022-06-05 12:44:54 +01:00
Qi Xiao
aa6d5a6257 Re-enable staticcheck, and fix issues it found. 2022-05-22 11:57:38 +01:00
Qi Xiao
cfcef9ec51 pkg/buildinfo: Use Go's buildinfo to derive version of development builds.
This allows the build commands in Makefile and tools/buildall.sh to be
simplified.

Official reproducible builds are now handled as a build variant, and the command
in Makefile no longer tries to produce reproducible builds.

Instructions in PACKAGING.md have been completely rewritten.
2022-04-02 18:18:24 +01:00
Qi Xiao
a8c2d165d3 Simplify pkg/edit/complete/node_path.go with generics.
staticcheck@master crashes when checkling code using generics, disable it in CI
for now.
2022-03-20 16:17:19 +00:00
Kurtis Rader
603aae077d Improve searching PATH on Windows for completions
This was extracted from https://github.com/elves/elvish/pull/1326. It
augments that change by honoring $E:PATHEXT and some other
minor improvements.  This matches the behavior of the Go stdlib
os/exec.LookPath() function that is used to decide if what has been typed
(in a non-completion context) represents an external command.
2022-03-12 22:49:52 +00:00
Qi Xiao
9185e04b69 Add a tool to check "forbidden" content.
Also add a Makefile target and CI task for it.
2022-02-20 23:22:33 +00:00
Qi Xiao
7ed71323fd Remove a now superfluous variable in tools/imports-graph.elv. 2021-12-31 18:51:19 +00:00
Qi Xiao
32a2c4c73d Use the flag module in tools/imports-graph.elv. 2021-12-31 18:49:59 +00:00
Qi Xiao
1d36d299b8 Put flags for prettier in .prettierrc.
Also reformat tools/checkstyle-md.sh.
2021-12-28 12:54:30 +00:00
Qi Xiao
51a388b9ec Add imports-graph.elv, a script to visualize package dependencies.
This script focuses on showing the dependencies between source packages in src.elv.sh. It outputs a DOT file.
2021-12-17 00:52:59 +00:00
Qi Xiao
671c76be00 Add a lint Makefile target and CI task.
Both run staticcheck and go vet (but not golint).

Also make some small changes necessary to make the codebase lint-free under
staticcheck.
2021-07-08 00:13:38 +01:00
Qi Xiao
a8626bce1b Fixup for #1339
- Use explict ./ for consistency when invoking the script

- Rename script to "prune-cover.sh"

- Build ignore pattern in temporary file, and use grep -f to read it

- Use grep -F for correctness (path can contain dots)

- Add comment in .codecov.yml
2021-06-20 16:39:36 +01:00
Kurtis Rader
c64e2ebfa9 make cover now ignores same files as Codecov
Running `make cover` includes code in its report that is explicitly
excluded from the https://codecov.io/gh/elves/elvish/ report. This change
causes both reports to include/exclude the same source files.
2021-06-20 16:18:28 +01:00
Qi Xiao
7d2130141b Make gofmt -s part of checkstyle-go.sh and the style target in Makefile.
Also fix the comment in checkstyle-go.sh, it got the behavior of go{imports fmt}
-d the other way around.
2021-06-09 01:06:00 +01:00
Qi Xiao
559f431b8b tools/run-race.sh: Use race detector on all supported platforms. 2021-05-08 01:40:50 +01:00
Qi Xiao
b48515ab8c Remove step to deploy to bintray in Cirrus CI config.
Bintray was turned down on 2021-05-01.
2021-05-06 11:32:24 +01:00
Qi Xiao
b235dc10ff Use a dedicated script to determine whether to use race detector.
This makes the output of "make test" cleaner, and only show the command that
was actually run (instead of a shell if statement).

Also use the race detector on more supported platforms.
2021-05-05 22:43:38 +01:00
Qi Xiao
15163a9459 Build for darwin-amd64 (macOS on M1). 2021-05-05 22:24:49 +01:00
Qi Xiao
64d22ee3ac tools/buildall.sh: Use extended regular expressions in the sed command.
The "\?" currently used is GNU-ism and doesn't work with BSD sed. Switching
to extended regular expressions avoids this problem.
2021-05-05 22:24:49 +01:00
Qi Xiao
75e7b862dc tools/buildall.sh: Avoid the unportable "echo -n". 2021-02-06 22:44:58 +00:00
Qi Xiao
a407366060 Further restrict PIE to platforms that support it without requiring CGo. 2021-01-31 01:09:05 +00:00
Qi Xiao
be158bc0d3 Only build with -buildmode=pie on Linux on Windows.
Other platforms either don't support -buildmode=pie or require CGo.
2021-01-31 00:54:30 +00:00
Qi Xiao
ec68d73668 Require development builds to include the full commit hash. 2021-01-30 18:13:10 +00:00
Qi Xiao
30489ffd28 tools/buildall.sh: Output usage information from its own comment.
When the number of arguments is not 3, the script now uses a complex sed command
to output the doc comment in its own code.
2021-01-29 01:26:06 +00:00
Qi Xiao
29e949832c Add -buildinfo=pie to flags for reproducible builds. 2021-01-28 19:59:29 +00:00
Qi Xiao
e578826ad1 tools/cirrus-deploy.sh: Accomodate changes in buildall.sh. 2021-01-28 15:13:13 +00:00
Qi Xiao
3ab3b908ec tools/cirrus-deploy.sh: Fix the find command; the cirrus builder uses Busybox. 2021-01-28 15:01:13 +00:00
Qi Xiao
91bdaaf629 Change how version information is overriden.
The mechanism is now documented in PACKAGING.md.

Also refactor tools/buildall.sh to make it easy to make reproducible builds, and
fix tools/cirrus-deploy.sh.
2021-01-28 14:41:34 +00:00
Qi Xiao
e620433422 tools/buildall.sh: Allow using different version name in filename and buildinfo. 2021-01-27 22:10:38 +00:00
Qi Xiao
c4c4a74f51 tools/buildall.sh: support running from any directory, and support passing arguments. 2021-01-27 14:09:00 +00:00
Qi Xiao
88c5dade37 Remove tools/build-old-tag.sh as it's no longer used. 2021-01-27 14:08:33 +00:00