diff --git a/.gitea/workflows/checks.yml b/.gitea/workflows/checks.yml new file mode 100644 index 0000000..02f5f3e --- /dev/null +++ b/.gitea/workflows/checks.yml @@ -0,0 +1,44 @@ +name: checks +on: + pull_request: + paths: &CODE_PATHS + - 'src/**' + - 'Cargo*' + push: + paths: *CODE_PATHS + branches: + - main + +jobs: + # TODO(cascode) cache checkout for build and test stages? + lint: + container: + # TODO use communitymedia docker registry + image: "cascode/aural-isle-ci:0" + steps: + - uses: actions/checkout@v3 + with: + github-server-url: "https://code.communitymedia.network" + - name: rustfmt + run: cargo fmt --check + build: + container: + # TODO use communitymedia docker registry + image: "cascode/aural-isle-ci:2" + steps: + - uses: actions/checkout@v3 + with: + github-server-url: "https://code.communitymedia.network" + - name: build + run: cargo build + # TODO(cascode) cache builds for test stage + test: + container: + # TODO use communitymedia docker registry + image: "cascode/aural-isle-ci:2" + steps: + - uses: actions/checkout@v3 + with: + github-server-url: "https://code.communitymedia.network" + - name: run unit tests + run: cargo test diff --git a/ci/Dockerfile b/ci/Dockerfile new file mode 100644 index 0000000..ba54756 --- /dev/null +++ b/ci/Dockerfile @@ -0,0 +1,7 @@ +FROM rust:1.73-alpine3.18 + +#install build tooling +RUN apk add musl-dev && rustup component add rustfmt + +# install gitea act_runner dependencies +RUN apk add nodejs git diff --git a/src/main.rs b/src/main.rs index bd5795f..3489aa9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,8 +2,7 @@ use warp::Filter; #[tokio::main] async fn main() { - let hello = warp::get() - .map(|| format!("Hello world!")); + let hello = warp::get().map(|| format!("Hello world!")); warp::serve(hello).run(([127, 0, 0, 1], 5309)).await; }