Add Emerge upload step #12
Workflow file for this run
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
name: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- '*' | |
workflow_dispatch: | |
concurrency: | |
group: ci-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
mac: | |
name: macOS | |
runs-on: macos-14 | |
steps: | |
- uses: actions/checkout@v4 | |
# - name: Setup tmate session | |
# uses: mxschmitt/action-tmate@v2 | |
- name: Select Xcode 15.3 | |
run: sudo xcode-select -s /Applications/Xcode_15.3.app | |
- name: LFS pull | |
run: git lfs pull | |
- name: Install Postgres | |
run: brew install postgresql@15 | |
- name: Link Postgres | |
run: brew link postgresql@15 | |
- name: Start Postgres | |
run: brew services start postgresql@15 | |
- name: Bootstrap | |
run: make bootstrap | |
- name: Run tests | |
run: make test | |
snapshot-test: | |
name: Snapshot Tests | |
runs-on: macos-14 | |
env: | |
ARCHIVE_PATH: ${{ github.workspace }}/archive/isowords.xcarchive | |
steps: | |
- uses: actions/checkout@v4 | |
# - name: Setup tmate session | |
# uses: mxschmitt/action-tmate@v2 | |
- name: Select Xcode 15.3 | |
run: sudo xcode-select -s /Applications/Xcode_15.3.app | |
- name: LFS pull | |
run: git lfs pull | |
- name: Install the Apple certificate and provisioning profile | |
env: | |
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }} | |
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} | |
PROVISIONING_PROFILE: ${{ secrets.PROVISIONING_PROFILE }} | |
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} | |
APP_CLIP_PROVISIONING_PROFILE: ${{ secrets.APP_CLIP_PROVISIONING_PROFILE }} | |
run: | | |
# create variables | |
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 | |
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision | |
APP_CLIP_PP_PATH=$RUNNER_TEMP/build_clip_pp.mobileprovision | |
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db | |
# import certificate and provisioning profile from secrets | |
echo -n "$APPLE_CERTIFICATE" | base64 --decode -o $CERTIFICATE_PATH | |
echo -n "$PROVISIONING_PROFILE" | base64 --decode -o $PP_PATH | |
echo -n "$APP_CLIP_PROVISIONING_PROFILE" | base64 --decode -o $APP_CLIP_PP_PATH | |
# create temporary keychain | |
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH | |
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
# import certificate to keychain | |
security import $CERTIFICATE_PATH -P "$APPLE_CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH | |
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
security list-keychain -d user -s $KEYCHAIN_PATH | |
# apply provisioning profile | |
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles | |
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles | |
cp $APP_CLIP_PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles | |
- name: Archive | |
run: make archive-debug | |
- name: Zip Archive | |
run: zip -r ${{ github.workspace }}/archive.zip $ARCHIVE_PATH | |
- name: Upload Archive | |
env: | |
API_KEY: ${{ secrets.API_KEY }} | |
PATH_TO_BUILD_ARTIFACT: ${{ github.workspace }}/archive.zip | |
run: | | |
json_body='{ | |
"filename":"your_build.xcarchive.zip", | |
"branch":"${{ github.ref }}", | |
"repoName":"${{ github.workspace }}", | |
"prNumber":"${{ github.event.pull_request.number }}", | |
"sha":"${{ github.event.pull_request.base.sha }}", | |
"baseSha":"${{ github.event.pull_request.base.sha }}" | |
}' | |
upload_response=$(curl \ | |
--url "https://api.emergetools.com/upload" \ | |
--header 'Accept: application/json' \ | |
--header 'Content-Type: application/json' \ | |
--header "X-API-Token: $API_KEY" \ | |
--data "$json_body") | |
# Pull the uploadURL field from the response using jq | |
upload_url=$(echo "$upload_response" | jq -r .uploadURL) | |
curl -v -H 'Content-Type: application/zip' -T "$PATH_TO_BUILD_ARTIFACT" "$upload_url" | |
ubuntu: | |
name: Ubuntu | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: 'sudo apt-get --fix-missing update && sudo apt-get install -y wamerican' | |
- name: Bootstrap | |
run: make bootstrap-client | |
- name: Run tests | |
run: make test-server-linux |