|
1 | | -name: mac |
2 | | - |
3 | | -on: |
4 | | - push: |
5 | | - |
6 | | -jobs: |
7 | | - |
8 | | - build-mac: |
9 | | - |
10 | | - runs-on: ${{ matrix.os }} |
11 | | - strategy: |
12 | | - matrix: |
13 | | - os: [macos-latest] |
14 | | - |
15 | | - steps: |
16 | | - - uses: actions/checkout@v4 |
17 | | - - name: set env vars |
18 | | - run: | |
19 | | - if [ ${{github.ref_name}} == 'juce8' ]; then |
20 | | - echo "GUI_BRANCH=development-juce8" >> "$GITHUB_ENV" |
21 | | - elif [ ${{github.ref_name}} == 'testing-juce8' ]; then |
22 | | - echo "GUI_BRANCH=testing-juce8" >> "$GITHUB_ENV" |
23 | | - else |
24 | | - echo "Invalid branch : ${{github.ref_name}}" |
25 | | - exit 1 |
26 | | - fi |
27 | | - - name: setup |
28 | | - run: | |
29 | | - cd ../.. |
30 | | - git clone https://github.com/open-ephys/plugin-GUI.git --branch $GUI_BRANCH |
31 | | - cd plugin-GUI/Build && cmake -G "Xcode" .. |
32 | | - - uses: maxim-lobanov/setup-xcode@v1 |
33 | | - with: |
34 | | - xcode-version: latest-stable |
35 | | - - name: build |
36 | | - run: | |
37 | | - cd Build |
38 | | - cmake -G "Xcode" .. |
39 | | - xcodebuild -configuration Release |
40 | | -# - name: test |
41 | | -# run: cd build && ctest |
42 | | - - name: codesign_deploy |
43 | | - if: github.ref == 'refs/heads/testing-juce8' |
44 | | - env: |
45 | | - ARTIFACTORY_ACCESS_TOKEN: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }} |
46 | | - MACOS_CERTIFICATE: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} |
47 | | - MACOS_CERTIFICATE_PWD: ${{ secrets.BUILD_CERTIFICATE_PWD }} |
48 | | - MACOS_CERTIFICATE_NAME: ${{ secrets.BUILD_CERTIFICATE_NAME }} |
49 | | - MACOS_CI_KEYCHAIN_PWD: ${{ secrets.PROD_MACOS_CI_KEYCHAIN_PWD }} |
50 | | - PROD_MACOS_NOTARIZATION_APPLE_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_APPLE_ID }} |
51 | | - PROD_MACOS_NOTARIZATION_TEAM_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_TEAM_ID }} |
52 | | - PROD_MACOS_NOTARIZATION_PWD: ${{ secrets.PROD_MACOS_NOTARIZATION_PWD }} |
53 | | - build_dir: "Build/Release" |
54 | | - package: SourceSim-mac |
55 | | - run: | |
56 | | - plugin_api=$(grep -rnw ../../plugin-GUI/Source -e '#define PLUGIN_API_VER' | grep -Eo "[0-9]" | tail -1) |
57 | | - tag=$(grep -w Source/OpenEphysLib.cpp -e 'info->libVersion' | grep -Eo "[0-9]+.[0-9]+.[0-9]+") |
58 | | - new_plugin_ver=$tag-API$plugin_api |
59 | | -
|
60 | | - mkdir plugins |
61 | | - cp -r $build_dir/*.bundle plugins |
62 | | -
|
63 | | - # Turn our base64-encoded certificate back to a regular .p12 file |
64 | | - echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12 |
65 | | -
|
66 | | - # We need to create a new keychain, otherwise using the certificate will prompt |
67 | | - # with a UI dialog asking for the certificate password, which we can't |
68 | | - # use in a headless CI environment |
69 | | - security create-keychain -p $MACOS_CI_KEYCHAIN_PWD build.keychain |
70 | | - security default-keychain -s build.keychain |
71 | | - security unlock-keychain -p $MACOS_CI_KEYCHAIN_PWD build.keychain |
72 | | - security import certificate.p12 -k build.keychain -P $MACOS_CERTIFICATE_PWD -T /usr/bin/codesign |
73 | | - security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $MACOS_CI_KEYCHAIN_PWD build.keychain |
74 | | - /usr/bin/codesign --force -s "$MACOS_CERTIFICATE_NAME" -v plugins/source-sim.bundle --deep --strict --timestamp --options=runtime |
75 | | -
|
76 | | - /usr/bin/codesign -dv --verbose=4 plugins/source-sim.bundle |
77 | | -
|
78 | | - # Store the notarization credentials so that we can prevent a UI password dialog from blocking the CI |
79 | | -
|
80 | | - echo "Create keychain profile" |
81 | | - xcrun notarytool store-credentials "notarytool-profile" --apple-id "$PROD_MACOS_NOTARIZATION_APPLE_ID" --team-id "$PROD_MACOS_NOTARIZATION_TEAM_ID" --password "$PROD_MACOS_NOTARIZATION_PWD" |
82 | | -
|
83 | | - # We can't notarize an app bundle directly, but we need to compress it as an archive. |
84 | | - # Therefore, we create a zip file containing our app bundle, so that we can send it to the |
85 | | - # notarization service |
86 | | -
|
87 | | - echo "Creating temp notarization archive" |
88 | | - /usr/bin/ditto -c -k --sequesterRsrc --keepParent plugins/source-sim.bundle source-sim.zip |
89 | | -
|
90 | | - # Here we send the notarization request to the Apple's Notarization service, waiting for the result. |
91 | | - # This typically takes a few seconds inside a CI environment, but it might take more depending on the App |
92 | | - # characteristics. Visit the Notarization docs for more information and strategies on how to optimize it if |
93 | | - # you're curious |
94 | | -
|
95 | | - echo "Notarize app" |
96 | | - xcrun notarytool submit "source-sim.zip" --keychain-profile "notarytool-profile" --wait |
97 | | -
|
98 | | - # Finally, we need to "attach the staple" to our executable, which will allow our app to be |
99 | | - # validated by macOS even when an internet connection is not available. |
100 | | - echo "Attach staple" |
101 | | - rm -r plugins/* |
102 | | - /usr/bin/ditto -x -k source-sim.zip plugins |
103 | | - xcrun stapler staple plugins/source-sim.bundle |
104 | | -
|
105 | | - spctl -vvv --assess --type exec plugins/source-sim.bundle |
106 | | -
|
107 | | - zipfile=${package}_${new_plugin_ver}.zip |
108 | | - /usr/bin/ditto -c -k --sequesterRsrc --keepParent plugins $zipfile |
109 | | - curl -H "X-JFrog-Art-Api:$ARTIFACTORY_ACCESS_TOKEN" -T $zipfile "https://openephys.jfrog.io/artifactory/SourceSim-plugin/mac/$zipfile" |
| 1 | +name: mac |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - '**' # Runs on push to any branch |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - main # Runs on pull requests targeting the main branch |
| 10 | + |
| 11 | +jobs: |
| 12 | + |
| 13 | + build-mac: |
| 14 | + |
| 15 | + if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.base_ref == 'main') |
| 16 | + runs-on: macos-latest |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + os: [macos-latest] |
| 20 | + |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v4 |
| 23 | + - name: setup |
| 24 | + run: | |
| 25 | + cd ../.. |
| 26 | + git clone https://github.com/open-ephys/plugin-GUI.git --branch main |
| 27 | + cd plugin-GUI/Build && cmake -G "Xcode" .. |
| 28 | + - name: build |
| 29 | + run: | |
| 30 | + cd Build |
| 31 | + cmake -G "Xcode" .. |
| 32 | + xcodebuild -configuration Release |
| 33 | +# - name: test |
| 34 | +# run: cd build && ctest |
| 35 | + - name: codesign_deploy |
| 36 | + if: github.ref == 'refs/heads/main' |
| 37 | + env: |
| 38 | + ARTIFACTORY_ACCESS_TOKEN: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }} |
| 39 | + MACOS_CERTIFICATE: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} |
| 40 | + MACOS_CERTIFICATE_PWD: ${{ secrets.BUILD_CERTIFICATE_PWD }} |
| 41 | + MACOS_CERTIFICATE_NAME: ${{ secrets.BUILD_CERTIFICATE_NAME }} |
| 42 | + MACOS_CI_KEYCHAIN_PWD: ${{ secrets.PROD_MACOS_CI_KEYCHAIN_PWD }} |
| 43 | + PROD_MACOS_NOTARIZATION_APPLE_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_APPLE_ID }} |
| 44 | + PROD_MACOS_NOTARIZATION_TEAM_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_TEAM_ID }} |
| 45 | + PROD_MACOS_NOTARIZATION_PWD: ${{ secrets.PROD_MACOS_NOTARIZATION_PWD }} |
| 46 | + build_dir: "Build/Release" |
| 47 | + package: SourceSim-mac |
| 48 | + run: | |
| 49 | + plugin_api=$(grep -rnw ../../plugin-GUI/Source -e '#define PLUGIN_API_VER' | grep -Eo "[0-9]*" | tail -1) |
| 50 | + tag=$(grep -w Source/OpenEphysLib.cpp -e 'info->libVersion' | grep -Eo "[0-9]+.[0-9]+.[0-9]+") |
| 51 | + new_plugin_ver=$tag-API$plugin_api |
| 52 | +
|
| 53 | + mkdir plugins |
| 54 | + cp -r $build_dir/*.bundle plugins |
| 55 | +
|
| 56 | + # Turn our base64-encoded certificate back to a regular .p12 file |
| 57 | + echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12 |
| 58 | +
|
| 59 | + # We need to create a new keychain, otherwise using the certificate will prompt |
| 60 | + # with a UI dialog asking for the certificate password, which we can't |
| 61 | + # use in a headless CI environment |
| 62 | + security create-keychain -p $MACOS_CI_KEYCHAIN_PWD build.keychain |
| 63 | + security default-keychain -s build.keychain |
| 64 | + security unlock-keychain -p $MACOS_CI_KEYCHAIN_PWD build.keychain |
| 65 | + security import certificate.p12 -k build.keychain -P $MACOS_CERTIFICATE_PWD -T /usr/bin/codesign |
| 66 | + security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $MACOS_CI_KEYCHAIN_PWD build.keychain |
| 67 | + /usr/bin/codesign --force -s "$MACOS_CERTIFICATE_NAME" -v plugins/source-sim.bundle --deep --strict --timestamp --options=runtime |
| 68 | +
|
| 69 | + /usr/bin/codesign -dv --verbose=4 plugins/source-sim.bundle |
| 70 | +
|
| 71 | + # Store the notarization credentials so that we can prevent a UI password dialog from blocking the CI |
| 72 | +
|
| 73 | + echo "Create keychain profile" |
| 74 | + xcrun notarytool store-credentials "notarytool-profile" --apple-id "$PROD_MACOS_NOTARIZATION_APPLE_ID" --team-id "$PROD_MACOS_NOTARIZATION_TEAM_ID" --password "$PROD_MACOS_NOTARIZATION_PWD" |
| 75 | +
|
| 76 | + # We can't notarize an app bundle directly, but we need to compress it as an archive. |
| 77 | + # Therefore, we create a zip file containing our app bundle, so that we can send it to the |
| 78 | + # notarization service |
| 79 | +
|
| 80 | + echo "Creating temp notarization archive" |
| 81 | + /usr/bin/ditto -c -k --sequesterRsrc --keepParent plugins/source-sim.bundle source-sim.zip |
| 82 | +
|
| 83 | + # Here we send the notarization request to the Apple's Notarization service, waiting for the result. |
| 84 | + # This typically takes a few seconds inside a CI environment, but it might take more depending on the App |
| 85 | + # characteristics. Visit the Notarization docs for more information and strategies on how to optimize it if |
| 86 | + # you're curious |
| 87 | +
|
| 88 | + echo "Notarize app" |
| 89 | + xcrun notarytool submit "source-sim.zip" --keychain-profile "notarytool-profile" --wait |
| 90 | +
|
| 91 | + # Finally, we need to "attach the staple" to our executable, which will allow our app to be |
| 92 | + # validated by macOS even when an internet connection is not available. |
| 93 | + echo "Attach staple" |
| 94 | + rm -r plugins/* |
| 95 | + /usr/bin/ditto -x -k source-sim.zip plugins |
| 96 | + xcrun stapler staple plugins/source-sim.bundle |
| 97 | +
|
| 98 | + spctl -vvv --assess --type exec plugins/source-sim.bundle |
| 99 | +
|
| 100 | + zipfile=${package}_${new_plugin_ver}.zip |
| 101 | + /usr/bin/ditto -c -k --sequesterRsrc --keepParent plugins $zipfile |
| 102 | + curl -H "X-JFrog-Art-Api:$ARTIFACTORY_ACCESS_TOKEN" -T $zipfile "https://openephys.jfrog.io/artifactory/SourceSim-plugin/mac/$zipfile" |
0 commit comments