|
| 1 | +name: build-oqs |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + pull_request: |
| 6 | + paths: |
| 7 | + - '.github/workflows/build-oqs.yml' |
| 8 | + - 'apothecary/formulas/liboqs/**' |
| 9 | + - 'apothecary/formulas/oqsprovider/**' |
| 10 | + - 'apothecary/formulas/openssh/**' |
| 11 | + - 'scripts/tests/oqs/**' |
| 12 | + - 'scripts/tests/test-package-platforms.sh' |
| 13 | + - 'scripts/build-modular-optional.sh' |
| 14 | + - 'scripts/package-individual.sh' |
| 15 | + - 'scripts/package-platform.sh' |
| 16 | + - 'scripts/calculate_formulas.sh' |
| 17 | + - 'scripts/modular-cache-key.sh' |
| 18 | + - 'scripts/cache-toolchain.sh' |
| 19 | + - 'scripts/secure.sh' |
| 20 | + - 'scripts/osx/install.sh' |
| 21 | + - 'scripts/apple-install-tools.sh' |
| 22 | + - 'scripts/check-apple-sdk.sh' |
| 23 | + - 'scripts/test-openframeworks-libraries.sh' |
| 24 | + push: |
| 25 | + branches: [bleeding, master] |
| 26 | + paths: |
| 27 | + - '.github/workflows/build-oqs.yml' |
| 28 | + - 'apothecary/formulas/liboqs/**' |
| 29 | + - 'apothecary/formulas/oqsprovider/**' |
| 30 | + - 'apothecary/formulas/openssh/**' |
| 31 | + - 'scripts/tests/oqs/**' |
| 32 | + - 'scripts/tests/test-package-platforms.sh' |
| 33 | + - 'scripts/build-modular-optional.sh' |
| 34 | + - 'scripts/package-individual.sh' |
| 35 | + - 'scripts/package-platform.sh' |
| 36 | + - 'scripts/calculate_formulas.sh' |
| 37 | + - 'scripts/modular-cache-key.sh' |
| 38 | + - 'scripts/cache-toolchain.sh' |
| 39 | + - 'scripts/secure.sh' |
| 40 | + - 'scripts/osx/install.sh' |
| 41 | + - 'scripts/apple-install-tools.sh' |
| 42 | + - 'scripts/check-apple-sdk.sh' |
| 43 | + - 'scripts/test-openframeworks-libraries.sh' |
| 44 | + |
| 45 | +concurrency: |
| 46 | + group: ${{ github.workflow }}-${{ startsWith(github.ref, 'refs/tags/') && github.run_id || github.event.pull_request.number || github.ref }} |
| 47 | + cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/') }} |
| 48 | + |
| 49 | +permissions: |
| 50 | + contents: write |
| 51 | + |
| 52 | +env: |
| 53 | + BUILD_PROFILE_ID: "2" |
| 54 | + |
| 55 | +jobs: |
| 56 | + test: |
| 57 | + permissions: |
| 58 | + contents: read |
| 59 | + runs-on: ubuntu-latest |
| 60 | + steps: |
| 61 | + - uses: actions/checkout@v7.0.1 |
| 62 | + - run: bash -n apothecary/formulas/liboqs/liboqs.sh |
| 63 | + - run: bash -n apothecary/formulas/oqsprovider/oqsprovider.sh |
| 64 | + - run: bash -n apothecary/formulas/openssh/openssh.sh |
| 65 | + - run: bash -n scripts/package-individual.sh |
| 66 | + - run: bash -n scripts/build-modular-optional.sh |
| 67 | + - run: bash scripts/tests/test-package-platforms.sh |
| 68 | + - run: ruby scripts/tests/test-workflow-scheduling.rb |
| 69 | + - run: bash -n scripts/tests/oqs/generate-ofx-addon.sh |
| 70 | + - run: bash -n scripts/tests/oqs/test-ofx-addon.sh |
| 71 | + - run: bash -n scripts/tests/oqs/install-ofx-addon.sh |
| 72 | + |
| 73 | + osx: |
| 74 | + needs: test |
| 75 | + name: optional oqs-osx |
| 76 | + runs-on: macos-15 |
| 77 | + env: |
| 78 | + TARGET: osx |
| 79 | + TYPE: osx |
| 80 | + OPTIONAL_ARCHS: x86_64 arm64 |
| 81 | + PACKAGE_LIBS: liboqs oqsprovider openssh |
| 82 | + ALWAYS_BUILD: 1 |
| 83 | + NO_FORCE: 1 |
| 84 | + steps: |
| 85 | + - uses: actions/checkout@v7.0.1 |
| 86 | + - name: Install |
| 87 | + run: | |
| 88 | + ./scripts/osx/install.sh |
| 89 | + echo "$(brew --prefix)/bin" >> "$GITHUB_PATH" |
| 90 | + - name: Ensure Ninja is available for the cache fingerprint |
| 91 | + run: command -v ninja >/dev/null || brew install ninja |
| 92 | + - name: Compute exact modular cache key |
| 93 | + id: key |
| 94 | + run: | |
| 95 | + digest=$( |
| 96 | + { |
| 97 | + bash scripts/modular-cache-key.sh liboqs |
| 98 | + bash scripts/modular-cache-key.sh oqsprovider |
| 99 | + bash scripts/modular-cache-key.sh openssh |
| 100 | + } | shasum -a 256 | awk '{print $1}' |
| 101 | + ) |
| 102 | + printf 'key=modular-v1-osx-oqs-%s\n' "$digest" >> "$GITHUB_OUTPUT" |
| 103 | + - name: Restore compiled modular outputs |
| 104 | + id: cache |
| 105 | + uses: actions/cache/restore@v6.1.0 |
| 106 | + with: |
| 107 | + key: ${{ steps.key.outputs.key }} |
| 108 | + path: | |
| 109 | + out/liboqs |
| 110 | + out/oqsprovider |
| 111 | + out/openssh |
| 112 | + - name: Report modular cache result |
| 113 | + env: |
| 114 | + CACHE_KEY: ${{ steps.key.outputs.key }} |
| 115 | + CACHE_HIT: ${{ steps.cache.outputs.cache-hit }} |
| 116 | + run: | |
| 117 | + printf '### Modular cache: %s / %s\n\nKey: `%s`\n\nExact hit: `%s`\n' "$TARGET" "$PACKAGE_LIBS" "$CACHE_KEY" "${CACHE_HIT:-false}" >> "$GITHUB_STEP_SUMMARY" |
| 118 | + - name: Build or reuse and package modular libraries |
| 119 | + env: |
| 120 | + MODULAR_CACHE_HIT: ${{ steps.cache.outputs.cache-hit }} |
| 121 | + run: bash scripts/build-modular-optional.sh |
| 122 | + - name: Verify packaged archives |
| 123 | + run: | |
| 124 | + shopt -s nullglob |
| 125 | + for library in liboqs oqsprovider openssh; do |
| 126 | + packages=(out/oF_${library}_osx_*.tar.bz2) |
| 127 | + test "${#packages[@]}" -gt 0 |
| 128 | + ls -lah "${packages[@]}" |
| 129 | + done |
| 130 | + - name: Save compiled modular outputs |
| 131 | + if: steps.cache.outputs.cache-hit != 'true' |
| 132 | + uses: actions/cache/save@v6.1.0 |
| 133 | + with: |
| 134 | + key: ${{ steps.key.outputs.key }} |
| 135 | + path: | |
| 136 | + out/liboqs |
| 137 | + out/oqsprovider |
| 138 | + out/openssh |
| 139 | + - name: Run OpenSSH OQS smoke tests |
| 140 | + run: | |
| 141 | + host=$(uname -m) |
| 142 | + case "$host" in |
| 143 | + arm64|aarch64) native=MAC_ARM64; foreign=MAC; foreign_macho='x86_64' ;; |
| 144 | + x86_64) native=MAC; foreign=MAC_ARM64; foreign_macho='arm64' ;; |
| 145 | + *) echo "Unsupported host architecture: $host" >&2; exit 1 ;; |
| 146 | + esac |
| 147 | + bash scripts/tests/oqs/test-openssh.sh out osx "$native" |
| 148 | + native_bin=out/openssh/bin/osx/$native/ssh |
| 149 | + foreign_bin=out/openssh/bin/osx/$foreign/ssh |
| 150 | + test -x "$native_bin" |
| 151 | + test -x "$foreign_bin" |
| 152 | + file "$native_bin" |
| 153 | + file "$foreign_bin" |
| 154 | + file "$foreign_bin" | grep -F "$foreign_macho" |
| 155 | +
|
| 156 | + - name: Generate private ofxOQS addon from packages |
| 157 | + run: bash scripts/tests/oqs/generate-ofx-addon.sh out out/ofxOQS osx |
| 158 | + - name: Test ofxOQS addon layout and native smoke tests |
| 159 | + run: bash scripts/tests/oqs/test-ofx-addon.sh out/ofxOQS |
| 160 | + |
| 161 | + - name: Upload validation package |
| 162 | + uses: actions/upload-artifact@v7.0.2 |
| 163 | + with: |
| 164 | + name: oqs-osx |
| 165 | + path: | |
| 166 | + out/oF_liboqs_osx_*.tar.bz2 |
| 167 | + out/oF_oqsprovider_osx_*.tar.bz2 |
| 168 | + out/oF_openssh_osx_*.tar.bz2 |
| 169 | + if-no-files-found: error |
| 170 | + - name: Upload private ofxOQS addon |
| 171 | + uses: actions/upload-artifact@v7.0.2 |
| 172 | + with: |
| 173 | + name: ofxOQS-osx |
| 174 | + path: out/ofxOQS |
| 175 | + if-no-files-found: error |
| 176 | + - name: Upload Open Quantum Safe package to latest-modular |
| 177 | + if: github.event_name == 'push' && github.repository == 'openframeworks/apothecary' |
| 178 | + uses: danoli3/action-gh-release@ec40b04e78c39008f73c4ca3fdf9b51df604c4ed # temporary patch: softprops/action-gh-release#852 |
| 179 | + with: |
| 180 | + token: ${{ secrets.PAT_TOKEN || secrets.GITHUB_TOKEN }} |
| 181 | + tag_name: latest-modular |
| 182 | + fail_on_unmatched_files: true |
| 183 | + files: | |
| 184 | + out/oF_liboqs_osx_*.tar.bz2 |
| 185 | + out/oF_oqsprovider_osx_*.tar.bz2 |
| 186 | + out/oF_openssh_osx_*.tar.bz2 |
| 187 | +
|
| 188 | + of-addon: |
| 189 | + needs: osx |
| 190 | + name: ofxOQS openFrameworks example |
| 191 | + runs-on: macos-15 |
| 192 | + steps: |
| 193 | + - uses: actions/checkout@v7.0.1 |
| 194 | + with: |
| 195 | + path: apothecary |
| 196 | + - uses: actions/checkout@v7.0.1 |
| 197 | + with: |
| 198 | + repository: openframeworks/openFrameworks |
| 199 | + ref: master |
| 200 | + submodules: recursive |
| 201 | + path: openFrameworks |
| 202 | + - name: Download private ofxOQS addon |
| 203 | + uses: actions/download-artifact@v8 |
| 204 | + with: |
| 205 | + name: ofxOQS-osx |
| 206 | + path: openFrameworks/addons/ofxOQS |
| 207 | + - name: Install openFrameworks osx libraries |
| 208 | + working-directory: openFrameworks |
| 209 | + run: scripts/osx/download_libs.sh -b |
| 210 | + - name: Build ofxOQS example |
| 211 | + working-directory: openFrameworks/addons/ofxOQS/example |
| 212 | + run: make -j4 |
0 commit comments