-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* major refactor * major refactor * added submodule * fix naming in CI * Update Cargo.toml * Update Cargo.toml * Update Cargo.toml * Update Cargo.toml * Update build_artifacts.yml * Update build_artifacts.yml * Update build_artifacts.yml * Update build_artifacts.yml * Update build_artifacts.yml * Update build_artifacts.yml * Update build_artifacts.yml * Update build_artifacts.yml * Update build_artifacts.yml * Update check_format.yml * Update test.yml * Update main.rs * Update build_artifacts.yml * Update .gitignore * Delete .idea directory * Update .gitmodules * Update test.yml * Update test.yml * Update test.yml * Update .gitmodules
- Loading branch information
Showing
15 changed files
with
186 additions
and
140 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,36 @@ | ||
name: Build Artifacts | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest, windows-latest, macos-latest ] | ||
name: Build ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- uses: arduino/setup-protoc@v2 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: dtolnay/rust-toolchain@stable | ||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
cache-on-failure: true | ||
- name: cargo build --release | ||
uses: clechasseur/rs-cargo@v1 | ||
with: | ||
command: build | ||
args: --release | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: ecdar-web-${{ matrix.os }} | ||
path: ${{ runner.os == 'Windows' && 'target/release/ecdar-web.exe' || 'target/release/ecdar-web' }} | ||
if-no-files-found: error | ||
retention-days: 7 |
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,30 @@ | ||
name: Check formatting | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
|
||
jobs: | ||
fmt: | ||
name: cargo fmt & Clippy lint and check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: sudo apt-get install llvm protobuf-compiler | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: rustfmt | ||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
cache-on-failure: true | ||
- name: cargo fmt --all | ||
uses: clechasseur/rs-cargo@v1 | ||
with: | ||
command: fmt | ||
args: --all -- --check | ||
- name: clippy --all-targets --all-features | ||
uses: clechasseur/rs-clippy-check@v3 | ||
with: | ||
args: --all-targets --all-features -- -D warnings |
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,25 @@ | ||
name: Tests | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
|
||
jobs: | ||
test: | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest, windows-latest, macos-latest ] | ||
name: Test ${{ matrix.os }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- uses: arduino/setup-protoc@v2 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: dtolnay/rust-toolchain@stable | ||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
cache-on-failure: true | ||
- run: cargo test |
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 |
---|---|---|
|
@@ -12,3 +12,5 @@ Cargo.lock | |
|
||
# MSVC Windows builds of rustc generate these, which store debugging information | ||
*.pdb | ||
|
||
.idea |
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,4 @@ | ||
[submodule "Ecdar-ProtoBuf"] | ||
path = Ecdar-ProtoBuf | ||
url = https://github.com/Ecdar/Ecdar-ProtoBuf | ||
branch = SW5 |
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 |
---|---|---|
@@ -1,6 +1,30 @@ | ||
[workspace] | ||
resolver = "2" | ||
members =[ | ||
"ecdar-web", | ||
"ecdar-web-macros" | ||
] | ||
[package] | ||
name = "ecdar_web" | ||
version = "0.1.0" | ||
edition = "2021" | ||
build = "src/build.rs" | ||
default-run = "ecdar_web" | ||
|
||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[lib] | ||
proc-macro = true | ||
|
||
[dependencies] | ||
axum = { version = "0.6.20", features = ["json", "macros"]} | ||
#ecdar-protobuf = { git = "https://github.com/ECDAR-AAU-SW-P5/Ecdar-ProtoBuf-rs", version = "0.1.0", features = ["client", "serde"] } | ||
serde = { version = "1.0.190", features = ["derive"] } | ||
tokio = { version = "1.33.0", features = ["rt", "macros", "rt-multi-thread"] } | ||
tower-http = { version = "0.4.4", features = ["fs"] } | ||
convert_case = "0.6.0" | ||
ecdar-protobuf-transpiler = { git = "https://github.com/Ecdar/Ecdar-ProtoBuf-Transpiler-rs", version = "0.1.0" } | ||
proc-macro2 = "1.0.69" | ||
quote = "1.0.33" | ||
tonic = "0.11.0" | ||
clap = { version = "4.2.1", features = [ "derive", "string" ] } | ||
|
||
|
||
[build-dependencies] | ||
tonic-build = "0.11.0" | ||
|
Submodule Ecdar-ProtoBuf
added at
053d7e
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,5 @@ | ||
fn main() { | ||
tonic_build::compile_protos("Ecdar-ProtoBuf/services.proto").unwrap(); | ||
// Tell cargo to invalidate the crate when the protobuf repository changes | ||
println!("cargo:rerun-if-changed=Ecdar-ProtoBuf"); | ||
} |
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
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,34 @@ | ||
use axum::{routing::*, *}; | ||
use clap::Parser; | ||
use ecdar_web::{add_endpoint_functions, add_endpoints}; | ||
use std::env::current_dir; | ||
use std::path::PathBuf; | ||
use std::result::Result; | ||
use tower_http::services::ServeDir; | ||
|
||
add_endpoint_functions!(); | ||
|
||
#[tokio::main] // TODO: Maybe add some testing eventually | ||
async fn main() -> Result<(), impl std::error::Error> { | ||
let args = Args::parse(); | ||
let file_service = get_service(ServeDir::new(args.root)); | ||
|
||
let app = Router::new().nest_service("/", file_service); | ||
|
||
let app = add_endpoints!(app); | ||
|
||
println!(r#"server running on \"{}\""#, args.serve); | ||
Server::bind(&args.serve.parse().unwrap()) | ||
.serve(app.into_make_service()) | ||
.await | ||
} | ||
|
||
#[derive(clap::Parser, Debug)] | ||
#[command(author, version, about="TODO: Describe", long_about = None)] | ||
pub struct Args { | ||
#[arg(short, long, value_name = "PATH", default_value = current_dir().unwrap().into_os_string())] | ||
root: PathBuf, | ||
|
||
#[arg(short, long, value_name = "IP:PORT", default_value_t = String::from("0.0.0.0:3000"))] | ||
serve: String, | ||
} |