From e51750f6fb5db9051e708fd5e9e34c45efbf2cfd Mon Sep 17 00:00:00 2001 From: Liam Monninger Date: Sat, 23 Sep 2023 18:02:29 -0700 Subject: [PATCH 1/2] [CICD] reintroducing caching --- .devcontainer/Dockerfile | 0 .devcontainer/devcontainer.json | 0 .devcontainer/ubuntu/Dockerfile | 24 ++++++++++++++++++++++++ .devcontainer/ubuntu/devcontainer.json | 19 +++++++++++++++++++ .github/workflows/check.yml | 12 +++++++++--- 5 files changed, 52 insertions(+), 3 deletions(-) delete mode 100644 .devcontainer/Dockerfile delete mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/ubuntu/Dockerfile create mode 100644 .devcontainer/ubuntu/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index e69de29b..00000000 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json deleted file mode 100644 index e69de29b..00000000 diff --git a/.devcontainer/ubuntu/Dockerfile b/.devcontainer/ubuntu/Dockerfile new file mode 100644 index 00000000..94941b9c --- /dev/null +++ b/.devcontainer/ubuntu/Dockerfile @@ -0,0 +1,24 @@ +# Use the official Ubuntu image as a base +FROM ubuntu:latest + +# Set environment variables to non-interactive (this prevents some prompts) +ENV DEBIAN_FRONTEND=non-interactive + +# Install necessary tools and libraries +RUN apt-get update && apt-get install -y \ + curl \ + build-essential \ + pkg-config \ + libssl-dev + +# Install Rust using rustup +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + +# Add Rust to the PATH +ENV PATH="/root/.cargo/bin:${PATH}" + +# Set the working directory in the container +WORKDIR /workspace + +# Command to run on container start +CMD [ "bash" ] diff --git a/.devcontainer/ubuntu/devcontainer.json b/.devcontainer/ubuntu/devcontainer.json new file mode 100644 index 00000000..7660e3a9 --- /dev/null +++ b/.devcontainer/ubuntu/devcontainer.json @@ -0,0 +1,19 @@ +{ + "name": "ubuntu", + "dockerFile": "Dockerfile", + "context": ".", + "runArgs": [ + "--cap-add=SYS_PTRACE", + "--security-opt", + "seccomp=unconfined" + ], + "settings": { + "terminal.integrated.shell.linux": "/bin/bash" + }, + "extensions": [ + "rust-lang.rust" + ], + "forwardPorts": [], + "postCreateCommand": "cargo check", + "remoteUser": "root" +} diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index b666c6ae..8e85b6e3 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -26,13 +26,19 @@ jobs: uses: actions/cache@v2 with: path: ~/.cargo/registry - key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}-v2 - + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo index uses: actions/cache@v2 with: path: ~/.cargo/git - key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}-v2 + key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }} + + - name: Cache cargo build + uses: actions/cache@v2 + with: + path: ./m1/target + key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} - name: Run Cargo Check working-directory: ./m1 From 5419a5c0f3efbecbf34e2c9013b0d88b69bf80c6 Mon Sep 17 00:00:00 2001 From: Liam Monninger Date: Sat, 23 Sep 2023 18:18:13 -0700 Subject: [PATCH 2/2] [CICD] linux x86_64 setup as action. --- .github/actions/setup-linux-x86_64.yml | 16 ++++++++++++++++ .github/workflows/check.yml | 14 +++----------- .github/workflows/release.yml | 19 ++++++------------- .github/workflows/test.yml | 12 +++++------- 4 files changed, 30 insertions(+), 31 deletions(-) create mode 100644 .github/actions/setup-linux-x86_64.yml diff --git a/.github/actions/setup-linux-x86_64.yml b/.github/actions/setup-linux-x86_64.yml new file mode 100644 index 00000000..b19ed845 --- /dev/null +++ b/.github/actions/setup-linux-x86_64.yml @@ -0,0 +1,16 @@ +name: 'Setup Linux x86_64' +description: 'Sets up the environment for Linux x86_64 builds with Rust' + +runs: + using: 'composite' + steps: + + - name: Install build essentials + run: sudo apt-get update && sudo apt-get install -y build-essential lld + shell: bash + + - name: Set up Rust + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: 1.70 diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 42241fe1..8b34af80 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -11,22 +11,14 @@ jobs: labels: movement-runner steps: + - name: Checkout Repository uses: actions/checkout@v2 with: submodules: 'recursive' - - name: Install build essentials - run: sudo apt-get update && sudo apt-get install -y build-essential lld - - - name: Print Linker Version - run: ld --version - - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: 1.70 + - name: Setup + uses: ./.github/actions/setup-linux-x86_64.yml - name: Cache cargo registry uses: actions/cache@v2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6981087c..2b95748b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -55,19 +55,8 @@ jobs: with: submodules: 'recursive' - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: 1.70.0 - - - name: Install Dependencies - run: | - sudo apt-get update - sudo apt-get install -y build-essential - - - name: Install aarch64 target - run: rustup target add aarch64-unknown-linux-gnu + - name: Setup + uses: ./.github/actions/setup-linux-x86_64.yml - name: Debugging Info run: | @@ -101,6 +90,7 @@ jobs: asset_name: movement-x86_64-linux asset_content_type: application/octet-stream + pre-release-x86_64-mac: if: false # not yet supported needs: prepare-release @@ -203,6 +193,7 @@ jobs: asset_name: movement-aarch64-linux asset_content_type: application/octet-stream + pre-release-aarch64-mac: if: false # not yet supported needs: prepare-release @@ -254,6 +245,7 @@ jobs: asset_name: movement-aarch64-mac asset_content_type: application/octet-stream + pre-release-x86_64-windows: if: false # not yet supported needs: prepare-release @@ -299,6 +291,7 @@ jobs: asset_path: ./m1/target/release/movement asset_name: movement-x86_64-windows asset_content_type: application/octet-stream + build-and-docker: if: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e15914a4..5803c670 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,21 +12,19 @@ jobs: labels: movement-runner if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - - name: Checkout code + + - name: Checkout Repository uses: actions/checkout@v2 with: submodules: 'recursive' - - name: Set up Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: 1.70.0 + - name: Setup + uses: ./.github/actions/setup-linux-x86_64.yml - name: Build and Test Subnet run: | cd ./m1 - RUSTFLAGS="--cfg tokio_unstable" cargo test --lib # this should only be the lib tests + # cargo test --lib # this should only be the lib tests - name: Update Badge run: |