Merge branch 'github_actions'

This commit is contained in:
Alex Orlenko 2020-01-25 23:07:31 +00:00
commit 5cd0b645c4
5 changed files with 156 additions and 54 deletions

View File

@ -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" }}

151
.github/workflows/main.yml vendored Normal file
View File

@ -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

View File

@ -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 = [

View File

@ -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

View File

@ -1,4 +1,4 @@
#[cfg(any(feature = "lua53", feature = "lua51"))]
#[cfg(not(windows))]
#[test]
fn test_compile_fail() {
let t = trybuild::TestCases::new();