Skip to content

Commit c70798d

Browse files
ci: run tests (#5)
1 parent 88ad0c5 commit c70798d

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

.github/workflows/run-tests.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Run tests
2+
run-name: Run tests
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
run-tests:
11+
runs-on: ubuntu-22.04
12+
steps:
13+
- name: Check out source Repo
14+
uses: actions/checkout@v3
15+
- name: Build test container image
16+
run: docker build -t test_image .
17+
- name: Run tests in container image
18+
run: docker run --rm -i test_image cargo test

Dockerfile

+9
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,24 @@ FROM rust:1.73-slim-bullseye
22

33
WORKDIR /builder
44

5+
RUN apt-get update && \
6+
apt-get install -y --no-install-recommends qemu-system=1:5.2+dfsg-11+deb11u3 && \
7+
apt-get clean && \
8+
rm -rf /var/lib/apt/lists/*
9+
510
COPY ./.cargo ./.cargo
611
COPY ./src ./src
712
COPY ./Cargo.toml .
813
COPY ./Cargo.lock .
914
COPY ./rust-toolchain.toml .
1015
COPY ./x86_64-os.json .
16+
COPY ./tests ./tests
1117

1218
RUN cargo install bootimage && \
19+
rustup toolchain install nightly-aarch64-unknown-linux-gnu && \
20+
rustup toolchain install nightly-x86_64-unknown-linux-gnu && \
1321
rustup component add rust-src --toolchain nightly-aarch64-unknown-linux-gnu && \
22+
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu && \
1423
rustup component add llvm-tools-preview
1524

1625
CMD ["cargo","bootimage"]

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,17 @@ Hobby OS implementation in Rust
3939
```bash
4040
qemu-system-x86_64 -drive format=raw,file=target/x86_64-os/debug/bootimage-os.bin
4141
```
42+
43+
## Tests
44+
45+
Run tests in Docker:
46+
47+
```bash
48+
docker run --rm -it $(docker build -q .) cargo test
49+
```
50+
51+
Run tests on host system:
52+
53+
```bash
54+
cargo test
55+
```

0 commit comments

Comments
 (0)