Skip to content

Commit

Permalink
CI: Use kubernetes based GHA self-hosted runners MGX-668 (#605)
Browse files Browse the repository at this point in the history
  • Loading branch information
tenequm authored Oct 4, 2023
1 parent d6653cb commit cda6e15
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 36 deletions.
40 changes: 14 additions & 26 deletions .github/workflows/reusable-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@ permissions:
jobs:
build-node-image:
name: Build Docker image
runs-on: [self-hosted, compile]
runs-on: [compile-gke]
container:
image: ${{ inputs.builder_image }}
env:
DOCKER_HOST: 'unix:///run/docker/docker.sock'
volumes:
- /run/docker:/run/docker
steps:
- uses: actions/checkout@v3
- name: Authenticate to Google Cloud
Expand Down Expand Up @@ -62,6 +66,9 @@ jobs:
- name: Build and push Docker image
run: |
# This is needed to fix an issue when running on self-hosted runners in GKE
git config --global --add safe.directory /__w/mangata-node/mangata-node
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }}
docker build -f devops/dockerfiles/node/Dockerfile \
--label="git_rev=$(git rev-parse HEAD)" \
Expand Down Expand Up @@ -103,10 +110,6 @@ jobs:
./mangata_kusama_runtime-${{ inputs.version }}-fast.compact.compressed.wasm
./mangata_rococo_runtime-${{ inputs.version }}-fast.compact.compressed.wasm
- name: Fix permissions on self-hosted runner
if: always()
run: chown -R 1100:1100 $GITHUB_WORKSPACE

rustfmt-check:
name: Formatting check
runs-on: ubuntu-latest
Expand Down Expand Up @@ -143,7 +146,7 @@ jobs:

unit-test:
name: Unit tests
runs-on: [self-hosted, compile]
runs-on: [compile-gke]
container:
image: ${{ inputs.builder_image }}
steps:
Expand All @@ -164,13 +167,10 @@ jobs:
key: cargo-unit-cache-${{ inputs.cache_version }}-${{ hashFiles('Cargo.lock') }}
- name: Run unit tests
run: cargo test -j2
- name: Fix permissions on self-hosted runner
if: always()
run: chown -R 1100:1100 $GITHUB_WORKSPACE

coverage-report:
name: Coverage report
runs-on: [self-hosted, compile]
runs-on: [compile-gke]
container:
image: ${{ inputs.builder_image }}
options: --security-opt seccomp=unconfined
Expand Down Expand Up @@ -199,9 +199,6 @@ jobs:
with:
token: ${{ secrets.ORG_CODECOV_TOKEN }}
fail_ci_if_error: true
- name: Fix permissions on self-hosted runner
if: always()
run: chown -R 1100:1100 $GITHUB_WORKSPACE

run-benchmarks-tests:
name: Run benchmark tests
Expand Down Expand Up @@ -231,7 +228,7 @@ jobs:

build-and-run-try-runtime:
name: Run try-runtime checks
runs-on: [self-hosted, compile]
runs-on: [compile-gke]
container:
image: ${{ inputs.builder_image }}
steps:
Expand All @@ -258,13 +255,10 @@ jobs:
- name: Run try-runtime Kusama Mainnet
run: cargo run --release --features=try-runtime try-runtime --chain=kusama --runtime=target/release/wbuild/mangata-kusama-runtime/mangata_kusama_runtime.wasm on-runtime-upgrade live --uri wss://kusama-rpc.mangata.online:443

- name: Fix permissions on self-hosted runner
if: always()
run: chown -R 1100:1100 $GITHUB_WORKSPACE

run-benchmarks:
name: Run runtime benchmarks
runs-on: [self-hosted, performance]
# `performance` self-hosted runners have 8 cores and 16GB of RAM
runs-on: [performance-gke]
env:
STEPS: 2
REPEATS: 1
Expand Down Expand Up @@ -324,13 +318,10 @@ jobs:
name: benchmarks
path: ./benchmarks

- name: Fix permissions on self-hosted runner
if: always()
run: chown -R 1100:1100 $GITHUB_WORKSPACE

build-wasms:
name: Export wasm artifacts
runs-on: [self-hosted, compile]
runs-on: [compile-gke]
env:
STEPS: 2
REPEATS: 1
Expand Down Expand Up @@ -369,6 +360,3 @@ jobs:
/bin/bash -c 'target/release/mangata-node export-genesis-state --chain=rococo-local -l=info,xyk=error > /dev/null'
/bin/bash -c 'target/release/mangata-node export-genesis-wasm --chain=rococo-local -l=info,xyk=error > /dev/null'
- name: Fix permissions on self-hosted runner
if: always()
run: chown -R 1100:1100 $GITHUB_WORKSPACE
14 changes: 9 additions & 5 deletions .github/workflows/reusable-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jobs:
- command: "yarn test-sdk"
fast: true

runs-on: [self-hosted, compile]
runs-on: [e2e-gke]
timeout-minutes: 180
env:
API_URL: "ws://127.0.0.1:9946"
Expand Down Expand Up @@ -175,6 +175,14 @@ jobs:
ref: "${{ env.E2EBRANCHNAME }}"
path: e2eTests

# Fixing issue with not having yarn installed on self-hosted runners in Kubernetes
- name: Install yarn and docker-compose to fix self-hosted runner issue when running setup-node
#Ref: https://github.com/actions/setup-node/issues/182
run: |-
curl -fsSL --create-dirs -o $HOME/bin/yarn https://github.com/yarnpkg/yarn/releases/download/v1.22.19/yarn-1.22.19.js && chmod +x $HOME/bin/yarn
curl -SL https://github.com/docker/compose/releases/download/v2.20.3/docker-compose-linux-x86_64 -o $HOME/bin/docker-compose && chmod +x $HOME/bin/docker-compose
echo "$HOME/bin" >> $GITHUB_PATH
- uses: actions/setup-node@v3
with:
node-version: '18.16.1'
Expand Down Expand Up @@ -280,10 +288,6 @@ jobs:
run: |
docker kill $(docker ps -q) 2>/dev/null && echo $?
docker-compose down -v
- name: Fix permissions on self-hosted runner
if: always()
run: chown -R 1100:1100 $GITHUB_WORKSPACE
test-complete:
needs: [setup-report, e2e-test-matrix]
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/reusable-perfomance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ permissions:

jobs:
performance-tests:
runs-on: [self-hosted, compile]
runs-on: [compile-gke]
timeout-minutes: 180
env:
ENV_REF: ${{ inputs.targetEnv || format('pr-{0}', github.event.number) }}
Expand Down Expand Up @@ -88,7 +88,3 @@ jobs:
./e2e/performance/enqueued.txt
./e2e/performance/executed.txt
./e2e/performance/pending.txt
- name: Fix permissions on self-hosted runner
if: always()
run: chown -R 1100:1100 $GITHUB_WORKSPACE

0 comments on commit cda6e15

Please sign in to comment.