forked from tuist/tuist
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add a new 'Automate | Continuous Integration' section to the do…
…cumentation (tuist#6631) * Add a new 'Develop | Integrate' documentation section * Document how to authenticate CI requests * Update docs/docs/guides/develop/integrate.md Co-authored-by: James Sherlock <[email protected]> * Rename 'integrate' to 'automate' * Update docs/docs/guides/develop/automate/continuous-integration.md Co-authored-by: Marek Fořt <[email protected]> --------- Co-authored-by: James Sherlock <[email protected]> Co-authored-by: Marek Fořt <[email protected]>
- Loading branch information
1 parent
b8aaf84
commit f5847fa
Showing
8 changed files
with
147 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
129 changes: 129 additions & 0 deletions
129
docs/docs/guides/develop/automate/continuous-integration.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
--- | ||
title: Continuous Integration (CI) | ||
titleTemplate: ":title | Develop | Tuist" | ||
description: Learn how to use Tuist in your CI workflows. | ||
--- | ||
|
||
# Continuous Integration (CI) | ||
|
||
You can use Tuist in [continuous integration](https://en.wikipedia.org/wiki/Continuous_integration) environments. The following sections provide examples of how to do this on different CI platforms. | ||
|
||
## Examples | ||
|
||
To run Tuist commands in your CI workflows, you’ll need to install it in your CI environment. | ||
|
||
### Xcode Cloud | ||
|
||
In [Xcode Cloud](https://developer.apple.com/xcode-cloud/), which uses Xcode projects as the source of truth, you'll need to add a [post-clone](https://developer.apple.com/documentation/xcode/writing-custom-build-scripts#Create-a-custom-build-script) script to install Tuist and run the commands you need, for example `tuist generate`: | ||
|
||
:::code-group | ||
|
||
```bash [Mise] | ||
#!/bin/sh | ||
curl https://mise.jdx.dev/install.sh | sh | ||
mise install # Installs the version from .mise.toml | ||
|
||
# Runs the version of Tuist indicated in the .mise.toml file | ||
mise x tuist generate | ||
``` | ||
```bash [Homebrew] | ||
#!/bin/sh | ||
brew install --formula [email protected] | ||
|
||
tuist generate | ||
``` | ||
::: | ||
### Codemagic | ||
|
||
In [Codemagic](https://codemagic.io), you can add an additional step to your workflow to install Tuist: | ||
|
||
::: code-group | ||
```yaml [Mise] | ||
workflows: | ||
lint: | ||
name: Build | ||
max_build_duration: 30 | ||
environment: | ||
xcode: 15.0.1 | ||
scripts: | ||
- name: Install Mise | ||
script: | | ||
curl https://mise.jdx.dev/install.sh | sh | ||
mise install # Installs the version from .mise.toml | ||
- name: Build | ||
script: mise x tuist build | ||
``` | ||
```yaml [Homebrew] | ||
workflows: | ||
lint: | ||
name: Build | ||
max_build_duration: 30 | ||
environment: | ||
xcode: 15.0.1 | ||
scripts: | ||
- name: Install Tuist | ||
script: | | ||
brew install --formula [email protected] | ||
- name: Build | ||
script: tuist build | ||
``` | ||
::: | ||
### GitHub Actions | ||
On [GitHub Actions](https://docs.github.com/en/actions) you can an additional step to install Tuist, and in the case of managing the installation of Mise, you can use the [mise-action](https://github.com/jdx/mise-action), which abstracts the installation of Mise and Tuist: | ||
::: code-group | ||
```yaml [Mise] | ||
name: Build Application | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
build: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: jdx/mise-action@v2 | ||
- run: tuist build | ||
``` | ||
```yaml [Homebrew] | ||
name: test | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
lint: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- run: brew install --formula [email protected] | ||
- run: tuist build | ||
``` | ||
::: | ||
::: tip | ||
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. | ||
::: | ||
|
||
## Authentication | ||
|
||
When using server-side features such as [cache](/guides/develop/build/cache), you'll need a way to authenticate requests going from your CI workflows to the server. For that, you can generate a project-scoped token by running the following command: | ||
|
||
```bash | ||
tuist project tokens create my-handle/MyApp | ||
``` | ||
|
||
The command will generate a token for the project with full handle `my-account/my-project`. Set the value to the environment variable | ||
`TUIST_CONFIG_TOKEN` in your CI environment ensuring it's configured as a secret so it's not exposed. | ||
|
||
> [!IMPORTANT] CI ENVIRONMENT DETECTION | ||
> Tuist only uses the token when it detects it's running on a CI environment. If your CI environment is not detected, you can force the token usage by setting the environment variable `CI` to `1`. |
3 changes: 2 additions & 1 deletion
3
docs/docs/guides/develop/workflows.md → ...docs/guides/develop/automate/workflows.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,68 +36,6 @@ mise use -g [email protected] # Use tuist-x.y.z as the global default | |
mise use -g tuist@system # Use the system's tuist as the global default | ||
``` | ||
|
||
#### Continuous integration | ||
|
||
If you are using Tuist in a continuous integration environment, the following sections show how to install Tuist in the most common ones: | ||
|
||
##### Xcode Cloud | ||
|
||
You'll need a [post-clone](https://developer.apple.com/documentation/xcode/writing-custom-build-scripts#Create-a-custom-build-script) script that installs Mise and Tuist: | ||
|
||
```bash | ||
#!/bin/sh | ||
curl https://mise.jdx.dev/install.sh | sh | ||
mise install # Installs the version from .mise.toml | ||
|
||
# Runs the version of Tuist indicated in the .mise.toml file | ||
mise x tuist generate | ||
``` | ||
|
||
##### Codemagic | ||
|
||
To install and use Mise and Tuist in [Codemagic](https://codemagic.io), you can add an additional step to your workflow, and run Tuist through `mise x tuist` to ensure that the right version is used: | ||
|
||
```yaml | ||
workflows: | ||
lint: | ||
name: Build | ||
max_build_duration: 30 | ||
environment: | ||
xcode: 15.0.1 | ||
scripts: | ||
- name: Install Mise | ||
script: | | ||
curl https://mise.jdx.dev/install.sh | sh | ||
mise install # Installs the version from .mise.toml | ||
- name: Build | ||
script: mise x tuist build | ||
``` | ||
##### GitHub Actions | ||
On GitHub Actions you can use the [mise-action](https://github.com/jdx/mise-action), which abstracts the installation of Mise and Tuist and the configuration of the environment: | ||
```yaml | ||
name: test | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
lint: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: jdx/mise-action@v2 | ||
``` | ||
::: tip | ||
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. | ||
::: | ||
|
||
### Alternative: [Homebrew](https://brew.sh) | ||
|
||
If version pinning across environments is not a concern for you, | ||
|