ci: ccnz is dead long live forge

This commit is contained in:
Daylin Morgan 2023-09-08 00:34:48 -05:00
parent 0109817ce7
commit 6b2aa47269
Signed by: daylin
GPG key ID: C1E52E7DD81DF79F
4 changed files with 27 additions and 35 deletions

10
.forge.cfg Normal file
View file

@ -0,0 +1,10 @@
# example ccnz config file
nimble
[target]
x86_64-linux-gnu
aarch64-linux-gnu
x86_64-linux-musl
x86_64-macos-none
aarch64-macos-none

View file

@ -6,7 +6,6 @@ on:
jobs:
build-artifact:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
@ -16,10 +15,11 @@ jobs:
# for cross compilation with ccnz
- uses: goto-bus-stop/setup-zig@v2
- run: nimble install -Y https://github.com/daylinmorgan/ccnz
- name: Generate build artifacts
run: nimble release
run: |
nimble install -Y forge
nimble release
- name: Create artifact bundles
run: nimble bundle

View file

@ -20,12 +20,12 @@ jobs:
- name: print latest commit
run: echo ${{ github.sha }}
- id: should_run
name: check latest commit is less than a day
- name: check latest commit is less than a day
if: ${{ github.event_name == 'schedule' }}
run: |
test -n "$(git rev-list --since="24 hours" HEAD)" \
&& echo "quit=true" >> "$GITHUB_OUTPUT"
if [[ -n "$(git rev-list --since='24 hours' HEAD)" ]]; then
echo "quit=true" >> "$GITHUB_OUTPUT"
fi
build-artifacts:
needs: check-commits

View file

@ -15,37 +15,19 @@ requires "nim >= 2.0.0",
"cligen"
import strformat
const targets = [
"x86_64-linux-gnu",
"aarch64-linux-gnu",
"x86_64-linux-musl",
"x86_64-macos-none",
"aarch64-macos-none",
# "x86_64-windows-gnu" # no tsm on windows
]
task release, "build release assets":
mkdir "dist"
for target in targets:
let
ext = if target == "x86_64-windows-gnu": ".cmd" else: ""
outdir = &"dist/{target}/"
app = projectName()
exec &"ccnz cc --target {target} --nimble -- --out:{outdir}{app}{ext} -d:release src/{app}"
version = (gorgeEx "git describe --tags --always --match 'v*'").output
exec &"forge release -v {version} -V"
task bundle, "package build assets":
cd "dist"
for target in targets:
let
app = projectName()
cmd =
if target == "x86_64-windows-gnu":
&"7z a {app}-v{version}-{target}.zip {target}"
else:
&"tar czf {app}-v{version}-{target}.tar.gz {target}"
cpFile("../README.md", &"{target}/README.md")
exec cmd
withDir "dist":
for dir in listDirs("."):
let cmd = if "windows" in dir:
&"7z a {dir}.zip {dir}"
else:
&"tar czf {dir}.tar.gz {dir}"
cpFile("../README.md", &"{dir}/README.md")
exec cmd