From dec34e0bed3980974e81494304429b87ed63cdc1 Mon Sep 17 00:00:00 2001 From: Smooth Operator Date: Fri, 23 Feb 2024 13:22:34 -0500 Subject: [PATCH] refine deps, ci --- .github/workflows/ci.yml | 141 +++++++++++++++++++++++++++++++-------- arc.nimble | 9 --- 2 files changed, 112 insertions(+), 38 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 90ea256..ecd9998 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,62 +2,131 @@ name: CI on: schedule: - cron: '30 5 * * *' - push: branches: - master - paths: - - '**.cfg' - - '**.nims' - - '**.nim' - - '**.nimble' - - 'tests/**' - - '.github/workflows/ci.yml' pull_request: branches: - '*' - paths: - - '**.cfg' - - '**.nims' - - '**.nim' - - '**.nimble' - - 'tests/**' - - '.github/workflows/ci.yml' jobs: + changes: + # Disable the filter on scheduled runs because we don't want to skip those + if: github.event_name != 'schedule' + continue-on-error: true # Makes sure errors won't stop us + runs-on: ubuntu-latest + outputs: + src: ${{ steps.filter.outputs.src }} + steps: + # For PRs the path filter check with Github API, so no need to checkout + # for them. + - if: github.event_name != 'pull_request' + name: Checkout + uses: actions/checkout@v4 + + - uses: dorny/paths-filter@v3 + id: filter + with: + filters: | + src: + - '**.cfg' + - '**.nims' + - '**.nim' + - '**.nimble' + - 'tests/**' + - '.github/workflows/ci.yml' + build: + # Build if the files we care about are changed. + needs: changes + # Make sure to always run regardless of whether the filter success or not. + # When the filter fails there won't be an output, so checking for `false` + # state is better than checking for `true`. + # + # The always() function here is required for the job to always run despite + # what Github docs said, see: https://github.com/actions/runner/issues/491 + if: always() && !cancelled() && needs.changes.outputs.src != 'false' + strategy: fail-fast: false matrix: - os: ['windows-latest', 'macos-latest', 'ubuntu-latest'] - nim: ['devel', 'version-1-6', 'version-1-4', 'version-1-2'] - name: '${{ matrix.os }} (${{ matrix.nim }})' + os: [ubuntu-latest, windows-latest, macos-latest] + compiler: + - name: nim + version: [devel, version-2-0, version-1-6, version-1-4, version-1-2] + - name: nimskull + version: "*" + + name: '${{ matrix.os }} (${{ matrix.compiler.name }} ${{ matrix.compiler.version }})' runs-on: ${{ matrix.os }} steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: - path: ci + path: project - - name: Setup Nim + - name: Nim + if: matrix.compiler.name == 'nim' uses: alaviss/setup-nim@0.1.1 with: path: nim - version: ${{ matrix.nim }} + version: ${{ matrix.compiler.version }} - - name: Run tests + - name: Nimskull + id: nimskull + if: matrix.compiler.name == 'nimskull' + uses: alaviss/setup-nimskull@f6e8ade8ac51191024616216e5da0ee968d9da48 + with: + nimskull-version: ${{ matrix.compiler.version }} + + - name: Fetch Nimble + if: matrix.compiler.name == 'nimskull' + uses: actions/checkout@v4 + with: + path: nimble + repository: alaviss/nimble + ref: nimskull + + - name: Build Nimble + if: matrix.compiler.name == 'nimskull' shell: bash run: | - cd ci - nimble --accept develop + cd nimble + nim c -d:release -o:nimble src/nimble.nim + cp nimble "$NIMSKULL_BIN/nimble" + # Add nimble binary folder to PATH too + echo "$HOME/.nimble/bin" >> $GITHUB_PATH + env: + NIMSKULL_BIN: ${{ steps.nimskull.outputs.binPath }} + +# - name: Valgrind +# shell: bash +# run: | +# sudo apt-get update +# sudo apt install --fix-missing valgrind + + - name: Dependencies + shell: bash + run: | + cd project nimble --accept install "https://github.com/disruptek/balls" - nimble test + nimble --accept develop + env: + NIM: ${{ matrix.compiler.name }} + + - name: Tests + shell: bash + run: | + cd project + balls --path="." --backend:c --panics:on \ + --gc:arc --gc:orc --define:useMalloc \ + --define:debug --define:release --define:danger - name: Build docs if: ${{ matrix.docs }} == 'true' shell: bash run: | - cd ci + cd project branch=${{ github.ref }} branch=${branch##*/} nimble doc --project --path="." --outdir:docs \ @@ -71,9 +140,23 @@ jobs: - name: Publish docs if: > github.event_name == 'push' && github.ref == 'refs/heads/master' && - matrix.os == 'ubuntu-latest' && matrix.nim == 'devel' + matrix.compiler.name == 'nim' && matrix.os == 'ubuntu-latest' && + matrix.compiler.version == 'devel' uses: crazy-max/ghaction-github-pages@v1 with: - build_dir: ci/docs + build_dir: project/docs env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # Set check-required on this + success: + needs: build + if: always() + runs-on: ubuntu-latest + name: 'All check passes' + steps: + - if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') + name: 'Fail when previous jobs fails' + run: | + echo "::error::One of the previous jobs failed" + exit 1 diff --git a/arc.nimble b/arc.nimble index 3310977..7caa350 100644 --- a/arc.nimble +++ b/arc.nimble @@ -2,12 +2,3 @@ version = "0.0.3" author = "disruptek" description = "a hack to manipulate reference counts" license = "MIT" - -when not defined(release): - requires "https://github.com/disruptek/balls >= 3.0.0 & < 4.0.0" - -task test, "run tests for ci": - when defined(windows): - exec "balls.cmd" - else: - exec findExe"balls"