From 7a80d1e9ef4b5ec8128bea8f40bcfe0ef3ba8191 Mon Sep 17 00:00:00 2001 From: treeform Date: Sun, 24 May 2026 21:48:04 -0700 Subject: [PATCH] migrate ci to nimby --- .github/workflows/build.yml | 52 +++++++++++++++++-------------------- .github/workflows/docs.yml | 29 +++++++++++++++++++++ tests/tests.nim | 6 +++++ 3 files changed, 59 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/docs.yml create mode 100644 tests/tests.nim diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c62b3f76..0b70f3cb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,31 +1,27 @@ -name: Run tests -on: [push, pull_request] +name: Github Actions +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + workflow_dispatch: jobs: build: - runs-on: ubuntu-latest - + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v1 - - - name: Cache choosenim - id: cache-choosenim - uses: actions/cache@v1 - with: - path: ~/.choosenim - key: ${{ runner.os }}-choosenim-stable - - - name: Cache nimble - id: cache-nimble - uses: actions/cache@v1 - with: - path: ~/.nimble - key: ${{ runner.os }}-nimble-stable - - - uses: jiro4989/setup-nim-action@v1 - - - name: Install GUI - run: | - sudo apt update - sudo apt install -y build-essential libalut-dev libasound2-dev libc6-dev libgl1-mesa-dev libglu1-mesa-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libxxf86vm-dev mesa-utils pkg-config xorg-dev xvfb - - run: nimble install -y - - run: nim c -r tests/run.nim --compile --native --js + - uses: actions/checkout@v5 + - uses: treeform/setup-nim-action@v6 + - name: Install dependencies + shell: bash + run: | + cd .. + nimby install -g "${{ github.event.repository.name }}/${{ github.event.repository.name }}.nimble" + - name: Install GUI + run: | + sudo apt update + sudo apt install -y build-essential libalut-dev libasound2-dev libc6-dev libgl1-mesa-dev libglu1-mesa-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev libxxf86vm-dev mesa-utils pkg-config xorg-dev xvfb + - run: nim r tests/tests.nim diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000..b4299f02 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,29 @@ +name: docs +on: + push: + branches: [ master ] + workflow_dispatch: +permissions: + contents: write +env: + nim-src: src/${{ github.event.repository.name }}.nim + deploy-dir: .gh-pages +jobs: + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - uses: treeform/setup-nim-action@v6 + - name: Install dependencies + shell: bash + run: | + cd .. + nimby install -g "${{ github.event.repository.name }}/${{ github.event.repository.name }}.nimble" + - run: nim doc --index:on --project --git.url:https://github.com/${{ github.repository }} --git.commit:master --out:${{ env.deploy-dir }} ${{ env.nim-src }} + - name: "Copy to index.html" + run: cp ${{ env.deploy-dir }}/${{ github.event.repository.name }}.html ${{ env.deploy-dir }}/index.html + - name: Deploy documents + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ${{ env.deploy-dir }} diff --git a/tests/tests.nim b/tests/tests.nim new file mode 100644 index 00000000..61a5d9a6 --- /dev/null +++ b/tests/tests.nim @@ -0,0 +1,6 @@ +import os + +let command = "nim c -r tests/run.nim --compile --native --js" +echo command +if execShellCmd(command) != 0: + quit "tests failed"