Skip to content

Improve CI workflow #228

Improve CI workflow

Improve CI workflow #228

Workflow file for this run

---
name: CI
on: [pull_request]
env:
token: ${{ secrets.MACOS_CI_SETUP_TOKEN }}
vm_name: sequoia-for-pillarbox
vm_image: ghcr.io/cirruslabs/macos-sequoia-xcode:latest
branch_name: ${{ github.head_ref }}
scripts_path: "/tmp/.$vm_name/macos-ci-setup"
ci_scripts_path: "/tmp/.$vm_name/_repo/.github/workflows/scripts"
repo_url:
"https://${{ secrets.MACOS_CI_SETUP_TOKEN }}@github.com/\
${{ github.repository }}.git"
jobs:
install-tools:
runs-on:
labels: [tart, macos]
outputs:
runner_group_label:
${{ steps.runner-group-label.outputs.runner_group_label }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
path: "/tmp/.${{ env.vm_name }}/"
- name: Clone macos-ci-setup repository
run: |
${{ env.ci_scripts_path }}/clone-macos-ci-setup.sh \
${{ env.scripts_path }} ${{ env.token }} "add-scripts"
- name: Get runner group by runner name
id: runner-group-label
run: |
${{ env.ci_scripts_path }}/get-runner-group.sh \
${{ env.scripts_path }} \
$RUNNER_NAME $GITHUB_OUTPUT
- name: Install tools
run: |
${{ env.ci_scripts_path }}/install-tools.sh \
${{ env.scripts_path }} \
${{ env.vm_name }} ${{ env.vm_image }} \
${{ env.branch_name }} ${{ env.repo_url }}
run-streams:
needs: install-tools
runs-on: ${{ needs.install-tools.outputs.runner_group_label }}
steps:
- name: Run test streams
run: |
${{ env.ci_scripts_path }}/vm-run-test-streams.sh \
${{ env.scripts_path }} ${{ env.vm_name }}
setup-project:
needs: install-tools
runs-on: ${{ needs.install-tools.outputs.runner_group_label }}
steps:
- name: Setup project
run: |
${{ env.ci_scripts_path }}/setup-project.sh \
${{ env.scripts_path }} ${{ env.vm_name }} {{ env.token }}
check-quality:
needs: [install-tools, setup-project]
runs-on: ${{ needs.install-tools.outputs.runner_group_label }}
steps:
- name: Run the quality check
run: |
${{ env.ci_scripts_path }}/run-vm-shell-command.sh \
${{ env.vm_name }} "cd ~/_repo && make check-quality"
resolve-spm-dependencies:
needs: [install-tools, run-streams, setup-project]
runs-on: ${{ needs.install-tools.outputs.runner_group_label }}
steps:
- name: Resolve SPM dependencies
run: |
${{ env.ci_scripts_path }}/run-vm-shell-command.sh \
${{ env.vm_name }} \
"cd ~/_repo && xcodebuild -resolvePackageDependencies -verbose"
test-ios:
needs: [install-tools, resolve-spm-dependencies]
runs-on: ${{ needs.install-tools.outputs.runner_group_label }}
steps:
- name: Run the iOS tests
run: |
${{ env.ci_scripts_path }}/run-vm-shell-command.sh \
${{ env.vm_name }} \
"cd ~/_repo && make test-ios"
test-tvos:
needs: [install-tools, resolve-spm-dependencies]
runs-on: ${{ needs.install-tools.outputs.runner_group_label }}
steps:
- name: Run the tvOS tests
run: |
${{ env.ci_scripts_path }}/run-vm-shell-command.sh \
${{ env.vm_name }} \
"cd ~/_repo && make test-tvos"
archive-demo-ios:
needs: [install-tools, test-ios, test-tvos]
runs-on: ${{ needs.install-tools.outputs.runner_group_label }}
steps:
- name: Archive the iOS demo
run: |
${{ env.ci_scripts_path }}/run-vm-shell-command.sh \
${{ env.vm_name }} \
"cd ~/_repo && security unlock-keychain -p 'admin' \
~/Library/Keychains/login.keychain-db && make archive-demo-ios"
archive-demo-tvos:
needs: [install-tools, test-ios, test-tvos]
runs-on: ${{ needs.install-tools.outputs.runner_group_label }}
steps:
- name: Archive the tvOS demo
run: |
${{ env.ci_scripts_path }}/run-vm-shell-command.sh \
${{ env.vm_name }} \
"cd ~/_repo && security unlock-keychain -p 'admin' \
~/Library/Keychains/login.keychain-db && make archive-demo-tvos"
clean:
needs: [install-tools, archive-demo-ios, archive-demo-tvos]
runs-on: ${{ needs.install-tools.outputs.runner_group_label }}
if: always()
steps:
- name: Stop and remove the VM
run: |
tart stop ${{ env.vm_name }}
tart delete ${{ env.vm_name }}