From edf8569194063f3e6185453629d40c2e27d83497 Mon Sep 17 00:00:00 2001 From: Defelo Date: Tue, 14 Nov 2023 08:33:19 +0100 Subject: [PATCH 01/12] Remove client --- Cargo.lock | 13 ---- Cargo.toml | 1 - client/Cargo.toml | 14 ---- client/src/challenges.rs | 25 ------ client/src/lib.rs | 161 --------------------------------------- 5 files changed, 214 deletions(-) delete mode 100644 client/Cargo.toml delete mode 100644 client/src/challenges.rs delete mode 100644 client/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 7b0b6ed..0543e8f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -395,19 +395,6 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" -[[package]] -name = "client" -version = "2.0.1" -dependencies = [ - "paste", - "reqwest", - "schemas", - "serde", - "serde_json", - "thiserror", - "url", -] - [[package]] name = "cobs" version = "0.2.3" diff --git a/Cargo.toml b/Cargo.toml index 673dc26..b28ebe7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,6 @@ members = [ "entity", "lib", "schemas", - "client", "challenges", ] diff --git a/client/Cargo.toml b/client/Cargo.toml deleted file mode 100644 index e23124c..0000000 --- a/client/Cargo.toml +++ /dev/null @@ -1,14 +0,0 @@ -[package] -name = "client" -version = "2.0.1" -edition = "2021" -publish = false - -[dependencies] -paste = { workspace = true } -reqwest = { workspace = true } -schemas = { workspace = true } -serde = { workspace = true } -serde_json = { workspace = true } -thiserror = { workspace = true } -url = { workspace = true } diff --git a/client/src/challenges.rs b/client/src/challenges.rs deleted file mode 100644 index 5c8b065..0000000 --- a/client/src/challenges.rs +++ /dev/null @@ -1,25 +0,0 @@ -use schemas::challenges::{ - challenges::{ - Category, Challenge, CreateCategoryRequest, CreateChallengeError, CreateChallengeRequest, - DeleteCategoryError, DeleteChallengeError, GetCategoryError, GetChallengeError, - UpdateCategoryError, UpdateCategoryRequest, UpdateChallengeError, UpdateChallengeRequest, - }, - subtasks::SubtasksUserConfig, -}; - -use super::client; - -client!(Challenges { - pub get_subtasks_user_config(): get "subtasks/user_config" => SubtasksUserConfig; - - pub list_categories(): get "categories" => Vec; - pub get_category(path: category_id): get "categories/{category_id}" => Category, GetCategoryError; - pub create_category(json: CreateCategoryRequest): post "categories" => Category; - pub update_category(path: category_id, json: UpdateCategoryRequest): patch "categories/{category_id}" => Category, UpdateCategoryError; - pub delete_category(path: category_id): delete "categories/{category_id}" => Success, DeleteCategoryError; - pub list_challenges(path: category_id): get "categories/{category_id}/challenges" => Vec; - pub get_challenge(path: category_id, path: challenge_id): get "categories/{category_id}/challenges/{challenge_id}" => Challenge, GetChallengeError; - pub create_challenge(path: category_id, json: CreateChallengeRequest): post "categories/{category_id}/challenges" => Challenge, CreateChallengeError; - pub update_challenge(path: category_id, path: challenge_id, json: UpdateChallengeRequest): patch "categories/{category_id}/challenges/{challenge_id}" => Challenge, UpdateChallengeError; - pub delete_challenge(path: category_id, path: challenge_id): delete "categories/{category_id}/challenges/{challenge_id}" => Success, DeleteChallengeError; -}); diff --git a/client/src/lib.rs b/client/src/lib.rs deleted file mode 100644 index 28c2952..0000000 --- a/client/src/lib.rs +++ /dev/null @@ -1,161 +0,0 @@ -#![forbid(unsafe_code)] -#![warn(clippy::dbg_macro, clippy::use_debug, clippy::todo)] - -use serde::{de::DeserializeOwned, Deserialize}; -use serde_json::Value; - -pub mod challenges; - -#[derive(Debug, thiserror::Error)] -pub enum Error { - /// The endpoint url could not be parsed. - #[error("could not parse url: {0}")] - UrlParseError(#[from] url::ParseError), - /// [`reqwest`] returned an error. - #[error("reqwest error: {0}")] - ReqwestError(#[from] reqwest::Error), - /// An error response that any endpoint may return. - #[error("common error: {0:?}")] - CommonError(CommonError), - /// An error response that a specific endpoint may return. - #[error("endpoint error: {0:?}")] - EndpointError(E), - /// An unknown error. - #[error("unknown error: {0:?}")] - UnknownError(Value), -} - -#[derive(Debug, Clone, Deserialize)] -#[serde(tag = "error", content = "reason", rename_all = "snake_case")] -pub enum CommonError { - /// 422 Unprocessable Content - UnprocessableContent(String), - /// 500 Internal Server Error - InternalServerError, - - /// 401 Unauthorized - Unauthorized, - /// 403 User is not verified - Unverified, - /// 403 Forbidden - Forbidden, -} - -pub(crate) fn parse_error(value: Value) -> Error { - if let Ok(x) = serde_json::from_value(value.clone()) { - Error::CommonError(x) - } else if let Ok(x) = serde_json::from_value(value.clone()) { - Error::EndpointError(x) - } else { - Error::UnknownError(value) - } -} - -macro_rules! client { - ( - $name:ident { - $( - $(#[doc = $doc:literal])* - $vis:vis - $func:ident($(path: $args:ident),* $(,)? $(json: $data:ty)?): - $method:ident - $path:literal => - $ok:ty - $(, $err:ty)?; - )* - } - ) => { - use crate::Success; - - paste::paste! { - #[derive(Debug, Clone)] - pub struct [< $name:camel Client >] { - base_url: url::Url, - client: reqwest::Client, - token: Option, - } - - #[derive(Debug, Clone)] - pub struct [< Blocking $name:camel Client >] { - base_url: url::Url, - client: reqwest::blocking::Client, - token: Option, - } - - impl [< $name:camel Client >] { - - pub fn new(base_url: url::Url, token: Option) -> Self { - Self { - base_url, - client: reqwest::Client::new(), - token, - } - } - - pub fn update_token(&mut self, token: Option) { - self.token = token; - } - - $( - $(#[doc = $doc])* - $vis async fn $func(&self, $($args: impl std::fmt::Display,)* $(data: &$data)?) -> Result<$ok, crate::Error<$($err)?>> { - let mut request = self - .client - .$method(self.base_url.join(&format!($path))?); - if let Some(token) = &self.token { - request = request.bearer_auth(token); - } - let response = request - $(.json(data as &$data))? - .send() - .await?; - if response.status().is_success() { - Ok(response.json().await?) - } else { - Err(crate::parse_error(response.json().await?)) - } - } - )* - } - - impl [< Blocking $name:camel Client >] { - pub fn new(base_url: url::Url, token: Option) -> Self { - Self { - base_url, - client: reqwest::blocking::Client::new(), - token, - } - } - - pub fn update_token(&mut self, token: Option) { - self.token = token; - } - - $( - $(#[doc = $doc])* - $vis fn $func(&self, $($args: impl std::fmt::Display,)* $(data: &$data)?) -> Result<$ok, crate::Error<$($err)?>> { - let mut request = self - .client - .$method(self.base_url.join(&format!($path))?); - if let Some(token) = &self.token { - request = request.bearer_auth(token); - } - let response = request - $(.json(data as &$data))? - .send()?; - if response.status().is_success() { - Ok(response.json()?) - } else { - Err(crate::parse_error(response.json()?)) - } - } - )* - } - } - }; -} - -pub(crate) use client; - -#[derive(Debug, Deserialize)] -pub struct Success {} From 43194b05141f74f2f9fd6afab19179893e1122be Mon Sep 17 00:00:00 2001 From: Defelo Date: Tue, 14 Nov 2023 08:33:39 +0100 Subject: [PATCH 02/12] Update justfile --- justfile | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/justfile b/justfile index eb49cec..e633fd8 100644 --- a/justfile +++ b/justfile @@ -9,32 +9,31 @@ alias b := bacon _default: @just --list +# cargo run run *args: - cargo run --locked {{args}} + cargo run --locked -p challenges {{args}} +# cargo clippy check *args: cargo clippy {{args}} +# cargo test test *args: cargo test --locked {{args}} +# connect to database psql *args: psql "$DATABASE__URL" {{args}} +# connect to redis redis ms *args: redis-cli -u "$REDIS__{{uppercase(ms)}}" {{args}} -db: - docker run -it --rm --name academy-db \ - -e POSTGRES_DB=academy \ - -e POSTGRES_USER=academy \ - -e POSTGRES_PASSWORD=academy \ - -p 127.0.0.1:5432:5432 \ - postgres:alpine - +# run migrations migrate *args: sea migrate {{args}} +# generate entities entity: mv entity/src entity/.src.bak mkdir entity/src @@ -42,9 +41,11 @@ entity: if [[ -f entity/src/sea_orm_active_enums.rs ]]; then sed -i -E 's/^(#\[derive\(.*DeriveActiveEnum.*)\)\]$/\1, poem_openapi::Enum, serde::Serialize, serde::Deserialize)]\n#[serde(rename_all = "SCREAMING_SNAKE_CASE")]\n#[oai(rename_all = "SCREAMING_SNAKE_CASE")]/' entity/src/sea_orm_active_enums.rs; fi cargo fmt -p entity +# bacon clippy bacon *args: bacon clippy {{args}} +# run pre-commit checks pre-commit: cargo fmt --check cargo clippy -- -D warnings From 6943d23114b7931200682c8f1d1863db4c2d3ebe Mon Sep 17 00:00:00 2001 From: Defelo Date: Tue, 14 Nov 2023 09:23:51 +0100 Subject: [PATCH 03/12] Add nix flake --- .envrc | 4 +-- .gitignore | 1 + flake.lock | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 49 +++++++++++++++++++++++++++++++++ 4 files changed, 132 insertions(+), 2 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.envrc b/.envrc index 100c321..a90c9bf 100644 --- a/.envrc +++ b/.envrc @@ -1,3 +1,3 @@ -use nix -p bacon just yq postgresql_15 redis -export RUST_LOG=info,difft=off,poem_ext,lib,entity,migration,challenges=trace +on_git_branch latest && exit +use flake .#$(cat .devshell 2> /dev/null) dotenv_if_exists diff --git a/.gitignore b/.gitignore index 363c50a..7161aa2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /target /.direnv /.env +/.devshell diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..beb033e --- /dev/null +++ b/flake.lock @@ -0,0 +1,80 @@ +{ + "nodes": { + "fenix": { + "inputs": { + "nixpkgs": "nixpkgs", + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1699942952, + "narHash": "sha256-ll8hFcTDhCvCfaKJwe7F3Ohh8YYHHSAtQTO0K7FBHgk=", + "owner": "nix-community", + "repo": "fenix", + "rev": "1b820065cefcdbe5af6829eb7d3d1b20e98ec960", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1699099776, + "narHash": "sha256-X09iKJ27mGsGambGfkKzqvw5esP1L/Rf8H3u3fCqIiU=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "85f1ba3e51676fa8cc604a3d863d729026a6b8eb", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1699725108, + "narHash": "sha256-NTiPW4jRC+9puakU4Vi8WpFEirhp92kTOSThuZke+FA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "911ad1e67f458b6bcf0278fa85e33bb9924fed7e", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "fenix": "fenix", + "nixpkgs": "nixpkgs_2" + } + }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1699808862, + "narHash": "sha256-gjMqmlCvLVlptL35HHvALrOKrFyxjg5hryXbbpVyoeY=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "416e9c856a792ce2214c449677ca0a1f38965248", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..be44c18 --- /dev/null +++ b/flake.nix @@ -0,0 +1,49 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + fenix.url = "github:nix-community/fenix"; + }; + + outputs = { + nixpkgs, + fenix, + ... + }: let + defaultSystems = [ + "x86_64-linux" + "x86_64-darwin" + "aarch64-linux" + "aarch64-darwin" + ]; + eachDefaultSystem = f: + builtins.listToAttrs (map (system: { + name = system; + value = f system; + }) + defaultSystems); + in { + devShells = eachDefaultSystem (system: let + inherit (nixpkgs) lib; + pkgs = import nixpkgs {inherit system;}; + rust = fenix.packages.${system}.stable.toolchain; + devShell = withRust: + pkgs.mkShell { + packages = with pkgs; + lib.optional withRust rust + ++ [ + just + postgresql + redis + bacon + sea-orm-cli + yq + gnused + ]; + RUST_LOG = "info,difft=off,poem_ext,lib,entity,migration,challenges=trace"; + }; + in { + default = devShell true; + noRust = devShell false; + }); + }; +} From dafc94104aa2d0eaf1ef56c71a0939319e504b44 Mon Sep 17 00:00:00 2001 From: Defelo Date: Tue, 14 Nov 2023 10:13:59 +0100 Subject: [PATCH 04/12] Remove docker-compose.yml --- docker-compose.yml | 41 ----------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 7f70c22..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,41 +0,0 @@ -version: '3.10' - -x-service-base: &service-base - image: ghcr.io/bootstrap-academy/backend - build: . - restart: always - init: true - depends_on: - - database - - redis - environment: - RUST_LOG: info - volumes: - - ./config.toml:/config.toml:ro - -services: - - migration: - << : *service-base - restart: 'no' - entrypoint: /migration - - challenges: - << : *service-base - entrypoint: /challenges - ports: - - 127.0.0.1:8005:8000 - - database: - image: postgres:alpine - restart: always - environment: - POSTGRES_USER: academy - POSTGRES_PASSWORD: academy - POSTGRES_DB: academy - # volumes: - # - ./.db:/var/lib/postgresql/data - - redis: - image: redis:alpine - restart: always From 9806d0e25a873b1e7136341ff83743c8b6d0d941 Mon Sep 17 00:00:00 2001 From: Defelo Date: Tue, 14 Nov 2023 10:35:50 +0100 Subject: [PATCH 05/12] Update config.toml --- config.toml | 61 ++++++++++++++++------------------------------------- 1 file changed, 18 insertions(+), 43 deletions(-) diff --git a/config.toml b/config.toml index 13be161..12f07b4 100644 --- a/config.toml +++ b/config.toml @@ -1,55 +1,30 @@ -jwt_secret = "changeme" +jwt_secret = "dev-secret" internal_jwt_ttl = 10 # seconds cache_ttl = 600 # seconds [database] -url = "postgres://academy:academy@database:5432/academy" +url = "postgres://postgres@localhost:5432/academy-challenges" connect_timeout = 5 # seconds [redis] -auth = "redis://redis:6379/0" -skills = "redis://redis:6379/1" -shop = "redis://redis:6379/2" -jobs = "redis://redis:6379/3" -events = "redis://redis:6379/4" -challenges = "redis://redis:6379/5" +auth = "redis://localhost:6379/0" +skills = "redis://localhost:6379/1" +shop = "redis://localhost:6379/2" +jobs = "redis://localhost:6379/3" +events = "redis://localhost:6379/4" +challenges = "redis://localhost:6379/5" [services] -auth = "http://auth:8000" -skills = "http://skills:8000" -shop = "http://shop:8000" -jobs = "http://jobs:8000" -events = "http://events:8000" -challenges = "http://challenges:8000" - -[auth] -host = "0.0.0.0" -port = 8000 -server = "/" - -[skills] -host = "0.0.0.0" -port = 8000 -server = "/" - -[shop] -host = "0.0.0.0" -port = 8000 -server = "/" - -[jobs] -host = "0.0.0.0" -port = 8000 -server = "/" - -[events] -host = "0.0.0.0" -port = 8000 -server = "/" +auth = "http://localhost:8000" +skills = "http://localhost:8001" +shop = "http://localhost:8002" +jobs = "http://localhost:8003" +events = "http://localhost:8004" +challenges = "http://localhost:8005" [challenges] -host = "0.0.0.0" -port = 8000 +host = "127.0.0.1" +port = 8005 server = "/" # [challenges.sentry] @@ -77,8 +52,8 @@ hearts = 1 creator_coins = 1 [challenges.coding_challenges] -sandkasten_url = "http://sandkasten" -max_concurrency = 4 +sandkasten_url = "https://sandkasten.bootstrap.academy" +max_concurrency = 2 timeout = 10 # seconds hearts = 2 creator_coins = 10 From 96e265a2256b837ca04a23d6c6748ac0e47eba10 Mon Sep 17 00:00:00 2001 From: Defelo Date: Tue, 14 Nov 2023 10:39:38 +0100 Subject: [PATCH 06/12] Update readme --- README.md | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index f859821..e120919 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,39 @@ -[![check](https://github.com/Bootstrap-Academy/backend/actions/workflows/check.yml/badge.svg)](https://github.com/Bootstrap-Academy/backend/actions/workflows/check.yml) -[![test](https://github.com/Bootstrap-Academy/backend/actions/workflows/test.yml/badge.svg)](https://github.com/Bootstrap-Academy/backend/actions/workflows/test.yml) -[![docker](https://github.com/Bootstrap-Academy/backend/actions/workflows/docker.yml/badge.svg)](https://github.com/Bootstrap-Academy/backend/actions/workflows/docker.yml) - - +[![check](https://github.com/Bootstrap-Academy/challenges-ms/actions/workflows/check.yml/badge.svg)](https://github.com/Bootstrap-Academy/challenges-ms/actions/workflows/check.yml) +[![test](https://github.com/Bootstrap-Academy/challenges-ms/actions/workflows/test.yml/badge.svg)](https://github.com/Bootstrap-Academy/challenges-ms/actions/workflows/test.yml) +[![docker](https://github.com/Bootstrap-Academy/challenges-ms/actions/workflows/docker.yml/badge.svg)](https://github.com/Bootstrap-Academy/challenges-ms/actions/workflows/docker.yml) + + -# Bootstrap Academy Backend +# Bootstrap Academy Challenges Microservice +The official challenges microservice of [Bootstrap Academy](https://bootstrap.academy/). + +If you would like to submit a bug report or feature request, or are looking for general information about the project or the publicly available instances, please refer to the [Bootstrap-Academy repository](https://github.com/Bootstrap-Academy/Bootstrap-Academy). + +## Development Setup +1. Install the [Rust](https://www.rust-lang.org/) stable toolchain and [just](https://github.com/casey/just). +2. Clone this repository and `cd` into it. +3. Start a [PostgreSQL](https://www.postgresql.org/) database, for example using [Docker](https://www.docker.com/) or [Podman](https://podman.io/): + ```bash + podman run -d --rm \ + --name postgres \ + -p 127.0.0.1:5432:5432 \ + -e POSTGRES_HOST_AUTH_METHOD=trust \ + postgres:alpine + ``` +4. Create the `academy-challenges` database: + ```bash + podman exec postgres \ + psql -U postgres \ + -c 'create database "academy-challenges"' + ``` +5. Start a [Redis](https://redis.io/) instance, for example using [Docker](https://www.docker.com/) or [Podman](https://podman.io/): + ```bash + podman run -d --rm \ + --name redis \ + -p 127.0.0.1:6379:6379 \ + redis:alpine + ``` +6. Run `just migrate` to run the database migrations. +7. Run `just run` to start the microservice. You can find the automatically generated swagger documentation on http://localhost:8005/docs. From e2b6702f3142f4465860bd309567115189c3fef3 Mon Sep 17 00:00:00 2001 From: Defelo Date: Tue, 14 Nov 2023 10:39:56 +0100 Subject: [PATCH 07/12] Remove notify-release workflow --- .github/workflows/notify-release.yml | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 .github/workflows/notify-release.yml diff --git a/.github/workflows/notify-release.yml b/.github/workflows/notify-release.yml deleted file mode 100644 index d253b18..0000000 --- a/.github/workflows/notify-release.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: notify-release - -on: - workflow_dispatch: - release: - types: [published] - issues: - types: [closed] - schedule: - - cron: '0 4 * * *' - -permissions: - contents: read - issues: write - -jobs: - notify-release: - runs-on: ubuntu-latest - steps: - - name: Notify release - uses: nearform-actions/github-action-notify-release@v1 - with: - notify-after: '14d' From 5ef940a705e0c5cb650fa844523116eb27b2e579 Mon Sep 17 00:00:00 2001 From: Defelo Date: Tue, 14 Nov 2023 10:48:19 +0100 Subject: [PATCH 08/12] Add pull request template --- .github/pull_request_template.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..20ed7e2 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,14 @@ +## Description + + +## Type of change + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) + + +Fixes Bootstrap-Academy/Bootstrap-Academy#ISSUE-NUMBER + + +My Bootstrap Academy username: From a0ddf01cd091eed41c3884aa29a95683b06845c1 Mon Sep 17 00:00:00 2001 From: Defelo Date: Tue, 14 Nov 2023 10:48:51 +0100 Subject: [PATCH 09/12] Add code of conduct --- CODE_OF_CONDUCT.md | 128 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..0779cba --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,128 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +hallo@bootstrap.academy. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. From dbf4c8735273cb5369c92867ebc6f1094ddf49a2 Mon Sep 17 00:00:00 2001 From: Defelo Date: Tue, 14 Nov 2023 10:50:13 +0100 Subject: [PATCH 10/12] Add contributing guide --- CONTRIBUTING.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..1ac6181 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,42 @@ +# Bootstrap Academy contributing guide +Thank you for investing your time in contributing to this project! Any contribution you make will be reflected on https://bootstrap.academy/. + +In this guide you will get an overview of the contribution workflow from opening a ticket, creating a pull request, reviewing, and merging the pull request. + +## Tickets +All tickets are stored as GitHub issues in the [Bootstrap-Academy](https://github.com/Bootstrap-Academy/Bootstrap-Academy/issues) repository. Additionally, there is a [GitHub project](https://github.com/orgs/Bootstrap-Academy/projects/4) to provide a better overview over the currently active tickets. + +For each ticket there is also a bounty in Bootstrap Academy Morphcoins which is given to the person who solves the ticket. + +### Creating tickets +Before creating a new ticket, please make sure to search if an issue already exists to avoid duplicates. + +On the ["New issue" page](https://github.com/Bootstrap-Academy/Bootstrap-Academy/issues/new/choose) please choose an appropriate template and fill it out as accurately as possible. If there is no template which matches the kind of ticket you would like to create, you can just [open a blank issue](https://github.com/Bootstrap-Academy/Bootstrap-Academy/issues/new). + +Depending on the severity of the issue you report, you can also receive Morphcoins in the Bootstrap Academy as a reward, so make sure to include your Bootstrap Academy username in your ticket. + +After creating your ticket, it is automatically added to the GitHub project and its status is set to "Triage/Draft". We will now review your ticket and maybe ask for some more details. After that, you will receive some Morphcoins as a reward (if you included your Bootstrap Academy username in the ticket) and the ticket status is set to "Todo". + +### Solving tickets +To find a ticket to solve, you can have a look at the [GitHub project](https://github.com/orgs/Bootstrap-Academy/projects/4). Once you find an interesting ticket with the "Todo" status, you can just start working on it. + +If you chose a more complicated ticket, you can also ask us to assign you to this ticket, so that others can see that this ticket is currently being worked on. But please only do this if you really have the time to solve the ticket (or parts of it) in the near future. + +If you have any questions regarding the ticket or need help, don't hesitate to ask! + +## Pull Requests +All code contributions are submitted through pull requests (aka PRs). + +### Creating Pull Requests +When starting to work on a ticket, you can already create an (at first empty) draft pull request and regularly push your local changes. This allows others to test intermediate versions of your contribution and provide feedback. + +In the pull request description don't forget to enter the id of the ticket you are working on as well as your Bootstrap Academy username (if you would like to receive the bounty). + +Also make sure to [allow maintainer edits](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork) in your pull request so the branch can be updated for a merge. + +Once you are done solving the ticket and are sure that everything works as described in the ticket, you can mark the pull request as ready for review. + +### Reviewing Pull Requests +Everyone can also contribute by reviewing and testing other people's pull requests and by providing feedback or suggesting changes. Note that the focus here should be on pull requests that are marked as ready for review and are not in the draft state anymore. Draft pull requests are still being worked on and are not expected to be complete yet, but for larger tickets intermediate reviews can also be helpful. + +After your pull request has been approved, it is merged, the corresponding ticket is closed and you will receive the ticket bounty (if you included your Bootstrap Academy username in the pull request description). From 8c0ad6b16ef3b5e6e3c33cb21233f95660409700 Mon Sep 17 00:00:00 2001 From: Defelo Date: Tue, 14 Nov 2023 10:50:38 +0100 Subject: [PATCH 11/12] Add license --- LICENSE.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 LICENSE.md diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..a0211cc --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,45 @@ +# Business Source License 1.1 Modified + +**License text copyright (c) 2020 MariaDB Corporation Ab, All Rights Reserved.** +“Business Source License” is a trademark of MariaDB Corporation Ab. + +## Parameters + +- **Licensor:** + Cedric Mössner + +- **Licensed Work:** + The Licensed Work is (c) 2023 Cedric Mössner. + +For more guidance on using Bootstrap Academy products under the Business Source License, please refer to our FAQ. +For information about alternative licensing arrangements for the Licensed Work, please contact [Cedric Mössner](mailto:kontakt@the-morpheus.de). + +## Notice + +### Terms + +The Licensor hereby grants you the right to copy, modify, create derivative works, and make non-production use of the Licensed Work. Redistribution or distribution of the Licensed Work or any derivative works is strictly prohibited. + +If your use of the Licensed Work does not comply with the requirements currently in effect as described in this License, you must contact the Licensor for a commercial license or refrain from using the Licensed Work. + +All copies of the original and modified Licensed Work, and derivative works of the Licensed Work, are subject to this License. + +You must conspicuously display this License on each original or modified copy of the Licensed Work. If you receive the Licensed Work in original or modified form from a third party, the terms and conditions set forth in this License apply to your use of that work. + +Any use of the Licensed Work in violation of this License will automatically terminate your rights under this License. + +This License does not grant you any right in any trademark or logo of Licensor. + +TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND TITLE. + +### Limitation of Liability + +TO THE EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL THE LICENSOR BE LIABLE FOR ANY DAMAGES, INCLUDING ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER ARISING FROM, OUT OF, OR IN CONNECTION WITH THE LICENSED WORK OR THE USE OF THE LICENSED WORK, WHETHER BASED ON CONTRACT, TORT, OR OTHERWISE. + +### Indemnification + +You agree to indemnify, defend, and hold harmless the Licensor from and against any and all claims, liabilities, damages, losses, costs, expenses, or fees (including reasonable attorneys' fees) that arise from or relate to your use or misuse of the Licensed Work. The Licensor reserves the right to assume the exclusive defense and control of any matter otherwise subject to indemnification by you and, in such case, you agree to cooperate with the Licensor's defense of such claim. + +### Governing Law and Jurisdiction + +This License shall be governed by and construed in accordance with the laws of Germany, without regard to its conflict of laws principles. Any legal action or proceeding relating to this License shall be brought exclusively in the courts of Karlsruhe, Germany, and you hereby consent to the jurisdiction and venue of such courts. From 49a5184d3ef34778ead4b4313c23fa9459052055 Mon Sep 17 00:00:00 2001 From: Defelo Date: Tue, 14 Nov 2023 10:56:03 +0100 Subject: [PATCH 12/12] Remove release profile overrides --- Cargo.toml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b28ebe7..b5a5bfc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,11 +8,6 @@ members = [ "challenges", ] -[profile.release] -strip = true -lto = true -codegen-units = 1 - [workspace.dependencies] anyhow = { version = "1.0.75", default-features = false, features = ["std"] } chrono = { version = "0.4.31", default-features = false, features = ["serde"] }