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

View file

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

View file

@ -15,37 +15,19 @@ requires "nim >= 2.0.0",
"cligen" "cligen"
import strformat 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": task release, "build release assets":
mkdir "dist" version = (gorgeEx "git describe --tags --always --match 'v*'").output
for target in targets: exec &"forge release -v {version} -V"
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}"
task bundle, "package build assets": task bundle, "package build assets":
cd "dist" withDir "dist":
for target in targets: for dir in listDirs("."):
let let cmd = if "windows" in dir:
app = projectName() &"7z a {dir}.zip {dir}"
cmd =
if target == "x86_64-windows-gnu":
&"7z a {app}-v{version}-{target}.zip {target}"
else: else:
&"tar czf {app}-v{version}-{target}.tar.gz {target}" &"tar czf {dir}.tar.gz {dir}"
cpFile("../README.md", &"{dir}/README.md")
cpFile("../README.md", &"{target}/README.md")
exec cmd exec cmd