Using Scarb in CI
To use Scarb in your CI workflow, you need to download the Scarb binary, unpack the archive, and add the directory containing Scarb binary to your PATH variable.
GitHub Actions
The officially supported software-mansion/setup-scarb
GitHub action installs Scarb on the job runner and prepares environment for optimal use with dependency caching out of the box. You can find an example of the Scarb setup in the following workflow file:
name: CI
on:
push:
merge_group:
pull_request:
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: software-mansion/setup-scarb@v1
with:
scarb-version: "2.8.5"
- run: scarb fmt --check
- run: scarb test
You can use scarb-version
to specify which Scarb version will be used. When it is not present, the action will resolve the version from .tool-versions
file that's created when using asdf
. In case there is no such file, the latest Scarb version will be installed. You can find more information in action's repository.
Go to setup-scarb repository on GitHub →
GitLab CI
You can find an example of the Scarb setup in the following GitLab CI configuration.
variables:
SCARB_VERSION: "2.8.5"
stages:
- check
scarb:
stage: check
image: ubuntu:jammy
script:
- apt-get update && apt-get install -y curl
- export PATH="$HOME/.local/bin:$PATH" && curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | bash -s -- -v $SCARB_VERSION
- scarb fmt --check
- scarb build
CircleCI
You can find an example of the Scarb setup in the following workflow file.
version: 2.1
parameters:
scarb_version:
type: string
default: "2.8.5"
jobs:
check:
docker:
- image: cimg/base:2023.03
steps:
- checkout
- run:
name: Setup Scarb
command: |
echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$BASH_ENV"
source "$BASH_ENV"
curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | bash -s -- -v << pipeline.parameters.scarb_version >>
- run: scarb fmt --check
- run: scarb build
workflows:
ci:
jobs:
- check