trying Earthly CI

This commit is contained in:
Anton-4 2021-02-02 15:14:27 +01:00
parent ea05561d85
commit 453a83b660
2 changed files with 88 additions and 65 deletions

View File

@ -3,18 +3,28 @@ on: [pull_request]
name: CI name: CI
env: env:
RUSTC_WRAPPER: /usr/local/bin/sccache
SCCACHE_BUCKET: ${{ secrets.SCCACHE_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SCCACHE_S3_USE_SSL: ${{ secrets.SCCACHE_S3_USE_SSL }}
SCCACHE_REGION: ${{ secrets.SCCACHE_REGION }}
RUST_BACKTRACE: 1 RUST_BACKTRACE: 1
jobs: jobs:
prep-dependency-container:
name: update earthly container if changed
runs-on: self-hosted
timeout-minutes: 60
env:
FORCE_COLOR: 1
steps:
- uses: actions/checkout@v2
- name: Earthly version
run: earthly --version
- name: build container roc-deps:latest
run: earthly +all
test: test:
name: fmt, clippy, test, test --release name: fmt, clippy, test --release
runs-on: ubuntu-latest runs-on: self-hosted
container: roc-deps:latest
timeout-minutes: 60 timeout-minutes: 60
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -22,66 +32,23 @@ jobs:
- name: Log CPU model - name: Log CPU model
run: sudo cat /proc/cpuinfo | grep name | uniq run: sudo cat /proc/cpuinfo | grep name | uniq
- name: Install CI Libraries # - name: Run Zig tests
run: sudo ./ci/install-ci-libraries.sh 10 # run: pushd compiler/builtins/bitcode; ./run-tests.sh; popd;
- name: scope sccache to CPU model # - name: Enable LLD
run: | # run: sudo ./ci/enable-lld.sh
export SCCACHE_S3_KEY_PREFIX=`sudo cat /proc/cpuinfo | grep name | uniq | awk -F: {'print $2'} | awk -F@ {'print$1'} | xargs | sed -e 's/\s/_/g'`
echo "SCCACHE_S3_KEY_PREFIX=$SCCACHE_S3_KEY_PREFIX" >> $GITHUB_ENV
- name: print SCCACHE_S3_KEY_PREFIX - name: rustfmt version
run: echo $SCCACHE_S3_KEY_PREFIX run: cargo fmt --version
- name: sccache version - name: cargo fmt --check
run: /usr/local/bin/sccache -V run: cargo fmt --all -- --check
- name: Run Zig tests - name: clippy version
run: pushd compiler/builtins/bitcode; ./run-tests.sh; popd; run: cargo clippy -V
- name: Enable LLD - name: cargo clippy
run: sudo ./ci/enable-lld.sh run: cargo clippy -- -D warnings
- uses: actions-rs/toolchain@v1 - name: cargo test
name: Install Rust Toolchain run: cargo test --release
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
name: rustfmt version
with:
command: fmt
args: --version
- uses: actions-rs/cargo@v1
name: cargo fmt --check
with:
command: fmt
args: --all -- --check
- run: rustup component add clippy
- uses: actions-rs/cargo@v1
name: clippy version
with:
command: clippy
args: -V
- uses: actions-rs/cargo@v1
name: cargo clippy
with:
command: clippy
args: -- -D warnings
- uses: actions-rs/cargo@v1
name: cargo test --release
with:
command: test
args: --release
- name: sccache stats
run: /usr/local/bin/sccache --show-stats

56
Earthfile Normal file
View File

@ -0,0 +1,56 @@
FROM rust:1.49-slim-buster
WORKDIR /earthbuild
# TODO cache cargo packages
# TODO lld linker
# TODO caching steps
prep-debian:
RUN apt -y update
install-other-libs:
FROM +prep-debian
RUN apt -y install wget git
RUN apt -y install libxcb-shape0-dev libxcb-xfixes0-dev # for editor clipboard
RUN apt -y install libc++-dev libc++abi-dev libunwind-dev pkg-config libx11-dev zlib1g-dev
install-zig:
FROM +install-other-libs
RUN wget -c https://ziglang.org/download/0.7.1/zig-linux-x86_64-0.7.1.tar.xz --no-check-certificate
RUN tar -xf zig-linux-x86_64-0.7.1.tar.xz
RUN ln -s /root/downloads/zig-linux-x86_64-0.7.1/zig /usr/bin/zig
install-llvm:
FROM +install-other-libs
RUN apt -y install lsb-release software-properties-common gnupg
RUN wget https://apt.llvm.org/llvm.sh
RUN chmod +x llvm.sh
RUN ./llvm.sh 10
RUN ln -s /usr/bin/clang-10 /usr/bin/clang
RUN ln -s /usr/bin/lld-10 /usr/bin/lld
install-valgrind:
FROM +install-other-libs
RUN apt -y install autotools-dev cmake automake
RUN wget https://sourceware.org/pub/valgrind/valgrind-3.16.1.tar.bz2
RUN tar -xf valgrind-3.16.1.tar.bz2
RUN mv valgrind-3.16.1/* . # we can't cd so we have to move the files
RUN ls
RUN ./autogen.sh
RUN ./configure --disable-dependency-tracking
RUN make -j`nproc`
RUN make install
install-clippy:
RUN rustup component add clippy
install-fmt:
RUN rustup component add rustfmt
all:
BUILD +install-zig
BUILD +install-llvm
BUILD +install-valgrind
BUILD +install-clippy
BUILD +install-fmt
SAVE IMAGE roc-deps:latest