-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: CI - Testing Rust Code | ||
|
||
on: | ||
push: | ||
branches: [ "main", "develop" ] | ||
pull_request: | ||
branches: [ "main", "develop" ] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build mock API container | ||
run: docker build -t mockapi-image --file tests/mock_api/Dockerfile tests/mock_api | ||
|
||
- name: Start Mock API container | ||
run: docker run -d -p 7777:7777 --name mockapi mockapi-image | ||
|
||
- name: Install cargo nextest | ||
uses: taiki-e/install-action@v2 | ||
with: | ||
tool: nextest | ||
|
||
- name: Run tests | ||
run: cargo nextest run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# ------------ | ||
# Build | ||
# ------------ | ||
FROM rust:1-bullseye AS BUILD | ||
|
||
WORKDIR /app | ||
|
||
RUN cargo init | ||
COPY Cargo.toml . | ||
COPY Cargo.lock . | ||
RUN cargo build --release | ||
|
||
COPY src/ src/ | ||
COPY tests/ tests/ | ||
|
||
RUN cargo build --release | ||
|
||
# ------------ | ||
# Runner | ||
# ------------ | ||
FROM debian:bullseye AS RUNNER | ||
|
||
COPY --from=BUILD /app/target/release/treq /usr/local/bin/treq | ||
|
||
RUN chmod +x /usr/local/bin/treq | ||
|
||
RUN useradd -ms /bin/bash wizard | ||
USER wizard | ||
WORKDIR /home/wizard | ||
|
||
CMD ["/bin/bash"] |