diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..342ee83 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +target/ +Dockerfile diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..632649d --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,25 @@ +name: Test suite + + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + schedule: + - cron: "0 2 * * 1-5" + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Prepare the AVR Rust build environment + run: + docker build . --file Dockerfile.ci --tag avr-rust/ruduino.ci:$GITHUB_RUN_NUMBER + + - name: Compile the crate + run: + docker run avr-rust/ruduino.ci:$GITHUB_RUN_NUMBER + diff --git a/Dockerfile.ci b/Dockerfile.ci new file mode 100644 index 0000000..436da18 --- /dev/null +++ b/Dockerfile.ci @@ -0,0 +1,20 @@ +FROM ubuntu:18.04 + +RUN useradd -m avr-rust + +# Install dependencies +RUN apt-get update -y && apt-get install -y wget gcc binutils gcc-avr avr-libc + +RUN mkdir -p /code && chown avr-rust:avr-rust /code + +USER avr-rust + +# Install Rustup along with nightly +RUN wget -q https://sh.rustup.rs -O /tmp/rustup.sh && sh /tmp/rustup.sh -y --profile minimal --default-toolchain nightly -c rust-src --quiet +ENV PATH=/home/avr-rust/.cargo/bin:$PATH + +COPY --chown=avr-rust:avr-rust . /code/ruduino + +WORKDIR /code/ruduino + +CMD ["cargo", "build", "-Z", "build-std=core", "--target", "avr-atmega328p.json", "--release"] diff --git a/avr-atmega328p.json b/avr-atmega328p.json new file mode 100644 index 0000000..4d2c873 --- /dev/null +++ b/avr-atmega328p.json @@ -0,0 +1,32 @@ +{ + "arch": "avr", + "cpu": "atmega328p", + "data-layout": "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8", + "env": "", + "executables": true, + "linker": "avr-gcc", + "linker-flavor": "gcc", + "linker-is-gnu": true, + "llvm-target": "avr-unknown-unknown", + "no-compiler-rt": true, + "os": "unknown", + "position-independent-executables": false, + "exe-suffix": ".elf", + "eh-frame-header": false, + "pre-link-args": { + "gcc": [ + "-Os", + "-mmcu=atmega328p" + ] + }, + "late-link-args": { + "gcc": [ + "-lc", + "-lgcc" + ] + }, + "target-c-int-width": "16", + "target-endian": "little", + "target-pointer-width": "16", + "vendor": "unknown" +}