Skip to content

Commit

Permalink
Add CI Workflow - Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
talis-fb committed Dec 1, 2023
1 parent 3039d92 commit 180b009
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/ci.yaml
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
31 changes: 31 additions & 0 deletions Dockerfile
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"]

0 comments on commit 180b009

Please sign in to comment.