Improve CI workflow #209
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: [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 }} | |
ci_script_path: ${{ github.workspace }}/.github/workflows/scripts | |
script_path: ${{ github.workspace }}/../macos-ci-setup | |
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: Clone macos-ci-setup repository | |
run: | | |
rm -rf ${{ env.script_path }} | |
git clone -b add-scripts \ | |
https://${{ env.token }}\ | |
@github.com/SRGSSR/macos-ci-setup.git ${{ env.script_path }} | |
- name: Runner labels | |
id: runner-group-label | |
run: | | |
runner_group_label=\ | |
$(${{ env.script_path }}/runner-group-label.sh $RUNNER_NAME) | |
echo "runner_group_label=$runner_group_label" >> $GITHUB_OUTPUT | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install tools | |
run: | | |
${{ env.ci_script_path }}/install-tools.sh \ | |
${{ env.vm_name }} ${{ env.vm_image }} \ | |
${{ env.branch_name }} ${{ env.repo_url }} ${{ env.script_path }} | |
run-streams: | |
needs: install-tools | |
runs-on: ${{ needs.install-tools.outputs.runner_group_label }} | |
steps: | |
- name: Run test streams | |
run: | | |
${{ env.script_path }}/run-vm-shell-command.sh ${{ env.vm_name }} \ | |
"cd ~/_repo && make test-streams-start" | |
setup-project: | |
needs: install-tools | |
runs-on: ${{ needs.install-tools.outputs.runner_group_label }} | |
steps: | |
- name: Setup project | |
run: | | |
${{ env.script_path }}/run-vm-shell-command.sh ${{ env.vm_name }} \ | |
"cd ~/_repo && rm -rf Configuration" | |
${{ env.script_path }}/run-vm-shell-command.sh ${{ env.vm_name }} \ | |
"cd ~/_repo && Scripts/checkout-configuration.sh \ | |
https://${{ env.token }}\ | |
@github.com/SRGSSR/pillarbox-apple-configuration.git \ | |
certificate HEAD Configuration" | |
${{ env.script_path }}/run-vm-shell-command.sh ${{ env.vm_name }} \ | |
"security unlock-keychain -p 'admin' \ | |
~/Library/Keychains/login.keychain-db && \ | |
security import ~/_repo/Configuration/6YXTQTG8JJ_development.p12 \ | |
-k ~/Library/Keychains/login.keychain-db \ | |
-P '6YXTQTG8JJ' -T /usr/bin/security -T /usr/bin/codesign" | |
${{ env.script_path }}/run-vm-shell-command.sh ${{ env.vm_name }} \ | |
"security set-key-partition-list -S apple-tool:,apple: -s -k 'admin' \ | |
~/Library/Keychains/login.keychain-db" | |
${{ env.script_path }}/run-vm-shell-command.sh ${{ env.vm_name }} \ | |
"cd ~/_repo && make setup" | |
check-quality: | |
needs: [install-tools, setup-project] | |
runs-on: ${{ needs.install-tools.outputs.runner_group_label }} | |
steps: | |
- name: Run the quality check | |
run: | | |
${{ env.script_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.script_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.script_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.script_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.script_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.script_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 }} |