From 1a3db55074f8eabd54761f76cdc0a1556a1ebcf1 Mon Sep 17 00:00:00 2001 From: LexLuthr Date: Fri, 26 Jul 2024 19:53:02 +0400 Subject: [PATCH] self-hosted runner 2 --- .github/image/Dockerfile | 63 ++++++++++++++++ .github/workflows/ci.yml | 159 ++++++--------------------------------- 2 files changed, 87 insertions(+), 135 deletions(-) create mode 100644 .github/image/Dockerfile diff --git a/.github/image/Dockerfile b/.github/image/Dockerfile new file mode 100644 index 000000000..fc9b39ee0 --- /dev/null +++ b/.github/image/Dockerfile @@ -0,0 +1,63 @@ +## This image is used to github action runner for this repo +# Use the official Golang image as the base image +FROM golang:1.22-bullseye AS builder + +# Set the working directory inside the container +WORKDIR /app + +# Copy the entire project directory to the working directory +COPY . . + +# Download all the dependencies +RUN go mod download + +# Stage 2: Install Lotus binary +FROM ghcr.io/filecoin-shipyard/lotus-containers:lotus-v1.28.1-devnet AS lotus-test + +# Stage 3: Build the final image +FROM myoung34/github-runner AS curio-github-runner + +# Copy Go dependencies from the builder stage +COPY --from=builder /go/pkg /go/pkg +COPY --from=builder /go/bin /go/bin +COPY --from=lotus-test /usr/local/bin/lotus /usr/local/bin/ + +RUN apt update && apt install -y \ + build-essential \ + bzr pkg-config \ + clang \ + curl \ + gcc git \ + hwloc \ + jq \ + libhwloc-dev wget \ + mesa-opencl-icd \ + ocl-icd-opencl-dev + +ENV RUSTUP_HOME=/usr/local/rustup \ + CARGO_HOME=/usr/local/cargo \ + PATH=/usr/local/cargo/bin:$PATH \ + RUST_VERSION=1.76.0 + +RUN set -eux; \ + dpkgArch="$(dpkg --print-architecture)"; \ + case "${dpkgArch##*-}" in \ + amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='0b2f6c8f85a3d02fde2efc0ced4657869d73fccfce59defb4e8d29233116e6db' ;; \ + armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='f21c44b01678c645d8fbba1e55e4180a01ac5af2d38bcbd14aa665e0d96ed69a' ;; \ + arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='673e336c81c65e6b16dcdede33f4cc9ed0f08bde1dbe7a935f113605292dc800' ;; \ + i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='e7b0f47557c1afcd86939b118cbcf7fb95a5d1d917bdd355157b63ca00fc4333' ;; \ + *) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \ + esac; \ + url="https://static.rust-lang.org/rustup/archive/1.26.0/${rustArch}/rustup-init"; \ + wget "$url"; \ + echo "${rustupSha256} *rustup-init" | sha256sum -c -; \ + chmod +x rustup-init; \ + ./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \ + rm rustup-init; \ + chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \ + rustup --version; \ + cargo --version; \ + rustc --version; + +# Allow attaching a volume for the specified path +VOLUME /var/tmp/filecoin-proof-parameters diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 808d9df27..c95fdbc39 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,59 +12,16 @@ env: GO_VERSION: 1.22.3 jobs: - setup-runners: - runs-on: [self-hosted, base1] - - steps: - - name: Start GitHub Runners - run: | - start_github_runners.sh - shell: bash - - - name: Wait for Runners to Be Ready - run: sleep 60 - setup-params: runs-on: [self-hosted, docker] - needs: [setup-runners] steps: - - uses: actions/checkout@v4 - - - name: Setup Go - uses: ./.github/actions/setup-go - with: - go-version: ${{ env.GO_VERSION }} - - - name: Install Dependencies - uses: ./.github/actions/install-deps - - - name: Cache boostci params - id: cache-params - uses: actions/cache@v4 - with: - path: /var/tmp/filecoin-proof-parameters/ - key: v25-8mb-lotus-params - - - name: Run boostci - if: steps.cache-params.outputs.cache-hit != 'true' - run: make boostci - shell: bash - - name: Fetch parameters - if: steps.cache-params.outputs.cache-hit != 'true' - run: ./boostci fetch-params 8388608 + run: lotus fetch-params 8388608 shell: bash - - name: Save parameters to cache - if: steps.cache-params.outputs.cache-hit != 'true' - run: echo "Cache saved" - - setup-deps: + build-all: runs-on: [self-hosted, docker] - needs: [setup-runners] - outputs: - make_deps_key: ${{ steps.make_deps.outputs.key }} - make_deps_path: ${{ steps.make_deps.outputs.path }} + needs: [setup-deps] steps: - uses: actions/checkout@v4 @@ -76,73 +33,20 @@ jobs: - name: Install Dependencies uses: ./.github/actions/install-deps - - name: Generate cache key for dependencies - id: make_deps - env: - CACHE_KEY: ${{ runner.os }}-${{ runner.arch }}-make-deps-${{ hashFiles('./.git/modules/extern/filecoin-ffi/HEAD') }} - CACHE_PATH: | - ./extern/filecoin-ffi/filcrypto.h - ./extern/filecoin-ffi/libfilcrypto.a - ./extern/filecoin-ffi/filcrypto.pc - run: | - echo "key=${CACHE_KEY}" >> $GITHUB_OUTPUT - echo -e "path<