From ff9e50cfa642d7109f466e08bcb6df034af5f13d Mon Sep 17 00:00:00 2001 From: Walid Kayhal <3347810+waliid@users.noreply.github.com> Date: Fri, 8 Nov 2024 15:25:30 +0100 Subject: [PATCH] Add more ci scripts --- .github/workflows/ci.yml | 31 +++++++------------ .github/workflows/scripts/setup-project.sh | 10 ++---- .github/workflows/scripts/unlock-keychain.sh | 8 +++++ .github/workflows/scripts/vm-archive.sh | 17 ++++++++++ .github/workflows/scripts/vm-check-quality.sh | 14 +++++++++ .../scripts/vm-resolve-spm-dependencies.sh | 12 +++++++ .github/workflows/scripts/vm-test.sh | 15 +++++++++ 7 files changed, 81 insertions(+), 26 deletions(-) create mode 100644 .github/workflows/scripts/unlock-keychain.sh create mode 100755 .github/workflows/scripts/vm-archive.sh create mode 100755 .github/workflows/scripts/vm-check-quality.sh create mode 100755 .github/workflows/scripts/vm-resolve-spm-dependencies.sh create mode 100755 .github/workflows/scripts/vm-test.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8e402bee..28b3faa3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,8 +74,8 @@ jobs: - name: Run the quality check run: | - ${{ env.ci_scripts_path }}/run-vm-shell-command.sh \ - ${{ env.vm_name }} "cd ~/_repo && make check-quality" + ${{ env.ci_scripts_path }}/vm-check-quality.sh \ + ${{ env.scripts_path }} ${{ env.vm_name }} resolve-spm-dependencies: needs: [install-tools, run-streams, setup-project] @@ -86,9 +86,8 @@ jobs: - name: Resolve SPM dependencies run: | - ${{ env.ci_scripts_path }}/run-vm-shell-command.sh \ - ${{ env.vm_name }} \ - "cd ~/_repo && xcodebuild -resolvePackageDependencies -verbose" + ${{ env.ci_scripts_path }}/vm-resolve-spm-dependencies.sh \ + ${{ env.scripts_path }} ${{ env.vm_name }} test-ios: needs: [install-tools, resolve-spm-dependencies] @@ -99,9 +98,8 @@ jobs: - name: Run the iOS tests run: | - ${{ env.ci_scripts_path }}/run-vm-shell-command.sh \ - ${{ env.vm_name }} \ - "cd ~/_repo && make test-ios" + ${{ env.ci_scripts_path }}/vm-test.sh \ + ${{ env.scripts_path }} ${{ env.vm_name }} "ios" test-tvos: needs: [install-tools, resolve-spm-dependencies] @@ -112,9 +110,8 @@ jobs: - name: Run the tvOS tests run: | - ${{ env.ci_scripts_path }}/run-vm-shell-command.sh \ - ${{ env.vm_name }} \ - "cd ~/_repo && make test-tvos" + ${{ env.ci_scripts_path }}/vm-test.sh \ + ${{ env.scripts_path }} ${{ env.vm_name }} "tvos" archive-demo-ios: needs: [install-tools, test-ios, test-tvos] @@ -125,10 +122,8 @@ jobs: - 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" + ${{ env.ci_scripts_path }}/vm-test.sh \ + ${{ env.scripts_path }} ${{ env.vm_name }} "ios" archive-demo-tvos: needs: [install-tools, test-ios, test-tvos] @@ -139,10 +134,8 @@ jobs: - 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" + ${{ env.ci_scripts_path }}/vm-test.sh \ + ${{ env.scripts_path }} ${{ env.vm_name }} "tvos" clean: needs: [install-tools, archive-demo-ios, archive-demo-tvos] diff --git a/.github/workflows/scripts/setup-project.sh b/.github/workflows/scripts/setup-project.sh index ca28d769..6c29a7f1 100755 --- a/.github/workflows/scripts/setup-project.sh +++ b/.github/workflows/scripts/setup-project.sh @@ -10,22 +10,18 @@ then exit 1 fi +echo "==> $(pwd) <==" +source ./unlock-keychain.sh + repository_path="~/_repo" -keychain_password="admin" -keychain_path="~/Library/Keychains/login.keychain-db" certificate_path="$repository_path/Configuration/6YXTQTG8JJ_development.p12" certificate_password="6YXTQTG8JJ" - configuration_repo="github.com/SRGSSR/pillarbox-apple-configuration.git" configuration_dir_path="$repository_path/Configuration" configuration_script="$repository_path/Scripts/checkout-configuration.sh" configuration_branch="certificate" configuration_commit="HEAD" -function unlock_keychain { - security unlock-keychain -p $keychain_password $keychain_path -} - function import_certificate { security import $certificate_path -k $keychain_path -P $certificate_password -T /usr/bin/security -T /usr/bin/codesign } diff --git a/.github/workflows/scripts/unlock-keychain.sh b/.github/workflows/scripts/unlock-keychain.sh new file mode 100644 index 00000000..f4fb579d --- /dev/null +++ b/.github/workflows/scripts/unlock-keychain.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +keychain_password="admin" +keychain_path="~/Library/Keychains/login.keychain-db" + +function unlock_keychain { + security unlock-keychain -p $keychain_password $keychain_path +} diff --git a/.github/workflows/scripts/vm-archive.sh b/.github/workflows/scripts/vm-archive.sh new file mode 100755 index 00000000..6ef537ad --- /dev/null +++ b/.github/workflows/scripts/vm-archive.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +scripts_path="$1" +vm_name="$2" +platform="$3" + +repository_path="~/_repo" + +if [[ -z $scripts_path || -z $vm_name || -z $platform ]] +then + echo "[!] Usage: $(echo $0) " + exit 1 +fi + +source ./unlock-keychain.sh + +$scripts_path/run-vm-shell-command.sh $vm_name "cd $repository_path && echo $(unlock_keychain) && make archive-demo-$platform" diff --git a/.github/workflows/scripts/vm-check-quality.sh b/.github/workflows/scripts/vm-check-quality.sh new file mode 100755 index 00000000..cbf2c8d6 --- /dev/null +++ b/.github/workflows/scripts/vm-check-quality.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +scripts_path="$1" +vm_name="$2" + +repository_path="~/_repo" + +if [[ -z $scripts_path || -z $vm_name ]] +then + echo "[!] Usage: $(echo $0) " + exit 1 +fi + +$scripts_path/run-vm-shell-command.sh $vm_name "cd $repository_path && make check-quality" diff --git a/.github/workflows/scripts/vm-resolve-spm-dependencies.sh b/.github/workflows/scripts/vm-resolve-spm-dependencies.sh new file mode 100755 index 00000000..19704540 --- /dev/null +++ b/.github/workflows/scripts/vm-resolve-spm-dependencies.sh @@ -0,0 +1,12 @@ +scripts_path="$1" +vm_name="$2" + +repository_path="~/_repo" + +if [[ -z $scripts_path || -z $vm_name ]] +then + echo "[!] Usage: $(echo $0) " + exit 1 +fi + +$scripts_path/run-vm-shell-command.sh $vm_name "cd $repository_path && xcodebuild -resolvePackageDependencies -verbose" diff --git a/.github/workflows/scripts/vm-test.sh b/.github/workflows/scripts/vm-test.sh new file mode 100755 index 00000000..17527482 --- /dev/null +++ b/.github/workflows/scripts/vm-test.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +scripts_path="$1" +vm_name="$2" +platform="$3" + +repository_path="~/_repo" + +if [[ -z $scripts_path || -z $vm_name || -z $platform ]] +then + echo "[!] Usage: $(echo $0) " + exit 1 +fi + +$scripts_path/run-vm-shell-command.sh $vm_name "cd $repository_path && make test-$platform"