|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [master] |
| 6 | + pull_request: |
| 7 | + |
| 8 | +env: |
| 9 | + CARGO_TERM_COLOR: always |
| 10 | + RUST_BACKTRACE: 1 |
| 11 | + # Faster compilation and error on warnings |
| 12 | + RUSTFLAGS: "-C debuginfo=0 -D warnings" |
| 13 | + RUSTDOCFLAGS: "-D warnings" |
| 14 | + CARGO_TERM_VERBOSE: true |
| 15 | + FEATURES: malloc,block,exception,catch_all,verify_message |
| 16 | + UNSTABLE_FEATURES: unstable_autoreleasesafe |
| 17 | + MACOSX_DEPLOYMENT_TARGET: 10.7 |
| 18 | + IPHONEOS_DEPLOYMENT_TARGET: 7.0 |
| 19 | + # We only support compiling Objective-C code with clang |
| 20 | + CC: clang |
| 21 | + CXX: clang++ |
| 22 | + |
| 23 | +jobs: |
| 24 | + fmt: |
| 25 | + name: Check formatting |
| 26 | + runs-on: ubuntu-latest |
| 27 | + steps: |
| 28 | + - uses: actions/checkout@v2 |
| 29 | + - name: Check formatting |
| 30 | + uses: actions-rs/cargo@v1 |
| 31 | + with: |
| 32 | + command: fmt |
| 33 | + args: -- --check |
| 34 | + |
| 35 | + test: |
| 36 | + name: ${{ matrix.name }} |
| 37 | + |
| 38 | + strategy: |
| 39 | + fail-fast: false |
| 40 | + matrix: |
| 41 | + include: |
| 42 | + - name: Test macOS 10.15 |
| 43 | + os: macos-10.15 |
| 44 | + target: x86_64-apple-darwin |
| 45 | + - name: Test macOS 11 |
| 46 | + os: macos-11 |
| 47 | + target: x86_64-apple-darwin |
| 48 | + - name: Test macOS nightly |
| 49 | + os: macos-latest |
| 50 | + target: x86_64-apple-darwin |
| 51 | + rust: |
| 52 | + toolchain: nightly |
| 53 | + - name: Build macOS 32bit |
| 54 | + os: macos-10.15 |
| 55 | + target: i686-apple-darwin |
| 56 | + rust: |
| 57 | + toolchain: nightly |
| 58 | + target: x86_64-apple-darwin |
| 59 | + components: rust-src |
| 60 | + args: -Zbuild-std -Zdoctest-xcompile |
| 61 | + # 32-bit support was removed in 10.15, so we can't test the |
| 62 | + # binary, only build it |
| 63 | + test-args: --no-run |
| 64 | + - name: Test GNUStep |
| 65 | + os: ubuntu-latest |
| 66 | + target: x86_64-unknown-linux-gnu |
| 67 | + features: gnustep-1-9 |
| 68 | + args: --features gnustep-1-9 |
| 69 | + - name: Test GNUStep 32bit |
| 70 | + os: ubuntu-latest |
| 71 | + target: i686-unknown-linux-gnu |
| 72 | + cflags: -m32 |
| 73 | + configureflags: --target=x86-pc-linux-gnu |
| 74 | + args: --features gnustep-1-9 |
| 75 | + - name: Build iOS ARM64 |
| 76 | + os: macos-latest |
| 77 | + target: aarch64-apple-ios |
| 78 | + test-args: --no-run |
| 79 | + - name: Build iOS 64bit x86 |
| 80 | + os: macos-latest |
| 81 | + target: x86_64-apple-ios |
| 82 | + test-args: --no-run |
| 83 | + - name: Build iOS ARMv7 |
| 84 | + os: macos-latest |
| 85 | + target: armv7-apple-ios |
| 86 | + rust: |
| 87 | + toolchain: nightly |
| 88 | + target: x86_64-apple-darwin |
| 89 | + components: rust-src |
| 90 | + args: -Zbuild-std -Zdoctest-xcompile |
| 91 | + test-args: --no-run |
| 92 | + - name: Build iOS ARMv7s |
| 93 | + os: macos-latest |
| 94 | + target: armv7s-apple-ios |
| 95 | + rust: |
| 96 | + toolchain: nightly |
| 97 | + target: x86_64-apple-darwin |
| 98 | + components: rust-src |
| 99 | + args: -Zbuild-std -Zdoctest-xcompile |
| 100 | + test-args: --no-run |
| 101 | + - name: Build iOS 32bit x86 |
| 102 | + os: macos-latest |
| 103 | + target: i386-apple-ios |
| 104 | + rust: |
| 105 | + toolchain: nightly |
| 106 | + target: x86_64-apple-darwin |
| 107 | + components: rust-src |
| 108 | + args: -Zbuild-std -Zdoctest-xcompile |
| 109 | + test-args: --no-run |
| 110 | + |
| 111 | + env: |
| 112 | + CARGO_BUILD_TARGET: ${{ matrix.target }} |
| 113 | + CFLAGS: ${{ matrix.cflags }} |
| 114 | + CXXFLAGS: ${{ matrix.cflags }} |
| 115 | + ASMFLAGS: ${{ matrix.cflags }} |
| 116 | + LDFLAGS: ${{ matrix.cflags }} |
| 117 | + |
| 118 | + runs-on: ${{ matrix.os }} |
| 119 | + |
| 120 | + steps: |
| 121 | + - uses: actions/checkout@v2 |
| 122 | + |
| 123 | + - name: Install Clang |
| 124 | + if: contains(matrix.os, 'ubuntu') |
| 125 | + run: sudo apt-get -y install clang |
| 126 | + |
| 127 | + - name: Install cross compilation tools |
| 128 | + if: matrix.target == 'i686-unknown-linux-gnu' |
| 129 | + run: | |
| 130 | + sudo dpkg --add-architecture i386 |
| 131 | + sudo apt-get update |
| 132 | + sudo apt-get -y install gcc-multilib libgcc-10-dev:i386 \ |
| 133 | + libc6-dev:i386 libstdc++-10-dev:i386 libffi-dev:i386 \ |
| 134 | + libxml2-dev:i386 libicu-dev:i386 |
| 135 | +
|
| 136 | + - name: Download macOS 10.13 SDK (supports 32-bit) |
| 137 | + if: matrix.target == 'i686-apple-darwin' |
| 138 | + run: | |
| 139 | + wget https://github.com/alexey-lysiuk/macos-sdk/releases/download/10.13/MacOSX10.13.tar.bz2 |
| 140 | + tar -xyf MacOSX10.13.tar.bz2 |
| 141 | + echo "SDKROOT=$(pwd)/MacOSX10.13.sdk" >> $GITHUB_ENV |
| 142 | +
|
| 143 | + - name: Cache GNUStep |
| 144 | + if: contains(matrix.os, 'ubuntu') |
| 145 | + id: cache-gnustep |
| 146 | + uses: actions/cache@v2 |
| 147 | + with: |
| 148 | + # Ideally I would have just cached build-files, and then rerun make |
| 149 | + # every time, letting it figure out what's changed. But GNUStep-Base |
| 150 | + # ./configure invalidates the cache, which makes it very hard to |
| 151 | + # know when to rebuild and when not to. |
| 152 | + # So instead we just cache the final output: |
| 153 | + # - lib/libobjc.so |
| 154 | + # - lib/libgnustep-base.so |
| 155 | + # - include/Foundation/* |
| 156 | + # - include/objc/* |
| 157 | + # - ... |
| 158 | + path: | |
| 159 | + ~/gnustep/lib |
| 160 | + ~/gnustep/include |
| 161 | + key: ${{ matrix.name }}-gnustep-libobjc2_1.9-make_2.9.0-base_1.28.0 |
| 162 | + |
| 163 | + - name: Setup GNUStep environment |
| 164 | + if: contains(matrix.os, 'ubuntu') |
| 165 | + run: | |
| 166 | + mkdir -p $HOME/gnustep |
| 167 | + echo "PATH=$HOME/gnustep/bin:$PATH" >> $GITHUB_ENV |
| 168 | + echo "LIBRARY_PATH=$HOME/gnustep/lib:$LIBRARY_PATH" >> $GITHUB_ENV |
| 169 | + echo "LD_LIBRARY_PATH=$HOME/gnustep/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV |
| 170 | + echo "CPATH=$HOME/gnustep/include:$CPATH" >> $GITHUB_ENV |
| 171 | + ls -al ~/gnustep/* || true # Ignore failures |
| 172 | +
|
| 173 | + - name: Install Make and Cmake |
| 174 | + if: contains(matrix.os, 'ubuntu') && steps.cache-gnustep.outputs.cache-hit != 'true' |
| 175 | + run: sudo apt-get -y install make cmake |
| 176 | + |
| 177 | + - name: Install GNUStep libobjc2 v1.9 |
| 178 | + if: contains(matrix.os, 'ubuntu') && steps.cache-gnustep.outputs.cache-hit != 'true' |
| 179 | + run: | |
| 180 | + wget https://github.com/gnustep/libobjc2/archive/refs/tags/v1.9.tar.gz |
| 181 | + tar -xzf v1.9.tar.gz |
| 182 | + mkdir -p libobjc2-1.9/build |
| 183 | + cd libobjc2-1.9/build |
| 184 | + cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=$HOME/gnustep -DTESTS=OFF .. |
| 185 | + make install |
| 186 | +
|
| 187 | + - name: Install GNUStep make |
| 188 | + if: contains(matrix.os, 'ubuntu') && steps.cache-gnustep.outputs.cache-hit != 'true' |
| 189 | + run: | |
| 190 | + wget https://github.com/gnustep/tools-make/archive/refs/tags/make-2_9_0.tar.gz |
| 191 | + tar -xzf make-2_9_0.tar.gz |
| 192 | + mkdir -p tools-make-make-2_9_0/build |
| 193 | + cd tools-make-make-2_9_0/build |
| 194 | + ../configure --prefix=$HOME/gnustep --with-library-combo=ng-gnu-gnu |
| 195 | + make install |
| 196 | +
|
| 197 | + - name: Install GNUStep-Base |
| 198 | + if: contains(matrix.os, 'ubuntu') && steps.cache-gnustep.outputs.cache-hit != 'true' |
| 199 | + run: | |
| 200 | + wget https://github.com/gnustep/libs-base/archive/refs/tags/base-1_28_0.tar.gz |
| 201 | + tar -xzf base-1_28_0.tar.gz |
| 202 | + cd libs-base-base-1_28_0 |
| 203 | + ./configure --prefix=$HOME/gnustep --disable-tls --disable-xslt ${{ matrix.platform.configureflags }} |
| 204 | + make install |
| 205 | + ls -al $HOME/gnustep/* |
| 206 | +
|
| 207 | + - name: Cache Rust |
| 208 | + uses: actions/cache@v2 |
| 209 | + with: |
| 210 | + path: | |
| 211 | + ~/.cargo/ |
| 212 | + target/ |
| 213 | + key: cargo-${{ matrix.name }}-${{ hashFiles('**/Cargo.toml') }} |
| 214 | + |
| 215 | + - name: Install Rust toolchain |
| 216 | + uses: actions-rs/toolchain@v1 |
| 217 | + with: |
| 218 | + toolchain: ${{ matrix.rust.toolchain || 'stable' }} |
| 219 | + profile: minimal |
| 220 | + override: true |
| 221 | + components: ${{ matrix.rust.components }} |
| 222 | + # Allows installing for a different base target |
| 223 | + target: ${{ matrix.rust.target || matrix.target }} |
| 224 | + |
| 225 | + - name: Check documentation |
| 226 | + uses: actions-rs/cargo@v1 |
| 227 | + with: |
| 228 | + command: doc |
| 229 | + args: --no-deps --document-private-items ${{ matrix.args }} |
| 230 | + |
| 231 | + - name: Test without features |
| 232 | + uses: actions-rs/cargo@v1 |
| 233 | + with: |
| 234 | + command: test |
| 235 | + args: --no-fail-fast --no-default-features ${{ matrix.args }} ${{ matrix.test-args }} |
| 236 | + |
| 237 | + - name: Test with features |
| 238 | + uses: actions-rs/cargo@v1 |
| 239 | + with: |
| 240 | + command: test |
| 241 | + args: --no-fail-fast --features ${{ env.FEATURES }} ${{ matrix.args }} ${{ matrix.test-args }} |
| 242 | + |
| 243 | + - name: Test with unstable features |
| 244 | + if: matrix.rust.toolchain == 'nightly' |
| 245 | + uses: actions-rs/cargo@v1 |
| 246 | + with: |
| 247 | + command: test |
| 248 | + # Not using --all-features because that would enable e.g. gnustep |
| 249 | + args: --no-fail-fast --features ${{ env.FEATURES }},${{ env.UNSTABLE_FEATURES }} ${{ matrix.args }} ${{ matrix.test-args }} |
0 commit comments