Run continuous integration on a custom image
Write a Dockerfile that describes a Debian image with our build environment set up in it. Write a script that builds and tags the custom image. Set the continuous integration workflow to run on the custom image, pulled from Docker's local image store. Running the examples on the custom image takes the same steps as running them on a development machine, so we no longer gain anything from factoring out the `cargo run --example` steps. That means we can get rid of the `run-examples` action. Since the build environment is now set up ahead of time, we can get rid of the `setup-rust` action too.
This commit is contained in:
parent
bbfdf2b87f
commit
4442dd860b
5 changed files with 40 additions and 30 deletions
|
@ -1,12 +0,0 @@
|
|||
# run all Cargo examples, as described here:
|
||||
#
|
||||
# Karol Kuczmarski. "Add examples to your Rust libraries"
|
||||
# http://xion.io/post/code/rust-examples.html
|
||||
#
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- run: cd app-proto; cargo run --example irisawa-hexlet
|
||||
- run: cd app-proto; cargo run --example three-spheres
|
||||
- run: cd app-proto; cargo run --example point-on-sphere
|
||||
- run: cd app-proto; cargo run --example kaleidocycle
|
|
@ -1,10 +0,0 @@
|
|||
# set up the Rust toolchain. based on David Tolnay's more general
|
||||
# `rust-toolchain` action for GitHub
|
||||
#
|
||||
# https://github.com/dtolnay/rust-toolchain
|
||||
#
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- run: curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused --location --silent --show-error --fail 'https://sh.rustup.rs' | sh -s -- -y --profile minimal
|
||||
- run: echo $HOME/.cargo/bin >> $GITHUB_PATH
|
|
@ -3,23 +3,46 @@ on:
|
|||
push:
|
||||
branches: [main]
|
||||
jobs:
|
||||
# build the application, reporting success if the build completes
|
||||
build:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: dyna3:ci
|
||||
defaults:
|
||||
run:
|
||||
working-directory: app-proto
|
||||
steps:
|
||||
- uses: https://code.forgejo.org/actions/checkout@v4
|
||||
- uses: ./.forgejo/setup-rust
|
||||
- run: rustup target add wasm32-unknown-unknown
|
||||
- run: cargo install trunk
|
||||
- run: cd app-proto; trunk build
|
||||
- run: trunk build
|
||||
|
||||
# run the automated tests, reporting success if the tests pass
|
||||
test:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: dyna3:ci
|
||||
defaults:
|
||||
run:
|
||||
working-directory: app-proto
|
||||
steps:
|
||||
- uses: https://code.forgejo.org/actions/checkout@v4
|
||||
- uses: ./.forgejo/setup-rust
|
||||
- run: cd app-proto; cargo test
|
||||
- run: cargo test
|
||||
|
||||
# run the Cargo examples, as described here:
|
||||
#
|
||||
# Karol Kuczmarski. "Add examples to your Rust libraries"
|
||||
# http://xion.io/post/code/rust-examples.html
|
||||
#
|
||||
# report success if the examples build and run without errors
|
||||
run-examples:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: dyna3:ci
|
||||
defaults:
|
||||
run:
|
||||
working-directory: app-proto
|
||||
steps:
|
||||
- uses: https://code.forgejo.org/actions/checkout@v4
|
||||
- uses: ./.forgejo/setup-rust
|
||||
- uses: ./.forgejo/run-examples
|
||||
- run: cargo run --example irisawa-hexlet
|
||||
- run: cargo run --example three-spheres
|
||||
- run: cargo run --example point-on-sphere
|
||||
- run: cargo run --example kaleidocycle
|
4
tools/ci-image/Dockerfile
Normal file
4
tools/ci-image/Dockerfile
Normal file
|
@ -0,0 +1,4 @@
|
|||
FROM rust:1.85-slim-bookworm
|
||||
RUN rustup target add wasm32-unknown-unknown
|
||||
RUN cargo install trunk
|
||||
WORKDIR /home
|
5
tools/ci-image/build
Executable file
5
tools/ci-image/build
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
# build and tag the Docker image we use for continuous integration
|
||||
|
||||
docker build . --tag dyna3:ci
|
Loading…
Add table
Reference in a new issue