Skip to content

Commit

Permalink
ci: run tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JuozasVainauskas committed Nov 12, 2023
1 parent 88ad0c5 commit 4906385
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Run tests
run-name: Run tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
run-tests:
runs-on: ubuntu-22.04
steps:
- name: Check out source Repo
uses: actions/checkout@v3

- name: Run tests in container image
run: docker run --rm -i $(docker build -q -f Dockerfile.test .) ls -a
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ COPY ./Cargo.toml .
COPY ./Cargo.lock .
COPY ./rust-toolchain.toml .
COPY ./x86_64-os.json .
COPY ./tests ./tests

RUN apt-get update && \
apt-get install qemu-system -y
RUN cargo install bootimage && \
rustup component add rust-src --toolchain nightly-aarch64-unknown-linux-gnu && \
rustup component add llvm-tools-preview
Expand Down
21 changes: 21 additions & 0 deletions Dockerfile.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM rust:1.73-slim-bullseye

WORKDIR /builder

COPY ./.cargo ./.cargo
COPY ./src ./src
COPY ./Cargo.toml .
COPY ./Cargo.lock .
COPY ./rust-toolchain.toml .
COPY ./x86_64-os.json .
COPY ./tests ./tests

RUN apt-get update && \
apt-get install qemu-system -y
RUN cargo install bootimage && \
rustup target add aarch64-unknown-linux-gnu && \
rustup toolchain install nightly-aarch64-unknown-linux-gnu && \
rustup component add rust-src --toolchain nightly-aarch64-unknown-linux-gnu && \
rustup component add llvm-tools-preview

CMD ["cargo","test"]
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,17 @@ Hobby OS implementation in Rust
```bash
qemu-system-x86_64 -drive format=raw,file=target/x86_64-os/debug/bootimage-os.bin
```

## Tests

Run tests in Docker:

```bash
docker run --rm -it $(docker build -q -f Dockerfile.test .)
```

Run tests on host system:

```bash
cargo test
```

0 comments on commit 4906385

Please sign in to comment.