Skip to content

Commit

Permalink
self-hosted runner 2
Browse files Browse the repository at this point in the history
  • Loading branch information
LexLuthr committed Jul 26, 2024
1 parent 9ee733a commit 08694da
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 135 deletions.
63 changes: 63 additions & 0 deletions .github/image/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
158 changes: 23 additions & 135 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,59 +12,15 @@ 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 }}
steps:
- uses: actions/checkout@v4

Expand All @@ -76,73 +32,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<<EOF\n$CACHE_PATH\nEOF" | tee -a $GITHUB_OUTPUT
shell: bash

- name: Restore cache for dependencies
id: restore_make_deps
uses: actions/cache@v4
with:
key: ${{ steps.make_deps.outputs.key }}
path: ${{ steps.make_deps.outputs.path }}
restore-keys: |
make-deps-
- name: Install dependencies if cache miss
if: steps.restore_make_deps.outputs.cache-hit != 'true'
- name: Install FFI
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
# Install project dependencies
make deps
shell: bash

- name: Save dependencies to cache
if: steps.restore_make_deps.outputs.cache-hit != 'true'
uses: actions/cache@v4
with:
key: ${{ steps.make_deps.outputs.key }}
path: ${{ steps.make_deps.outputs.path }}

build-all:
runs-on: [self-hosted, docker]
needs: [setup-deps]
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: Restore dependencies cache
uses: actions/cache@v4
with:
key: ${{ needs.setup-deps.outputs.make_deps_key }}
path: ${{ needs.setup-deps.outputs.make_deps_path }}
restore-keys: |
make-deps-
- name: Build Go
run: make build-go
shell: bash

test:
runs-on: [self-hosted, docker]
needs: [setup-params, setup-deps]
needs: [setup-params]
strategy:
matrix:
test-suite:
Expand Down Expand Up @@ -181,28 +84,20 @@ jobs:
- name: Install Dependencies
uses: ./.github/actions/install-deps

- name: Restore dependencies cache
uses: actions/cache@v4
with:
key: ${{ needs.setup-deps.outputs.make_deps_key }}
path: ${{ needs.setup-deps.outputs.make_deps_path }}
restore-keys: |
make-deps-
- name: Cache boostci params
uses: actions/cache@v4
with:
path: /var/tmp/filecoin-proof-parameters/
key: v25-8mb-lotus-params
- name: Install FFI
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
make deps
shell: bash

- name: Run tests
run: |
go test -v --tags=debug -timeout 30m ${{ matrix.test-suite.target }}
shell: bash

lint:
needs: [setup-deps]
runs-on: [self-hosted, docker]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

Expand All @@ -214,13 +109,12 @@ jobs:
- name: Install Dependencies
uses: ./.github/actions/install-deps

- name: Restore dependencies cache
uses: actions/cache@v4
with:
key: ${{ needs.setup-deps.outputs.make_deps_key }}
path: ${{ needs.setup-deps.outputs.make_deps_path }}
restore-keys: |
make-deps-
- name: Install FFI
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
make deps
shell: bash

- name: Install golangci-lint
run: |
Expand All @@ -233,7 +127,7 @@ jobs:
shell: bash

gofmt:
runs-on: [self-hosted, docker]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

Expand All @@ -259,7 +153,7 @@ jobs:
shell: bash

cbor-check:
runs-on: [self-hosted, docker]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -292,7 +186,7 @@ jobs:
shell: bash

docs-check:
runs-on: [self-hosted, docker]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -321,7 +215,7 @@ jobs:
shell: bash

gen-check:
runs-on: [self-hosted, docker]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -355,7 +249,7 @@ jobs:

lid-docker-compose:
runs-on: [self-hosted, docker]
needs: [setup-params, setup-deps]
needs: [setup-params]
steps:
- uses: actions/checkout@v4

Expand All @@ -367,12 +261,6 @@ jobs:
- name: Install Dependencies
uses: ./.github/actions/install-deps

- name: Cache boostci params
uses: actions/cache@v4
with:
path: /var/tmp/filecoin-proof-parameters/
key: v25-8mb-lotus-params

- name: Start YugabyteDB
run: docker run --rm --name yugabyte -d -p 5433:5433 yugabytedb/yugabyte:2.21.1.0-b271 bin/yugabyted start --daemon=false
shell: bash
Expand All @@ -391,7 +279,7 @@ jobs:
shell: bash

mod-tidy-check:
runs-on: [self-hosted, docker]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

Expand Down

0 comments on commit 08694da

Please sign in to comment.