Add Docker based CI pipeline

main
Dylan McKay 2020-07-24 20:12:52 +12:00
parent 6fa56ed4cd
commit b2c9a293da
4 changed files with 79 additions and 0 deletions

2
.dockerignore Normal file
View File

@ -0,0 +1,2 @@
target/
Dockerfile

25
.github/workflows/docker-image.yml vendored Normal file
View File

@ -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

20
Dockerfile.ci Normal file
View File

@ -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"]

32
avr-atmega328p.json Normal file
View File

@ -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"
}