This action sets up Nimble (Nim's package manager) in your GitHub Actions workflow.
See action.yml
steps:
- uses: actions/checkout@v4
- uses: nim-lang/setup-nimble-action@v2
with:
nimble-version: '0.16.4' # default is 'latest'. You could also use `nightly` to get #HEAD
repo-token: ${{ secrets.GITHUB_TOKEN }}repo-token is used for Rate limiting.
It works without setting this parameter, but please set it if you get rate limit errors.
@v2 is the current major version. @v1 is frozen and still works, so existing
workflows keep running unchanged until you choose to move.
Two things changed in v2:
- Nimble is installed for the runner's architecture, so Apple Silicon runners get a
native arm64 binary instead of an emulated x86_64 one. If a macOS job builds for
an architecture other than the runner's own, pass the target explicitly — for
example
--passC:"-target x86_64-apple-macos11"alongside--cpu:amd64. nimble-versionaccepts a commit SHA or branch name, built from source.
The action installs a Nimble matching the runner's architecture, so Apple Silicon and arm64 Linux runners get a native binary rather than an emulated x86_64 one.
Nimble does not publish a native binary for every architecture on every release —
macosx_aarch64 starts at 0.22.2, and Windows has no arm64 build. Where one is
missing the action installs the x64 binary and emits a warning annotation, since
an emulated Nimble goes on to resolve an x64 Nim, which makes NimScript report
amd64 on an arm64 machine.
nimble-version also accepts a commit SHA or a branch name from
nim-lang/nimble. These are built from
source: expect a few minutes on a cold cache (the result is cached per commit),
and a Nim compiler is downloaded for the build unless nim is already on PATH.
steps:
- uses: actions/checkout@v4
- uses: nim-lang/setup-nimble-action@v2
with:
nimble-version: 'a1b471d13d173897942f99d013f4efb79913bdf2' # or a branch, e.g. 'master'
repo-token: ${{ secrets.GITHUB_TOKEN }}steps:
- uses: actions/checkout@v4
- uses: nim-lang/setup-nimble-action@v2
with:
nimble-version: 'latest'
repo-token: ${{ secrets.GITHUB_TOKEN }}steps:
- uses: actions/checkout@v4
- name: Cache nimble
id: cache-nimble
uses: actions/cache@v4
with:
path: ~/.nimble
key: ${{ runner.os }}-nimble-${{ hashFiles('*.nimble') }}
restore-keys: |
${{ runner.os }}-nimble-
if: runner.os != 'Windows'
- uses: nim-lang/setup-nimble-action@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}Test across multiple platforms:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
- macOS-latest
steps:
- uses: actions/checkout@v4
- uses: nim-lang/setup-nimble-action@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}The action installs Nimble to .nimble_runtime directory by default. You can change this using:
- uses: nim-lang/setup-nimble-action@v2
with:
nimble-version: latest
repo-token: ${{ secrets.GITHUB_TOKEN }}
nimble-install-directory: custom_dirMIT