### Install Dart SDK on Debian/Ubuntu
Source: https://docs.appcircle.io/build/building-flutter-applications
Install the Dart SDK on Debian-based Linux distributions using apt-get. This involves updating the package list, installing prerequisites, adding the Dart repository, and finally installing Dart.
```bash
sudo apt-get update
sudo apt-get install apt-transport-https
sudo sh -c 'wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
sudo sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
sudo apt-get install dart
```
--------------------------------
### Install Appcenter Migration Tool Globally
Source: https://docs.appcircle.io/appcircle-api-and-cli/appcenter-migration-tool
Install the appcenter-migration-tool globally on your machine using npm. Node.js v18.19.0 is recommended.
```bash
npm install -g @appcircle/appcenter-migration-tool
```
--------------------------------
### Install Dart SDK on macOS
Source: https://docs.appcircle.io/build/building-flutter-applications
Use Homebrew to tap the Dart language repository and install the Dart SDK on macOS.
```bash
brew tap dart-lang/dart
brew install dart
```
--------------------------------
### Install Appcircle CLI with yarn
Source: https://docs.appcircle.io/appcircle-api-and-cli/cli-authentication
Install the Appcircle CLI globally using yarn. This is an alternative to npm for package management.
```bash
yarn global add @appcircle/cli
```
--------------------------------
### Install .NET SDK and Build .NET MAUI Android App
Source: https://docs.appcircle.io/build/platform-build-guides/building-dotnet-maui-apps
This script installs a specific .NET version, installs the MAUI Android workload, and then builds and publishes a .NET MAUI Android application. It's used as a custom script replacement for the default Android Build step in Appcircle.
```bash
set -e
set -x
dotnetVersion="8.0.303"
framework="net8.0-android"
project="$AC_REPOSITORY_DIR/src/Calculator/Calculator.csproj"
packageFormat="apk"
curl -sS -O https://cdn.appcircle.io/dotnet-install.sh
chmod u+x dotnet-install.sh
./dotnet-install.sh --version $dotnetVersion
dotnet="$HOME/.dotnet/dotnet"
$dotnet workload install maui-android
$dotnet build $project -p:TargetFrameworks=$framework
$dotnet publish $project -p:TargetFrameworks=$framework \
-f $framework -c Release \
-p:AndroidPackageFormats="\"$packageFormat\"" \
-p:AndroidKeyStore=false \
-o "$AC_REPOSITORY_DIR/build/outputs"
# The code section below is for passing unsigned artifacts
# to the Android Sign step. So it should not be customized.
#
```
--------------------------------
### Install Appcircle CodePush SDK via npm
Source: https://docs.appcircle.io/code-push/code-push-sdk
Install the SDK directly using npm in your project's root directory.
```bash
npm i @appcircle/react-native-code-push
```
--------------------------------
### Upgrade Appcircle Migration Tool (Global Install)
Source: https://docs.appcircle.io/appcircle-api-and-cli/appcenter-migration-tool
Run this npm command to update the appcenter-migration-tool if it was installed globally.
```bash
npm update -g @appcircle/appcenter-migration-tool
```
--------------------------------
### Upgrade Appcircle Migration Tool (Local Install)
Source: https://docs.appcircle.io/appcircle-api-and-cli/appcenter-migration-tool
Run this npm command to update the appcenter-migration-tool if it was installed locally.
```bash
npm update @appcircle/appcenter-migration-tool
```
--------------------------------
### Install Appcenter Migration Tool Locally
Source: https://docs.appcircle.io/appcircle-api-and-cli/appcenter-migration-tool
Install the appcenter-migration-tool locally within your project using npm. Node.js v18.19.0 is recommended.
```bash
npm install @appcircle/appcenter-migration-tool
```
--------------------------------
### Install Appcircle CLI with npm
Source: https://docs.appcircle.io/appcircle-api-and-cli/cli-authentication
Install the Appcircle CLI globally using npm. This command is used to add the CLI tool to your system's PATH.
```bash
npm install -g @appcircle/cli
```
--------------------------------
### Detox Configurations Example
Source: https://docs.appcircle.io/continuous-testing/react-native-testing/react-native-ui-test-with-detox
Define device and app configurations in .detoxrc.js for different testing environments (iOS/Android, simulator/emulator, debug/release).
```javascript
configurations: {
'ios.sim.debug': {
device: 'simulator',
app: 'ios.debug',
},
'ios.sim.release': {
device: 'simulator',
app: 'ios.release',
},
'android.emu.debug': {
device: 'emulator',
app: 'android.debug',
},
'android.emu.release': {
device: 'emulator',
app: 'android.release',
},
}
```
--------------------------------
### Install CodePush CLI
Source: https://docs.appcircle.io/code-push/code-push-cli
Install the Appcircle CodePush CLI globally using npm. This command makes the CLI tool available in your terminal environment.
```bash
npm i -g @appcircle/codepush-cli
```
--------------------------------
### Manual CodePush Sync with Options
Source: https://docs.appcircle.io/code-push/code-push-sdk
Manually trigger CodePush sync for class components with specific update dialog and install mode options.
```javascript
let codePushOptions = { checkFrequency: codePush.CheckFrequency.MANUAL };
class MyApp extends Component {
onButtonPress() {
codePush.sync({
updateDialog: true,
installMode: codePush.InstallMode.IMMEDIATE
});
}
render() {
return (
Check for updates
)
}
}
MyApp = codePush(codePushOptions)(MyApp);
```
--------------------------------
### Example Android Unit Test
Source: https://docs.appcircle.io/continuous-testing/android-testing/running-android-unit-tests
A sample Java class demonstrating local unit tests for URL validation. Place this in the module-name/src/test/java/ directory.
```java
package com.example.appcircle_sample_android;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see Testing documentation
*/
public class URLValidatorUnitTest {
@Test
public void invalid_url_test() {
boolean isValid = URLValidator.isValid("http:/www.google.com");
assertFalse(isValid);
}
@Test
public void valid_url_test() {
boolean isValid = URLValidator.isValid("https://www.google.com");
assertTrue(isValid);
}
}
```
--------------------------------
### Example Webhook Payload
Source: https://docs.appcircle.io/account/my-organization/notifications/webhooks
This is an example JSON payload that Appcircle might send for a 'Build Started' event. Use this to test your webhook integration and signature verification.
```json
{"deliveryId":"ee81f55b-fd14-4f95-9e1f-f5bce3ad29e4","timestamp":"2022-10-26T14:55:08.4622757+00:00","action":"Build|BuildStart","message":"Build started for the develop branch for the profile pr_mr_tag_test https://my.appcircle.io/build/detail/7f17fdb4-46e7-40c3-a01d-1ef18de06890","title":"Build Started","item":{"id":"9e3c7dcd-d292-4144-9844-ca07df6a8924","agentId":"4026b6f2-d298-4b54-aa31-64726ad076fc","organizationId":"6fbd094c-18cb-4bcd-bc6f-cf2aee752982","userId":"6320a79e-d1f0-45d0-a38e-920dc4c30644","profileId":"7f17fdb4-46e7-40c3-a01d-1ef18de06890","branchId":"3779c7d2-c826-4596-95f2-52486bf75471","buildId":"00000000-0000-0000-0000-000000000000","commitId":"ba50d2d6-bfcc-49a1-8fa6-6e00711b4d5b","taskId":"9e3c7dcd-d292-4144-9844-ca07df6a8924","purpose":1,"triggerReason":0,"cancelling":false,"queueItemStatus":1,"xcodeVersion":""},"links":{"detail":"https://my.appcircle.io/build/detail/7f17fdb4-46e7-40c3-a01d-1ef18de06890","viewlogs":"https://my.appcircle.io/build/detail/7f17fdb4-46e7-40c3-a01d-1ef18de06890?modal=/build/modal/Logs&profileId=7f17fdb4-46e7-40c3-a01d-1ef18de06890&commitId=ba50d2d6-bfcc-49a1-8fa6-6e00711b4d5b&buildId=9e3c7dcd-d292-4144-9844-ca07df6a8924&scope=build&method=get"}}
```
--------------------------------
### Uninstall Appcircle Migration Tool (Local Install)
Source: https://docs.appcircle.io/appcircle-api-and-cli/appcenter-migration-tool
Run this npm command to uninstall the appcenter-migration-tool if it was installed locally.
```bash
npm uninstall @appcircle/appcenter-migration-tool
```
--------------------------------
### Uninstall Appcircle Migration Tool (Global Install)
Source: https://docs.appcircle.io/appcircle-api-and-cli/appcenter-migration-tool
Run this npm command to uninstall the appcenter-migration-tool if it was installed globally.
```bash
npm uninstall -g @appcircle/appcenter-migration-tool
```
--------------------------------
### Upload Application to Enterprise App Store
Source: https://docs.appcircle.io/enterprise-app-store/enterprise-app-store-profile
Use this command to upload an application binary to your Enterprise App Store. Ensure the file extension matches your build type (.apk, .ipa, or .aab). This command also generates a new Enterprise App Store profile.
```bash
appcircle enterprise-app-store version upload-without-profile \
--app "$AC_OUTPUT_DIR"/*.apk
```
--------------------------------
### Install CocoaPods with Specific Version
Source: https://docs.appcircle.io/build/platform-build-guides/building-flutter-applications
Use this command to install a specific version of CocoaPods, ensuring compatibility with dependencies like GoogleAppMeasurement.
```bash
pod install --version=1.10.2
```
--------------------------------
### Custom Script for .NET MAUI iOS Build
Source: https://docs.appcircle.io/build/platform-build-guides/building-dotnet-maui-apps
This script installs the .NET SDK, the maui-ios workload, builds the project, and publishes the app for iOS deployment. Customize variables like dotnetVersion, framework, project path, and signing identities for your specific pipeline.
```bash
set -e
set -x
donetVersion="8.0.303"
framework="net8.0-ios"
project="$AC_REPOSITORY_DIR/src/Calculator/Calculator.csproj"
appleCertificate="Apple Distribution: APPCIRCLE, INC. (8U2Z24R99J)"
appleProfile="AppStore Appcircle Sample"
curl -sS -O https://cdn.appcircle.io/dotnet-install.sh
chmod u+x dotnet-install.sh
./dotnet-install.sh --version $dotnetVersion
donet="$HOME/.dotnet/dotnet"
$dotnet workload install maui-ios
$dotnet build $project -p:TargetFrameworks=$framework
$dotnet publish $project -p:TargetFrameworks=$framework \
-f $framework -c Release \
-p:ArchiveOnBuild=true \
-p:RuntimeIdentifier=ios-arm64 \
-p:CodesignKey="\"$appleCertificate\"" \
-p:CodesignProvision="\"$appleProfile\"" \
-o "$AC_OUTPUT_DIR"
```
--------------------------------
### Login with Personal API Token (Old Method)
Source: https://docs.appcircle.io/appcircle-api-and-cli/cli-authentication
Authenticate using the older method with a Personal API Token. While still available, migrating to Personal Access Keys is recommended.
```bash
appcircle login pat --token "your-personal-access-token-here"
```
--------------------------------
### Upload Binary and Create Enterprise App Store Profile
Source: https://docs.appcircle.io/enterprise-app-store/enterprise-app-store-profile
This script uploads a binary and automatically creates a new Enterprise App Store profile if one does not already exist. Appcircle CLI must be installed, and a personal access key is required for login.
```bash
sudo npm install -g @appcircle/cli
appcircle login personal-access-key --secret $ORG_B_PERSONAL_ACCESS_KEY
```
--------------------------------
### Add jest-junit Dependency
Source: https://docs.appcircle.io/continuous-testing/react-native-testing/react-native-unit-test-with-jest
Install jest-junit as a development dependency to enable JUnit report generation.
```bash
yarn add -D jest-junit
```
--------------------------------
### Create a CodePush Application
Source: https://docs.appcircle.io/code-push/code-push-cli
Create a new CodePush application in Appcircle to act as a container for deployment channels and releases. Replace with a unique name for your application.
```bash
appcircle-code-push app add
```