diff --git a/.docker/Dockerfile b/.docker/Dockerfile index af73443..bef5828 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -3,3 +3,5 @@ FROM rust:1.86.0-bullseye RUN rustup target install thumbv6m-none-eabi RUN cargo install flip-link --version 0.1.10 RUN rustup component add rustfmt +RUN rustup component add llvm-tools +RUN cargo install cargo-binutils diff --git a/.docker/compose.yaml b/.docker/compose.yaml index 4c4042e..9646abf 100644 --- a/.docker/compose.yaml +++ b/.docker/compose.yaml @@ -1,9 +1,6 @@ services: {{project-name}}: - build: - context: . - dockerfile: Dockerfile - image: "baker-link-env" + image: "bakerlinklab/bakerlink-env:latest" container_name: "{{project-name}}-container" volumes: - "../:/{{project-name}}" diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..67b7948 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,41 @@ +name: Build and Push Docker Image + +on: + push: + branches: [main] + paths: + - '.docker/Dockerfile' + workflow_dispatch: + +env: + DOCKER_IMAGE: bakerlinklab/bakerlink-env + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + # Requires repository secrets: DOCKERHUB_USERNAME and DOCKERHUB_TOKEN + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: .docker + file: .docker/Dockerfile + push: true + tags: | + ${{ env.DOCKER_IMAGE }}:latest + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.vscode/settings.json b/.vscode/settings.json index 93a45b7..82c1108 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,5 @@ { "rust-analyzer.cargo.target": "thumbv6m-none-eabi", + "rust-analyzer.check.allTargets": false, "editor.formatOnSave": true } \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index a9c4c72..329868d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,13 @@ rp2040-hal = { version = "0.10", features = ["rt", "critical-section-impl"] } rp2040-boot2 = "0.3" critical-section = "1.0.0" +[dev-dependencies] +defmt-test = "0.3" + +[[test]] +name = "example_test" +harness = false + # cargo build/run [profile.dev] codegen-units = 1 diff --git a/cargo-generate.toml b/cargo-generate.toml index bb488e6..32f5ec8 100644 --- a/cargo-generate.toml +++ b/cargo-generate.toml @@ -1,2 +1,2 @@ [template] -ignore = ["README.md", "LICENSE"] +ignore = ["README.md", "LICENSE", ".github/"] diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..e5da890 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "1.86.0" +targets = ["thumbv6m-none-eabi"] +components = ["rustfmt", "llvm-tools"] diff --git a/tests/example_test.rs b/tests/example_test.rs new file mode 100644 index 0000000..aa2928d --- /dev/null +++ b/tests/example_test.rs @@ -0,0 +1,20 @@ +#![no_std] +#![no_main] + +use defmt_rtt as _; +use panic_probe as _; +use rp2040_hal as _; + +#[link_section = ".boot2"] +#[used] +pub static BOOT2: [u8; 256] = rp2040_boot2::BOOT_LOADER_GENERIC_03H; + +#[defmt_test::tests] +mod tests { + use defmt::assert; + + #[test] + fn it_works() { + assert!(true); + } +}