Skip to content

Commit b07702f

Browse files
committed
Add standalone tests (compiling outside of build script)
1 parent 7b98dda commit b07702f

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

.github/workflows/main.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,29 @@ jobs:
102102
cargo test --manifest-path testcrate/Cargo.toml --release --features ${{ matrix.lua }}
103103
shell: bash
104104

105+
test_standalone:
106+
name: Test
107+
runs-on: ${{ matrix.os }}
108+
needs: build
109+
strategy:
110+
matrix:
111+
os: [ubuntu-latest, macos-latest, windows-latest]
112+
include:
113+
- os: ubuntu-latest
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@main
121+
- uses: dtolnay/rust-toolchain@stable
122+
with:
123+
target: ${{ matrix.target }}
124+
- name: Run tests
125+
run: |
126+
cargo test
127+
105128
test_emscripten:
106129
name: Test emscripten
107130
runs-on: ubuntu-latest

tests/tests.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//! This is standalone tests that executed at runtime (not during build)
2+
3+
#[test]
4+
fn test_build() {
5+
let host = target_lexicon::Triple::host().to_string();
6+
let outdir = tempfile::tempdir().expect("Failed to create temp dir");
7+
let mut build = lua_src::Build::new();
8+
build.target(&host).out_dir(&outdir);
9+
10+
for version in [
11+
lua_src::Lua51,
12+
lua_src::Lua52,
13+
lua_src::Lua53,
14+
lua_src::Lua54,
15+
] {
16+
let _artifacts = build.build(version);
17+
}
18+
}

0 commit comments

Comments
 (0)