Skip to content

Commit

Permalink
Cleanup and tooling fixes (#54)
Browse files Browse the repository at this point in the history
* Remove sqlx

* Upgrade packages

* Use nightly toolchain without pinning to a specific version

* Add Cargo.lock

* Remove unnecessary code

* Update gitpod config

* Update .gitpod.Dockerfile

* Up

* Pin toolchain

* Pin docker image

* Custom rust installation
  • Loading branch information
axonasif committed Oct 13, 2023
1 parent 891fe29 commit 1d003c5
Show file tree
Hide file tree
Showing 26 changed files with 2,863 additions and 950 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/target
/Cargo.lock
/bot.sqlite*
/data.ms
/*BotConfig.toml
Expand Down
18 changes: 17 additions & 1 deletion .gitpod.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM gitpod/workspace-rust:2023-03-24-22-45-37
FROM gitpod/workspace-base:2023-10-13-07-50-14

USER root

Expand All @@ -9,3 +9,19 @@ RUN target=/usr/bin/meilisearch \
&& chmod +x "${target}"

USER gitpod

ENV RUST_VERSION="nightly-2023-10-12"
ENV PATH=$HOME/.cargo/bin:$PATH

RUN curl -fsSL https://sh.rustup.rs | sh -s -- -y --no-modify-path --default-toolchain ${RUST_VERSION} \
-c rls rust-analysis rust-src rustfmt clippy \
&& for cmp in rustup cargo; do rustup completions bash "$cmp" > "$HOME/.local/share/bash-completion/completions/$cmp"; done \
&& printf '%s\n' 'export CARGO_HOME=/workspace/.cargo' \
'mkdir -m 0755 -p "$CARGO_HOME/bin" 2>/dev/null' \
'export PATH=$CARGO_HOME/bin:$PATH' \
'test ! -e "$CARGO_HOME/bin/rustup" && mv "$(command -v rustup)" "$CARGO_HOME/bin"' > $HOME/.bashrc.d/80-rust \
&& rm -rf "$HOME/.cargo/registry" # This registry cache is now useless as we change the CARGO_HOME path to `/workspace`

RUN rustup default ${RUST_VERSION} # not needed but anyway \
&& rustup component add clippy \
&& rustup component add rustfmt
11 changes: 3 additions & 8 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
image:
image:
file: .gitpod.Dockerfile

tasks:
- name: Project build (cache) and run instructions
init: |
cargo build
# workaround for https://github.com/gitpod-io/gitpod/issues/524
find target -exec stat --format='%.Y %n' {} + > /workspace/.ts
Expand All @@ -16,10 +16,6 @@ tasks:
# Fully cleanup terminal
printf "\033[3J\033c\033[3J"
# Install clippy and rustfmt
rustup component add clippy --toolchain nightly-2023-06-27
rustup component add rustfmt --toolchain nightly-2023-06-27
# Restore ProdBotConfig.toml
if test -n "${PROD_DISCORD_BOT_CONFIG_ENCODED:-}"; then {
base64 -d <<<"${PROD_DISCORD_BOT_CONFIG_ENCODED}" > ProdBotConfig.toml
Expand Down Expand Up @@ -62,6 +58,5 @@ tasks:
# meilisearch --no-analytics --master-key "${MEILISEARCH_API_KEY}" --env development --http-addr 0.0.0.0:7700 --db-path ./data.ms
vscode:
extensions:
- rust-lang.rust-analyzer
- https://github.com/rust-lang/rust-analyzer/releases/download/2023-10-09/rust-analyzer-linux-x64.vsix
- tamasfe.even-better-toml

2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"rust-analyzer.check.command": "clippy"
"rust-analyzer.check.command": "clippy",
}
Loading

0 comments on commit 1d003c5

Please sign in to comment.