Skip to content

Commit

Permalink
Adds circleci initial config
Browse files Browse the repository at this point in the history
  • Loading branch information
nubis committed Jun 17, 2024
1 parent 6e7b60a commit 929c2bc
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 3 deletions.
79 changes: 79 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
version: 2.1

orbs:
rust: circleci/rust@1.6.0
browser-tools: circleci/browser-tools@1.4.6

workflows:
version: 2
full_test_suite: # This is the name of the workflow, feel free to change it to better match your workflow.
jobs:
- models_and_api
- integration_tests

jobs:
integration_tests:
docker:
- image: constata/asami-test:latest
- image: cimg/postgres:13.4
environment:
POSTGRES_USER: asami
POSTGRES_PASSWORD: password
POSTGRES_DB: asami_development
resource_class: xlarge
steps:
- checkout
- browser-tools/install-chrome:
chrome-version: "122.0.6261.94"
- browser-tools/install-chromedriver:
chrome-version: "122.0.6261.94"
- run:
name: Creating config
command: cp api/Rocket.toml.sample api/Rocket.toml
- run:
name: Wait for postgres
command: dockerize -wait tcp://localhost:5432 -timeout 1m
- run:
name: Wait for schema creation
command: cd api && until sqlx database setup; do echo "Creating DB"; sleep 1; done;
- run:
name: Make artifacts dir
command: mkdir -p target/artifacts

- run:
name: Run tests
command: integration_tests/run webapp

- store_artifacts:
path: target/artifacts

models_and_api:
docker:
- image: constata/asami-test:latest
- image: cimg/postgres:13.4
environment:
POSTGRES_USER: asami
POSTGRES_PASSWORD: password
POSTGRES_DB: asami_development
resource_class: xlarge
steps:
- checkout
- run:
name: Creating config
command: cp Rocket.toml.example Rocket.toml
- run:
name: Wait for postgres
command: dockerize -wait tcp://localhost:5432 -timeout 1m
- run:
name: Wait for schema creation
command: cd api && until sqlx database setup; do echo "Creating DB"; sleep 1; done;
- run:
name: Make artifacts dir
command: mkdir -p target/artifacts

- run:
name: Run tests
command: cargo test --workspace --exclude webapp --no-fail-fast -- --test-threads 1

- store_artifacts:
path: target/artifacts
18 changes: 15 additions & 3 deletions docker/circleci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
FROM cimg/rust:1.67.1
RUN sudo apt-get update
RUN sudo apt-get install openssl libssl-dev psmisc gettext
FROM cimg/rust:1.76
RUN sudo apt update
RUN sudo apt install -y ca-certificates curl gnupg openssl libssl-dev psmisc gettext

RUN sudo mkdir -p /etc/apt/keyrings
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
ENV NODE_MAJOR=18
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" /etc/apt/sources.list.d/nodesource.list

RUN sudo apt-get -qy update;
RUN sudo apt-get -qy install nodejs npm;
RUN wget https://github.com/jwilder/dockerize/releases/download/v0.3.0/dockerize-linux-amd64-v0.3.0.tar.gz && sudo tar -C /usr/local/bin -xzvf dockerize-linux-amd64-v0.3.0.tar.gz && rm dockerize-linux-amd64-v0.3.0.tar.gz

RUN sudo npm install --global yarn && sudo npm install --global vite
RUN cargo install sqlx-cli
ENV DATABASE_URL=postgres://asami:password@db_container:5432/asami_development
RUN sudo npm install ganache --global

0 comments on commit 929c2bc

Please sign in to comment.