Continuous Integration (CI)
To run Tuist commands in your continuous integration workflows, you'll need to install it in your CI environment.
Authentication is optional but required if you want to use server-side features like cache.
The following sections provide examples of how to do this on different CI platforms.
Examples#
GitHub Actions#
On GitHub Actions you can use OIDC authentication for secure, secretless authentication:
name:Build Applicationon:pull_request:branches:-mainpush:branches:-mainpermissions:id-token:writecontents:readjobs:build:runs-on:macos-lateststeps:-uses:actions/checkout@v4-uses:jdx/mise-action@v2-run:tuistauthlogin-run:tuistsetupcachename:Build Applicationon:pull_request:branches:-mainpush:branches:-mainpermissions:id-token:writecontents:readjobs:build:runs-on:macos-lateststeps:-uses:actions/checkout@v4-run:tuistauthlogin-run:tuistsetupcachename:Build Applicationon:pull_request:branches:-mainpush:branches:-mainenv:TUIST_TOKEN:${{ secrets.TUIST_TOKEN }}jobs:build:runs-on:macos-lateststeps:-uses:actions/checkout@v4-uses:jdx/mise-action@v2-run:tuistsetupcachename:Build Applicationon:pull_request:branches:-mainpush:branches:-mainenv:TUIST_TOKEN:${{ secrets.TUIST_TOKEN }}jobs:build:runs-on:macos-lateststeps:-uses:actions/checkout@v4-run:tuistsetupcacheBefore using OIDC authentication, you need to connect your GitHub repository to your Tuist project. The permissions: id-token: write is required for OIDC to work. Alternatively, you can use an account token with the TUIST_TOKEN secret.
We recommend using mise use --pin in your Tuist projects to pin the version of Tuist across environments. The command will create a .tool-versions file containing the version of Tuist.
Xcode Cloud#
In Xcode Cloud, which uses Xcode projects as the source of truth, you'll need to add a post-clone script to install Tuist and run the commands you need, for example tuist generate:
#!/bin/sh# Mise installation taken from https://mise.jdx.dev/continuous-integration.html#xcode-cloudcurlhttps://mise.run|sh# Install MiseexportPATH="$HOME/.local/bin:$PATH"miseinstall# Installs the version from .mise.toml# Runs the version of Tuist indicated in the .mise.toml filemiseexec--tuistinstall--path../# `--path` needed as this is run from within the `ci_scripts` directorymiseexec--tuistgenerate-p../--no-open# `-p` needed as this is run from within the `ci_scripts` directory#!/bin/shtuistgenerateUse an account token by setting the TUIST_TOKEN environment variable in your Xcode Cloud workflow settings.
CircleCI#
On CircleCI you can use OIDC authentication for secure, secretless authentication:
version:2.1jobs:build:macos:xcode:"15.0.1"steps:-checkout-run:name:Install Misecommand:| curl https://mise.jdx.dev/install.sh | sh
echo 'export PATH="$HOME/.local/bin:$PATH"' >> $BASH_ENV-run:name:Install Tuistcommand:mise install-run:name:Authenticatecommand:mise exec -- tuist auth login-run:name:Buildcommand:mise exec -- tuist setup cacheversion:2.1jobs:build:macos:xcode:"15.0.1"environment:TUIST_TOKEN:$TUIST_TOKENsteps:-checkout-run:name:Install Misecommand:| curl https://mise.jdx.dev/install.sh | sh
echo 'export PATH="$HOME/.local/bin:$PATH"' >> $BASH_ENV-run:name:Install Tuistcommand:mise install-run:name:Buildcommand:mise exec -- tuist setup cacheBefore using OIDC authentication, you need to connect your GitHub repository to your Tuist project. CircleCI OIDC tokens include your connected GitHub repository, which Tuist uses to authorize access to your projects. Alternatively, you can use an account token with the TUIST_TOKEN environment variable.
Bitrise#
On Bitrise you can use OIDC authentication for secure, secretless authentication:
workflows:build:steps:-git-clone@8:{}-script@1:title:Install Miseinputs:-content:| curl https://mise.jdx.dev/install.sh | sh
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc-script@1:title:Install Tuistinputs:-content:mise install-get-identity-token@0:inputs:-audience:tuist-script@1:title:Authenticateinputs:-content:mise exec -- tuist auth login-script@1:title:Buildinputs:-content:mise exec -- tuist setup cacheworkflows:build:steps:-git-clone@8:{}-script@1:title:Install Miseinputs:-content:| curl https://mise.jdx.dev/install.sh | sh
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc-script@1:title:Install Tuistinputs:-content:mise install-script@1:title:Buildinputs:-content:mise exec -- tuist setup cacheBefore using OIDC authentication, you need to connect your GitHub repository to your Tuist project. Bitrise OIDC tokens include your connected GitHub repository, which Tuist uses to authorize access to your projects. Alternatively, you can use an account token with the TUIST_TOKEN environment variable.
Codemagic#
In Codemagic, you can add an additional step to your workflow to install Tuist:
workflows:build:name:Buildmax_build_duration:30environment:xcode:15.0.1vars:TUIST_TOKEN:${{ secrets.TUIST_TOKEN }}scripts:-name:Install Misescript:|curlhttps://mise.jdx.dev/install.sh|shmiseinstall# Installs the version from .mise.toml-name:Buildscript:miseexec--tuistsetupcacheworkflows:build:name:Buildmax_build_duration:30environment:xcode:15.0.1vars:TUIST_TOKEN:${{ secrets.TUIST_TOKEN }}scripts:-name:Install Tuistscript:|-name:Buildscript:tuistsetupcacheCreate an account token and add it as a secret environment variable named TUIST_TOKEN.