diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 383accc..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,49 +0,0 @@ -version: 2 -jobs: - build: - docker: - - image: circleci/rust:latest - steps: - - checkout - - run: - name: Version information - command: rustc --version; cargo --version; rustup --version - - run: - name: Calculate dependencies - command: cargo generate-lockfile - - restore_cache: - keys: - - cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }} - - run: - name: Check Formatting - command: | - rustup component add rustfmt - rustfmt --version - cargo fmt --all -- --check --color=auto - - run: - name: Install Lua - command: | - sudo apt-get update - sudo apt-get -y --no-install-recommends install liblua5.3-dev liblua5.2-dev liblua5.1-0-dev libluajit-5.1-dev - - run: - name: Build all targets - command: cargo build --all --all-targets - - run: - name: Run all tests / Lua 5.3 - command: cargo test --all --no-default-features --features lua53 - - run: - name: Run all tests / Lua 5.2 - command: cargo test --all --no-default-features --features lua52 - - run: - name: Run all tests / Lua 5.1 - command: cargo test --all --no-default-features --features lua51 - - run: - name: Run all tests / LuaJIT - command: cargo test --all --no-default-features --features luajit - - save_cache: - paths: - - /usr/local/cargo/registry - - target/debug/.fingerprint - - target/debug/build - - target/debug/deps - key: cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..9a29496 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,151 @@ +name: CI +on: [push, pull_request] + +jobs: + build: + name: Build + runs-on: ${{ matrix.os }} + strategy: + matrix: + thing: + - stable + - macos-x86_64 + # - aarch64-linux + - x86_64-msvc + include: + - thing: stable + target: x86_64-unknown-linux-gnu + rust: stable + os: ubuntu-latest + - thing: macos-x86_64 + target: x86_64-apple-darwin + rust: stable + os: macos-latest + - thing: aarch64-linux + target: aarch64-unknown-linux-gnu + rust: stable + os: ubuntu-latest + - thing: x86_64-msvc + target: x86_64-pc-windows-msvc + rust: stable-x86_64-msvc + os: windows-latest + steps: + - uses: actions/checkout@v1 + - name: Install Rust (rustup) + if: matrix.os != 'macos-latest' + run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }} + shell: bash + - name: Install Lua (ubuntu) + if: matrix.os == 'ubuntu-latest' + run: | + sudo apt-get update -y + sudo apt-get install -y --no-install-recommends liblua5.3-dev liblua5.2-dev liblua5.1-0-dev libluajit-5.1-dev + - name: Install Rust (macos) + if: matrix.os == 'macos-latest' + run: | + curl https://sh.rustup.rs | sh -s -- -y + echo ::add-path::$HOME/.cargo/bin + shell: bash + - name: Install GCC (aarch64-linux) + run: | + sudo apt-get update -y + sudo apt-get install -y --no-install-recommends gcc-aarch64-linux-gnu libc6-dev-arm64-cross + if: matrix.thing == 'aarch64-linux' + shell: bash + - run: rustup target add ${{ matrix.target }} + - name: Build (Lua 5.1/5.2/5.3 and LuaJIT vendored) + run: | + for FEATURE in lua51 lua52 lua53; do + echo "Building $FEATURE" + cargo build --target ${{ matrix.target }} --release --no-default-features --features "$FEATURE lua-vendored" + done + echo "Building luajit" + cargo build --target ${{ matrix.target }} --release --no-default-features --features "luajit luajit-vendored" + shell: bash + - name: Build (Lua 5.1/5.2/5.3 and LuaJIT via pkg-config) + if: matrix.os == 'ubuntu-latest' + run: | + for FEATURE in lua51 lua52 lua53; do + echo "Building $FEATURE" + cargo build --target ${{ matrix.target }} --release --no-default-features --features $FEATURE + done + echo "Building luajit" + cargo build --target ${{ matrix.target }} --release --no-default-features --features luajit + shell: bash + + test_linux: + name: Test on Linux + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/checkout@v1 + - name: Install Rust + run: rustup update stable --no-self-update && rustup default stable + shell: bash + - name: Run tests (Lua 5.3 vendored) + run: cargo test --release --no-default-features --features "lua53 lua-vendored" + shell: bash + - name: Run tests (Lua 5.2 vendored) + run: cargo test --release --no-default-features --features "lua53 lua-vendored" + shell: bash + - name: Run tests (Lua 5.1 vendored) + run: cargo test --release --no-default-features --features "lua53 lua-vendored" + shell: bash + - name: Run tests (LuaJIT vendored) + run: cargo test --release --no-default-features --features "luajit luajit-vendored" + shell: bash + + test_macos: + name: Test on MacOS + runs-on: macos-latest + needs: build + steps: + - uses: actions/checkout@v1 + - name: Install Rust + run: | + curl https://sh.rustup.rs | sh -s -- -y + echo ::add-path::$HOME/.cargo/bin + shell: bash + - name: Run tests (Lua 5.3 vendored) + run: cargo test --release --no-default-features --features "lua53 lua-vendored" + shell: bash + - name: Run tests (Lua 5.2 vendored) + run: cargo test --release --no-default-features --features "lua53 lua-vendored" + shell: bash + - name: Run tests (Lua 5.1 vendored) + run: cargo test --release --no-default-features --features "lua53 lua-vendored" + shell: bash + - name: Run tests (LuaJIT vendored) + run: cargo test --release --no-default-features --features "luajit luajit-vendored" + shell: bash + + test_windows: + name: Test on Windows + runs-on: windows-latest + needs: build + steps: + - uses: actions/checkout@v1 + - name: Install Rust + run: rustup update stable --no-self-update && rustup default stable + shell: bash + - name: Run tests (Lua 5.3 vendored) + run: cargo test --release --no-default-features --features "lua53 lua-vendored" + shell: bash + - name: Run tests (Lua 5.2 vendored) + run: cargo test --release --no-default-features --features "lua53 lua-vendored" + shell: bash + - name: Run tests (Lua 5.1 vendored) + run: cargo test --release --no-default-features --features "lua53 lua-vendored" + shell: bash + - name: Run tests (LuaJIT vendored) + run: cargo test --release --no-default-features --features "luajit luajit-vendored" + shell: bash + + rustfmt: + name: Rustfmt + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Install Rust + run: rustup update stable && rustup default stable && rustup component add rustfmt + - run: cargo fmt -- --check diff --git a/Cargo.toml b/Cargo.toml index 5c7d61e..29ec22a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ with support of writing native lua modules in Rust. """ [badges] -circle-ci = { repository = "khvzak/mlua", branch = "master" } +# github-actions = { repository = "khvzak/mlua", workflow = "CI" } [workspace] members = [ diff --git a/README.md b/README.md index a325bc3..f7eed0a 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # mlua -[![Build Status]][circleci] [![Latest Version]][crates.io] [![API Documentation]][docs.rs] +[![Build Status]][github-actions] [![Latest Version]][crates.io] [![API Documentation]][docs.rs] -[Build Status]: https://img.shields.io/circleci/project/github/khvzak/mlua.svg -[circleci]: https://circleci.com/gh/khvzak/mlua +[Build Status]: https://github.com/khvzak/mlua/workflows/CI/badge.svg +[github-actions]: https://github.com/khvzak/mlua/actions [Latest Version]: https://img.shields.io/crates/v/mlua.svg [crates.io]: https://crates.io/crates/mlua [API Documentation]: https://docs.rs/mlua/badge.svg diff --git a/tests/compile_fail.rs b/tests/compile_fail.rs index 3c44654..b46f7d4 100644 --- a/tests/compile_fail.rs +++ b/tests/compile_fail.rs @@ -1,4 +1,4 @@ -#[cfg(any(feature = "lua53", feature = "lua51"))] +#[cfg(not(windows))] #[test] fn test_compile_fail() { let t = trybuild::TestCases::new();