raz / commit c906160f

commit
c906160f63140bba95d0f21f435a76e9d518eba3
author
Luis <42945842+ldiaz94@users.noreply.github.com>
date
parent
38d29a88
Take the version from git; release tags through GitHub Actions

raz --version now prints git describe's name for the commit (made
into build/version.inc by make), so a build past a release says so.
ci.yml runs make check on every push to main; a pushed tag vX.Y.Z
also becomes a release with a tarball of raz and lib/. Run by hand
with a tag, it releases one already pushed, such as v0.3.0.

patch · log

6 files changed, +64 -9

.github/workflows/ci.yml (history) added +37 -0

@@ -0,0 +1,37 @@
1+# Checks every push to main. A pushed tag vX.Y.Z is checked too and
2+# becomes a GitHub release, with a tarball of raz and the lib/ it reads
3+# beside itself. Run by hand with a tag, it releases an older tag.
4+name: ci
5+on:
6+ push:
7+ branches: [main]
8+ tags: ['v*']
9+ workflow_dispatch:
10+ inputs:
11+ tag:
12+ description: the tag to release
13+ required: true
14+permissions:
15+ contents: write
16+jobs:
17+ check:
18+ runs-on: ubuntu-24.04
19+ env:
20+ TAG: ${{ inputs.tag || (github.ref_type == 'tag' && github.ref_name) || '' }}
21+ steps:
22+ - uses: actions/checkout@v4
23+ with:
24+ ref: ${{ inputs.tag || github.ref }}
25+ fetch-depth: 0 # git describe needs the tags
26+ - run: sudo apt-get update && sudo apt-get install -y fp-compiler
27+ - run: make check
28+ - name: release
29+ if: env.TAG != ''
30+ env:
31+ GH_TOKEN: ${{ github.token }}
32+ run: |
33+ d=raz-${TAG#v}-linux-x86_64
34+ mkdir $d && cp -r raz lib LICENSE README.md $d
35+ tar czf $d.tar.gz $d
36+ gh release create "$TAG" $d.tar.gz --verify-tag \
37+ --title "raz ${TAG#v}" --notes "$(./raz --version)"

CLAUDE.md modified +7 -4

@@ -56,10 +56,13 @@
5656 compiler changes. Left for later at the owner's word: a rewrite of
5757 var parameters.
5858
59-A release is an annotated tag `vX.Y.Z` on `main`, named after
60-`Version` in `src/raz.pas`, its message what `raz --version` prints
61-(`raz 0.3.0, report 2026-10.0`); `make check` passes first. v0.3.0 is
62-the first.
59+A release is an annotated tag `vX.Y.Z` on `main`, its message what
60+`raz --version` will print (`raz 0.3.0, report 2026-10.0`); `make
61+check` passes first. The compiler takes its version from `git
62+describe` (`build/version.inc`, made by `make`). Pushing the tag runs
63+`.github/workflows/ci.yml`, which checks it and makes the GitHub
64+release with a tarball of `raz` and `lib/`; it also checks every push
65+to `main`. v0.3.0 is the first.
6366
6467 `test/libc` runs its programs over `lib/Sys.raz`, the C one, through
6568 a link in its `mods`. A test or example without `.expect` is only

Makefile (history) modified +10 -2

@@ -4,8 +4,16 @@
44 FPC = fpc
55 FPCFLAGS = -O2 -Mobjfpc -Sh- -vew -FUbuild
66
7-raz: src/*.pas | build
8- $(FPC) $(FPCFLAGS) -FE. -oraz src/raz.pas
7+raz: src/*.pas build/version.inc | build
8+ $(FPC) $(FPCFLAGS) -Fibuild -FE. -oraz src/raz.pas
9+
10+# The version is git's name for the commit; the file changes only when
11+# that does, so raz isn't rebuilt for nothing.
12+build/version.inc: FORCE | build
13+ @v=$$(git describe --tags --dirty 2>/dev/null || echo unknown); \
14+ v="'$${v#v}'"; echo "$$v" | cmp -s - $@ || echo "$$v" >$@
15+
16+FORCE:
917
1018 units: src/*.pas | build
1119 for u in scan sym x64 link elf; do $(FPC) $(FPCFLAGS) src/$$u.pas || exit 1; done

README.md (history) modified +6 -1

@@ -132,10 +132,15 @@
132132
133133 ## Versions
134134
135-The compiler says which version of the report it follows:
135+The compiler says its own version and that of the report it follows:
136136
137137 $ ./raz --version
138138 raz 0.3.0, report 2026-10.0
139+
140+The compiler's version is git's name for the commit it was built from:
141+`0.3.0` at the tag `v0.3.0`, `0.3.0-5-g38d29a8` five commits past it.
142+A release is a tag `vX.Y.Z` pushed to GitHub, which builds it, checks
143+it, and attaches `raz` with its `lib/` to the release.
139144
140145 A version of the report is named by its month and a count; the report's
141146 last section says what each version changed.

doc/compiler.md (history) modified +1 -1

@@ -15,7 +15,7 @@
1515 | `src/parse.pas` | 1,816 | 1,685 | Declarations, statements, expressions, built-ins |
1616 | `src/link.pas` | 131 | 95 | Tree shaking, layout, patching |
1717 | `src/elf.pas` | 425 | 351 | Static and dynamic ELF, symbol table, line numbers |
18-| `src/raz.pas` | 214 | 169 | The command line, the entry points |
18+| `src/raz.pas` | 216 | 169 | The command line, the entry points |
1919
2020 Every file opens with a comment that says what it is, what it depends
2121 on and what it leaves out. Read those first; they are the map.

src/raz.pas modified +3 -1

@@ -28,7 +28,9 @@
2828 uses math, BaseUnix, syscall, scan, sym, x64, gen, parse, link, elf;
2929
3030 const
31- Version = '0.3.0';
31+ { what git describe says, made by make: 0.3.0 at the tag v0.3.0,
32+ 0.3.0-5-g38d29a8 five commits past it }
33+ Version = {$I version.inc};
3234 Report = '2026-10.0'; { the version of doc/raz.md it follows }
3335 MemfdCreate = 319; { the system call; FPC 3.2.2 has no name for it }
3436 MfdCloexec = 1; { an ELF still executes: the kernel opens it first }