| 1 | name: Build & Test |
| 2 | |
| 3 | on: [push, pull_request] |
| 4 | |
| 5 | permissions: |
| 6 | contents: read |
| 7 | |
| 8 | jobs: |
| 9 | windows: |
| 10 | runs-on: windows-latest |
| 11 | |
| 12 | steps: |
| 13 | - uses: actions/checkout@v3 |
| 14 | |
| 15 | - name: Setup MSBuild |
| 16 | uses: microsoft/[email protected] |
| 17 | |
| 18 | - name: Download libsodium |
| 19 | shell: bash |
| 20 | run: | |
| 21 | curl -o libsodium-1.0.18-stable-msvc.zip https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-stable-msvc.zip |
| 22 | unzip libsodium-1.0.18-stable-msvc.zip |
| 23 | |
| 24 | - name: Run cmake |
| 25 | shell: bash |
| 26 | run: | |
| 27 | export sodium_DIR="$(pwd)/libsodium/" |
| 28 | mkdir build/ |
| 29 | cd build/ |
| 30 | cmake -T host=x64 -A x64 .. |
| 31 | |
| 32 | - name: Run MSBuild |
| 33 | run: | |
| 34 | cd build |
| 35 | msbuild libxeddsa.sln |
| 36 | |
| 37 | - name: Run ctest in Debug configuration |
| 38 | run: | |
| 39 | cd build |
| 40 | ctest -C Debug .. |
| 41 | |
| 42 | - name: Run ctest in Release configuration |
| 43 | run: | |
| 44 | cd build |
| 45 | ctest -C Release .. |
| 46 | |
| 47 | - name: Rename the binaries |
| 48 | run: | |
| 49 | cd bin/ |
| 50 | mv xeddsa_static.lib libxeddsa-windows-amd64.lib |
| 51 | mv xeddsa.lib libxeddsa-windows-amd64.dll.lib |
| 52 | mv xeddsa.dll libxeddsa-windows-amd64.dll |
| 53 | |
| 54 | - name: Upload the binaries |
| 55 | uses: actions/[email protected] |
| 56 | with: |
| 57 | name: libxeddsa-windows-amd64 |
| 58 | path: | |
| 59 | bin/libxeddsa-windows-amd64.lib |
| 60 | bin/libxeddsa-windows-amd64.dll.lib |
| 61 | bin/libxeddsa-windows-amd64.dll |
| 62 | |
| 63 | macos-amd64: |
| 64 | runs-on: macos-latest |
| 65 | |
| 66 | steps: |
| 67 | - uses: actions/checkout@v3 |
| 68 | |
| 69 | - name: Run cmake |
| 70 | run: | |
| 71 | mkdir build/ |
| 72 | cd build/ |
| 73 | FORCE_URANDOM= cmake .. |
| 74 | |
| 75 | - name: Run make |
| 76 | run: | |
| 77 | cd build/ |
| 78 | make |
| 79 | |
| 80 | - name: Run ctest |
| 81 | run: | |
| 82 | cd build/ |
| 83 | ctest .. |
| 84 | |
| 85 | - name: Rename the binaries |
| 86 | run: | |
| 87 | cd bin/ |
| 88 | mv static/libxeddsa.a libxeddsa-macos-amd64.a |
| 89 | mv dynamic/libxeddsa.dylib libxeddsa-macos-amd64.dylib |
| 90 | |
| 91 | - name: Upload the binaries |
| 92 | uses: actions/[email protected] |
| 93 | with: |
| 94 | name: libxeddsa-macos-amd64 |
| 95 | path: | |
| 96 | bin/libxeddsa-macos-amd64.a |
| 97 | bin/libxeddsa-macos-amd64.dylib |
| 98 | |
| 99 | macos-arm64: |
| 100 | runs-on: macos-latest |
| 101 | |
| 102 | steps: |
| 103 | - uses: actions/checkout@v3 |
| 104 | |
| 105 | - name: Install libsodium |
| 106 | run: | |
| 107 | brew uninstall --ignore-dependencies libsodium |
| 108 | brew fetch --force --bottle-tag=arm64_ventura libsodium | tee brew_output |
| 109 | downloaded_to=$(grep "Downloaded to" brew_output) |
| 110 | downloaded_to_split=($downloaded_to) |
| 111 | brew install ${downloaded_to_split[2]} |
| 112 | |
| 113 | - name: Run cmake |
| 114 | run: | |
| 115 | mkdir build/ |
| 116 | cd build/ |
| 117 | FORCE_URANDOM= cmake -DCMAKE_OSX_ARCHITECTURES=arm64 .. |
| 118 | |
| 119 | - name: Run make |
| 120 | run: | |
| 121 | cd build/ |
| 122 | make |
| 123 | |
| 124 | - name: Rename the binaries |
| 125 | run: | |
| 126 | cd bin/ |
| 127 | mv static/libxeddsa.a libxeddsa-macos-arm64.a |
| 128 | mv dynamic/libxeddsa.dylib libxeddsa-macos-arm64.dylib |
| 129 | |
| 130 | - name: Upload the binaries |
| 131 | uses: actions/[email protected] |
| 132 | with: |
| 133 | name: libxeddsa-macos-arm64 |
| 134 | path: | |
| 135 | bin/libxeddsa-macos-arm64.a |
| 136 | bin/libxeddsa-macos-arm64.dylib |
| 137 | |
| 138 | ubuntu: |
| 139 | runs-on: ubuntu-latest |
| 140 | |
| 141 | steps: |
| 142 | - uses: actions/checkout@v3 |
| 143 | |
| 144 | - name: Install libsodium |
| 145 | run: sudo apt-get install -y libsodium-dev |
| 146 | |
| 147 | - name: Run cmake |
| 148 | run: | |
| 149 | mkdir build/ |
| 150 | cd build/ |
| 151 | FORCE_URANDOM= cmake .. |
| 152 | |
| 153 | - name: Run make |
| 154 | run: | |
| 155 | cd build/ |
| 156 | make |
| 157 | |
| 158 | - name: Run ctest |
| 159 | run: | |
| 160 | cd build/ |
| 161 | ctest .. |
| 162 | |
| 163 | - name: Rename the binaries |
| 164 | run: | |
| 165 | cd bin/ |
| 166 | mv static/libxeddsa.a libxeddsa-linux-amd64.a |
| 167 | mv dynamic/libxeddsa.so libxeddsa-linux-amd64.so |
| 168 | |
| 169 | - name: Upload the binaries |
| 170 | uses: actions/[email protected] |
| 171 | with: |
| 172 | name: libxeddsa-linux-amd64 |
| 173 | path: | |
| 174 | bin/libxeddsa-linux-amd64.a |
| 175 | bin/libxeddsa-linux-amd64.so |