diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5576da4fb08b19568d8072461deddb812ebae6cd..4d88b4ae49c48ef969428e89f3924692bd212149 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,19 +1,65 @@ +# # Official language image. Look for the different tagged releases at: +# # https://hub.docker.com/r/library/rust/tags/ +# image: "rust:1.70-alpine3.17" +# # Use cargo to test the project +# before_script: +# - apk add --no-cache musl-dev curl +# - mkdir -p $HOME/.cargo/bin +# - curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.31/mdbook-v0.4.31-x86_64-unknown-linux-musl.tar.gz | tar -xz --directory=$HOME/.cargo/bin +# - curl -L https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/download/v0.7.7/mdbook-linkcheck.x86_64-unknown-linux-gnu.zip -o mdbook-linkcheck.zip +# - unzip mdbook-linkcheck.zip -d $HOME/.cargo/bin && chmod +x $HOME/.cargo/bin/mdbook-linkcheck +# # - cargo install mdbook-linkcheck +# - rustup component add rustfmt +# - rustup component add clippy +# - export PATH=$PATH:$HOME/.cargo/bin +# ## +# ## Install ssh-agent if not already installed, it is required by Docker. +# ## +# - 'which ssh-agent || (apk add --update openssh-client)' +# - 'which rsync || (apk add --update rsync)' +# - 'which chmod || (apk add --update chmod)' +# ## +# ## Run ssh-agent (inside the build environment) +# ## +# - eval $(ssh-agent -s) +# ## +# ## Give the right permissions, otherwise ssh-add will refuse to add files +# ## Add the SSH key stored in SSH_PRIVATE_KEY file type CI/CD variable to the agent store +# ## +# - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null +# ## +# ## Create the SSH directory and give it the right permissions +# ## +# - mkdir -p ~/.ssh +# - chmod 700 ~/.ssh +# ## +# ## Assuming you created the SSH_KNOWN_HOSTS file type CI/CD variable, uncomment the +# ## following two lines. +# ## +# - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts +# - chmod 644 ~/.ssh/known_hosts + # Official language image. Look for the different tagged releases at: # https://hub.docker.com/r/library/rust/tags/ -image: "rust:1.70-alpine3.17" +image: "rust:1-slim-bookworm" # Use cargo to test the project before_script: - - apk add --no-cache musl-dev curl + - apt update && apt upgrade -y + - apt install curl unzip -y - mkdir -p $HOME/.cargo/bin - curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.31/mdbook-v0.4.31-x86_64-unknown-linux-musl.tar.gz | tar -xz --directory=$HOME/.cargo/bin - - export PATH=$PATH:$HOME/.cargo/bin + - curl -L https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/download/v0.7.7/mdbook-linkcheck.x86_64-unknown-linux-gnu.zip -o mdbook-linkcheck.zip + - unzip mdbook-linkcheck.zip -d $HOME/.cargo/bin && chmod +x $HOME/.cargo/bin/mdbook-linkcheck + # - cargo install mdbook-linkcheck - rustup component add rustfmt + - rustup component add clippy + - export PATH=$PATH:$HOME/.cargo/bin ## ## Install ssh-agent if not already installed, it is required by Docker. ## - - 'which ssh-agent || (apk add --update openssh-client)' - - 'which rsync || (apk add --update rsync)' - - 'which chmod || (apk add --update chmod)' + - 'which ssh-agent || (apt install openssh-client -y)' + - 'which rsync || (apt install rsync -y)' + - 'which chmod || (apt install chmod -y)' ## ## Run ssh-agent (inside the build environment) ## @@ -44,6 +90,10 @@ test:cargo: stage: test script: - rustc --version && cargo --version # Print version info for debugging + - cargo clippy --version + - rustfmt --version + - ls -ltr $HOME/.cargo/bin + - mdbook --version && mdbook-linkcheck --version build:codes: stage: build diff --git a/book/book.toml b/book/book.toml index fb0a61ec4b4905ea1919421cfdd947bfee421da1..78ab4a0e5be49a0c31d47f9e83483f922c1b1294 100644 --- a/book/book.toml +++ b/book/book.toml @@ -7,3 +7,16 @@ title = "Rust-101: Université d'été" [output.html.playground] editable = true + +[output.linkcheck] +# Should we check links on the internet? Enabling this option adds a +# non-negligible performance impact +follow-web-links = true + +# How should warnings be treated? +# +# - "warn" will emit warning messages +# - "error" treats all warnings as errors, failing the linkcheck +# - "ignore" will ignore warnings, suppressing diagnostic messages and allowing +# the linkcheck to continuing +warning-policy = "error"