From 6b2aa472692da35d76bf25a9051853fb9b658c13 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Fri, 8 Sep 2023 00:34:48 -0500 Subject: [PATCH] ci: ccnz is dead long live forge --- .forge.cfg | 10 +++++++++ .github/workflows/build.yml | 6 +++--- .github/workflows/nightly.yml | 8 ++++---- tsm.nimble | 38 +++++++++-------------------------- 4 files changed, 27 insertions(+), 35 deletions(-) create mode 100644 .forge.cfg diff --git a/.forge.cfg b/.forge.cfg new file mode 100644 index 0000000..8f0e4c6 --- /dev/null +++ b/.forge.cfg @@ -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 + diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cc39fc8..968641d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 04b004d..5b8108a 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -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 diff --git a/tsm.nimble b/tsm.nimble index 2d0f617..221abf8 100644 --- a/tsm.nimble +++ b/tsm.nimble @@ -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