1name: CI 2on: [push, pull_request] 3 4jobs: 5 build: 6 name: Build 7 runs-on: ${{ matrix.os }} 8 strategy: 9 matrix: 10 os: [ubuntu-18.04, macos-latest, windows-latest] 11 rust: [stable] 12 lua: [lua54, lua53, lua52, lua51, luajit] 13 include: 14 - os: ubuntu-18.04 15 target: x86_64-unknown-linux-gnu 16 - os: macos-latest 17 target: x86_64-apple-darwin 18 - os: windows-latest 19 target: x86_64-pc-windows-msvc 20 steps: 21 - uses: actions/checkout@v2 22 - uses: actions-rs/toolchain@v1 23 with: 24 toolchain: ${{ matrix.rust }} 25 target: ${{ matrix.target }} 26 override: true 27 - uses: Swatinem/rust-cache@v1 28 - name: Build ${{ matrix.lua }} vendored 29 run: | 30 cargo build --features "${{ matrix.lua }},vendored" 31 cargo build --features "${{ matrix.lua }},vendored,async,send,serialize,macros" 32 shell: bash 33 - name: Build ${{ matrix.lua }} pkg-config 34 if: ${{ matrix.os == 'ubuntu-18.04' && matrix.lua != 'lua54' }} 35 run: | 36 sudo apt-get update 37 sudo apt-get install -y --no-install-recommends liblua5.3-dev liblua5.2-dev liblua5.1-0-dev libluajit-5.1-dev 38 cargo build --features "${{ matrix.lua }}" 39 40 build_aarch64_cross_macos: 41 name: Cross-compile to aarch64-apple-darwin 42 runs-on: macos-11.0 43 needs: build 44 strategy: 45 matrix: 46 lua: [lua54, lua53, lua52, lua51, luajit] 47 steps: 48 - uses: actions/checkout@v2 49 - uses: actions-rs/toolchain@v1 50 with: 51 toolchain: stable 52 target: aarch64-apple-darwin 53 override: true 54 - name: Cross-compile 55 run: cargo build --target aarch64-apple-darwin --features "${{ matrix.lua }},vendored,async,send,serialize,macros" 56 57 build_aarch64_cross_ubuntu: 58 name: Cross-compile to aarch64-unknown-linux-gnu 59 runs-on: ubuntu-18.04 60 needs: build 61 strategy: 62 matrix: 63 lua: [lua54, lua53, lua52, lua51, luajit] 64 steps: 65 - uses: actions/checkout@v2 66 - uses: actions-rs/toolchain@v1 67 with: 68 toolchain: stable 69 target: aarch64-unknown-linux-gnu 70 override: true 71 - name: Install ARM compiler toolchain 72 run: | 73 sudo apt-get update 74 sudo apt-get install -y --no-install-recommends gcc-aarch64-linux-gnu libc6-dev-arm64-cross 75 shell: bash 76 - name: Cross-compile 77 run: cargo build --target aarch64-unknown-linux-gnu --features "${{ matrix.lua }},vendored,async,send,serialize,macros" 78 shell: bash 79 80 build_armv7_cross_ubuntu: 81 name: Cross-compile to armv7-unknown-linux-gnueabihf 82 runs-on: ubuntu-18.04 83 needs: build 84 strategy: 85 matrix: 86 lua: [lua54, lua53, lua52, lua51] 87 steps: 88 - uses: actions/checkout@v2 89 - uses: actions-rs/toolchain@v1 90 with: 91 toolchain: stable 92 target: armv7-unknown-linux-gnueabihf 93 override: true 94 - name: Install ARM compiler toolchain 95 run: | 96 sudo apt-get update 97 sudo apt-get install -y --no-install-recommends gcc-arm-linux-gnueabihf libc-dev-armhf-cross 98 shell: bash 99 - name: Cross-compile 100 run: cargo build --target armv7-unknown-linux-gnueabihf --features "${{ matrix.lua }},vendored,async,send,serialize,macros" 101 shell: bash 102 103 test: 104 name: Test 105 runs-on: ${{ matrix.os }} 106 needs: build 107 strategy: 108 matrix: 109 os: [ubuntu-18.04, macos-latest, windows-latest] 110 rust: [stable, nightly] 111 lua: [lua54, lua53, lua52, lua51, luajit] 112 include: 113 - os: ubuntu-18.04 114 target: x86_64-unknown-linux-gnu 115 - os: macos-latest 116 target: x86_64-apple-darwin 117 - os: windows-latest 118 target: x86_64-pc-windows-msvc 119 steps: 120 - uses: actions/checkout@v2 121 - uses: actions-rs/toolchain@v1 122 with: 123 toolchain: ${{ matrix.rust }} 124 target: ${{ matrix.target }} 125 override: true 126 - uses: Swatinem/rust-cache@v1 127 - name: Run ${{ matrix.lua }} tests 128 run: | 129 cargo test --features "${{ matrix.lua }},vendored" 130 cargo test --features "${{ matrix.lua }},vendored,async,send,serialize,macros" 131 shell: bash 132 - name: Run compile tests (macos lua53) 133 if: ${{ matrix.os == 'macos-latest' && matrix.lua == 'lua53' }} 134 run: | 135 TRYBUILD=overwrite cargo test --features "${{ matrix.lua }},vendored" -- --ignored 136 TRYBUILD=overwrite cargo test --features "${{ matrix.lua }},vendored,async,send,serialize,macros" -- --ignored 137 shell: bash 138 139 test_with_sanitizer: 140 name: Test with address sanitizer 141 runs-on: ${{ matrix.os }} 142 needs: build 143 strategy: 144 matrix: 145 os: [ubuntu-18.04] 146 rust: [nightly] 147 lua: [lua54, lua53, lua52, lua51, luajit] 148 include: 149 - os: ubuntu-18.04 150 target: x86_64-unknown-linux-gnu 151 steps: 152 - uses: actions/checkout@v2 153 - uses: actions-rs/toolchain@v1 154 with: 155 toolchain: ${{ matrix.rust }} 156 target: ${{ matrix.target }} 157 override: true 158 - uses: Swatinem/rust-cache@v1 159 - name: Run ${{ matrix.lua }} tests with address sanitizer 160 run: | 161 RUSTFLAGS="-Z sanitizer=address" \ 162 cargo test --tests --features "${{ matrix.lua }},vendored,async,send,serialize,macros" --target x86_64-unknown-linux-gnu -- --skip test_too_many_recursions 163 shell: bash 164 165 test_modules: 166 name: Test modules 167 runs-on: ${{ matrix.os }} 168 needs: build 169 strategy: 170 matrix: 171 os: [ubuntu-18.04, macos-latest] 172 rust: [stable] 173 lua: [lua54, lua53, lua52, lua51, luajit] 174 include: 175 - os: ubuntu-18.04 176 target: x86_64-unknown-linux-gnu 177 - os: macos-latest 178 target: x86_64-apple-darwin 179 steps: 180 - uses: actions/checkout@v2 181 - uses: actions-rs/toolchain@v1 182 with: 183 toolchain: ${{ matrix.rust }} 184 target: ${{ matrix.target }} 185 override: true 186 - uses: Swatinem/rust-cache@v1 187 - name: Run ${{ matrix.lua }} module tests 188 run: | 189 (cd examples/module && cargo build --release --features "${{ matrix.lua }},vendored") 190 (cd tests/module && cargo test --release --features "${{ matrix.lua }},vendored") 191 shell: bash 192 193 test_modules_windows: 194 name: Test modules on Windows 195 runs-on: windows-latest 196 needs: build 197 strategy: 198 matrix: 199 lua: [lua54, luajit] 200 defaults: 201 run: 202 shell: msys2 {0} 203 steps: 204 - uses: msys2/setup-msys2@v2 205 - uses: actions/checkout@v2 206 - name: Install Rust & Lua 207 run: | 208 pacman -S --noconfirm mingw-w64-x86_64-rust mingw-w64-x86_64-lua mingw-w64-x86_64-luajit mingw-w64-x86_64-pkg-config 209 - name: Run ${{ matrix.lua }} module tests 210 run: | 211 (cd examples/module && cargo build --release --features "${{ matrix.lua }}") 212 (cd tests/module && cargo test --release --features "${{ matrix.lua }}") 213 214 rustfmt: 215 name: Rustfmt 216 runs-on: ubuntu-18.04 217 steps: 218 - uses: actions/checkout@v2 219 - uses: actions-rs/toolchain@v1 220 with: 221 toolchain: stable 222 components: rustfmt 223 override: true 224 - run: cargo fmt -- --check 225 226 clippy: 227 name: Clippy check 228 runs-on: ubuntu-18.04 229 strategy: 230 matrix: 231 lua: [lua54, lua53, lua52, lua51, luajit] 232 steps: 233 - uses: actions/checkout@v2 234 - uses: actions-rs/toolchain@v1 235 with: 236 toolchain: nightly 237 components: clippy 238 override: true 239 - uses: actions-rs/clippy-check@v1 240 with: 241 token: ${{ secrets.GITHUB_TOKEN }} 242 args: --features "${{ matrix.lua }},vendored,async,send,serialize,macros" 243