Skip to content

Commit

Permalink
Merge branch 'master' into guillaume/ci/use-git-tag-when-publishing-e…
Browse files Browse the repository at this point in the history
…verything
  • Loading branch information
GuillaumeDecMeetsMore committed Sep 12, 2024
2 parents a87ac39 + 7e845a1 commit 33da0c2
Show file tree
Hide file tree
Showing 341 changed files with 3,061 additions and 2,361 deletions.
File renamed without changes.
12 changes: 5 additions & 7 deletions .github/workflows/js-client-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ jobs:
image: postgres:13
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: nettuscheduler
POSTGRES_DB: nittei
ports:
- 5432:5432
env:
PORT: 5000
DATABASE_URL: postgresql://postgres:postgres@localhost/nettuscheduler
DATABASE_URL: postgresql://postgres:postgres@localhost/nittei
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -48,30 +48,28 @@ jobs:
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
scheduler/target/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Start server and run JS client tests
env:
PORT: 5000
run: |
cd scheduler
# run the migrations first
cargo install sqlx-cli --no-default-features --features postgres || true
(cd crates/infra && sqlx migrate run)
export RUST_LOG=error,tracing=info
cargo build
./target/debug/nettu_scheduler &> output.log &
./target/debug/nittei &> output.log &
echo "Started server in background"
sleep 10
- name: Run JavaScript client tests
run: |
cd scheduler/clients/javascript
cd clients/javascript
pnpm i
pnpm run test
20 changes: 9 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ jobs:
image: postgres:13
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: nettuscheduler
POSTGRES_DB: nittei
ports:
- 5432:5432
env:
DATABASE_URL: postgresql://postgres:postgres@localhost/nettuscheduler
DATABASE_URL: postgresql://postgres:postgres@localhost/nittei
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -45,7 +45,7 @@ jobs:
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
scheduler/target/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Set up QEMU
Expand All @@ -61,16 +61,14 @@ jobs:

- name: Run migrations
run: |
cd scheduler
cargo install sqlx-cli --no-default-features --features postgres || true
(cd crates/infra && sqlx migrate run)
- name: Build and push
uses: docker/build-push-action@v6
with:
context: ./scheduler
push: true
file: "./scheduler/debian.Dockerfile"
file: "./debian.Dockerfile"
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
Expand All @@ -85,11 +83,11 @@ jobs:
# image: postgres:13
# env:
# POSTGRES_PASSWORD: postgres
# POSTGRES_DB: nettuscheduler
# POSTGRES_DB: nittei
# ports:
# - 5432:5432
# env:
# DATABASE_URL: postgresql://postgres:postgres@localhost/nettuscheduler
# DATABASE_URL: postgresql://postgres:postgres@localhost/nittei
# steps:
# - name: Checkout
# uses: actions/checkout@v2
Expand Down Expand Up @@ -238,17 +236,17 @@ jobs:
version: 9
- name: Install deps
run: |
cd scheduler/clients/javascript
cd clients/javascript
pnpm install
- name: Set version number
run: |
cd scheduler/clients/javascript
cd clients/javascript
pnpm version $VERSION
- name: Publish package
run: |
cd scheduler/clients/javascript
cd clients/javascript
pnpm run deploy
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/server-code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
image: postgres:13
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: nettuscheduler
POSTGRES_DB: nittei
ports:
- 5432:5432
env:
PORT: 5000
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/nettuscheduler
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/nittei
steps:
- name: Checkout repository
uses: actions/checkout@v2
Expand All @@ -30,13 +30,11 @@ jobs:
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
scheduler/target/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Generate code coverage
run: |
cd scheduler
# https://github.com/xd009642/tarpaulin/issues/756
cargo install cargo-tarpaulin --version 0.18.0-alpha3 || true
Expand Down
13 changes: 3 additions & 10 deletions .github/workflows/server-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ jobs:
image: postgres:13
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: nettuscheduler
POSTGRES_DB: nittei
ports:
- 5432:5432

env:
PORT: 5000
DATABASE_URL: postgresql://postgres:postgres@localhost/nettuscheduler
DATABASE_URL: postgresql://postgres:postgres@localhost/nittei
RUST_BACKTRACE: 1

steps:
Expand All @@ -45,7 +45,7 @@ jobs:
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
scheduler/target/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

# Install Nextest
Expand All @@ -54,20 +54,16 @@ jobs:

- name: Run migrations
run: |
cd scheduler
# run the migrations first
cargo install sqlx-cli --no-default-features --features postgres || true
(cd crates/infra && sqlx migrate run)
- name: Formatting
run: |
cd scheduler
cargo +nightly fmt --all -- --check
- name: Clippy
run: |
cd scheduler
cargo clippy --all
# To re-enable
# cargo clippy --all -- --deny "warnings"
Expand All @@ -76,17 +72,14 @@ jobs:
# TODO: find a solution (e.g. by using caching) or re-enable only on master
# - name: Unused dependencies
# run: |
# cd scheduler
# cargo install cargo-udeps --locked
# cargo +nightly udeps --all-targets

# - name: Outdated dependencies
# run: |
# cd scheduler
# # cargo outdated --exit-code 1 --workspace
# cargo outdated --workspace

- name: Run server tests
run: |
cd scheduler
cargo test --workspace
45 changes: 23 additions & 22 deletions scheduler/Cargo.lock → Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

[workspace]
members = [
"bins/nittei",
"crates/api",
"crates/api_structs",
"crates/domain",
"crates/infra",
"crates/utils",
"clients/rust",
]
resolver = "2"

[workspace.dependencies]
nittei_api = { path = "crates/api" }
nittei_api_structs = { path = "crates/api_structs" }
nittei_domain = { path = "crates/domain" }
nittei_infra = { path = "crates/infra" }
nittei_utils = { path = "crates/utils" }
nittei_sdk = { path = "clients/rust" }

[workspace.lints.rust]
unsafe_code = "forbid"

[workspace.lints.clippy]
print_stdout = "deny"
print_err = "deny"
unwrap_used = "deny"
expect_used = "deny"
6 changes: 3 additions & 3 deletions scheduler/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ WORKDIR /home/rust/

COPY . .

ENV DATABASE_URL "postgresql://postgres:[email protected]:5432/nettuscheduler"
ENV DATABASE_URL "postgresql://postgres:[email protected]:5432/nittei"

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
&& cargo build --release \
&& cp /home/rust/target/release/nettu_scheduler . \
&& cp /home/rust/target/release/nittei . \
&& cp /home/rust/target/release/migrate . \
&& rm -rf /home/rust/target \
&& rustup self uninstall -y

ENTRYPOINT ["/bin/sh", "-c" , "./migrate && ./nettu_scheduler"]
ENTRYPOINT ["/bin/sh", "-c" , "./migrate && ./nittei"]
Loading

0 comments on commit 33da0c2

Please sign in to comment.