Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Move CI from Gitlab to GitHub #1889

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
109 changes: 109 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Zombienet Integration Tests

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions: {}

env:
IMAGE_NAME: paritypr/zombienet
VERSION: ${{ github.sha }}

jobs:
build_image:
name: Build image
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Check out the repo
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v.4.2.0

- name: npm build
run: |
cd javascript
npm install
npm dedupe
npm run clean
npm run build

- name: Build Docker image
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0
with:
file: ./scripts/ci/docker/zombienet_injected.Dockerfile
context: .
push: false
tags: |
${{ env.IMAGE_NAME }}:${{ env.VERSION }}
${{ env.IMAGE_NAME }}:latest

build_push_image:
name: Build and Push Docker image to Docker Hub
runs-on: ubuntu-latest
timeout-minutes: 30
needs: [build_image]
steps:
- name: Check out the repo
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v.4.2.0

- name: npm build
run: |
cd javascript
npm install
npm dedupe
npm run clean
npm run build

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}

- name: Build Docker image
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0
with:
file: ./scripts/ci/docker/zombienet_injected.Dockerfile
context: .
push: true
tags: |
${{ env.IMAGE_NAME }}:${{ env.VERSION }}
${{ env.IMAGE_NAME }}:latest

# example job
# zombienet-smoke:
# name: Zombienet Smoke Tests
# runs-on: zombienet-polkadot-integration-test
# timeout-minutes: 30
# container:
# image: ${{ env.IMAGE_NAME }}:${{ env.VERSION }}
# needs: [build_push_image]
# env:
# LOCAL_DIR: "/builds/parity/mirrors/zombienet/tests"
# FF_DISABLE_UMASK_FOR_DOCKER_EXECUTOR: 1
# steps:
# - name: Check out the repo
# uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v.4.2.0

# - name: smoke test
# run: |
# echo "Zombienet Tests Config"
# echo "${ZOMBIENET_IMAGE}"
# echo "${GH_DIR}"
# echo "${LOCAL_DIR}"
# export DEBUG=zombie
# export ZOMBIENET_INTEGRATION_TEST_IMAGE="docker.io/paritypr/polkadot-debug:master"
# export COL_IMAGE="docker.io/paritypr/colander:master"
# TODO: add script to get latest from dockerhub
# export CUMULUS_TEST_IMAGE="docker.io/paritypr/test-parachain:c90f9713b5bc73a9620b2e72b226b4d11e018190"
# echo "relay_image ${ZOMBIENET_INTEGRATION_TEST_IMAGE}"
# echo "col_image ${COL_IMAGE}"

# /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh --local-dir="${LOCAL_DIR}" --test="0001-smoke.zndsl"
31 changes: 9 additions & 22 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ stages:
- publish
- zombienet


variables:
CI_IMAGE: "node:18"
DOCKERFILE: scripts/ci/docker/zombienet_injected.Dockerfile
Expand All @@ -31,13 +30,13 @@ variables:
cache:
- key:
files:
- javascript/package-lock.json
- javascript/package-lock.json
- paths:
- javascript/packages/cli/dist
- javascript/packages/orchestrator/dist
- javascript/packages/utils/dist
- javascript/package.json
- javascript/package-lock.json
- javascript/packages/cli/dist
- javascript/packages/orchestrator/dist
- javascript/packages/utils/dist
- javascript/package.json
- javascript/package-lock.json

.kubernetes-env: &kubernetes-env
image: $CI_IMAGE
Expand All @@ -51,9 +50,9 @@ cache:
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
- changes:
- javascript/**/*
- tests/**/*
- crates/**/*
- javascript/**/*
- tests/**/*
- crates/**/*

# run jobs always
.common-refs: &common-refs
Expand All @@ -72,16 +71,6 @@ cache:
- if: $CI_COMMIT_REF_NAME == "main"
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1

test:
stage: test
<<: *kubernetes-env
<<: *common-refs
script:
- cd javascript
- npm install
# - npm run test
- echo testme

build:
stage: build
<<: *kubernetes-env
Expand Down Expand Up @@ -174,7 +163,6 @@ publish-docker-image-description:
script:
- cd / && sh entrypoint.sh


.zombienet-common:
before_script:
- echo "Zombienet Tests Config"
Expand Down Expand Up @@ -287,4 +275,3 @@ chaos-delay:
- /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh
--local-dir="${LOCAL_DIR}"
--test="0001-delay.zndsl"

2 changes: 1 addition & 1 deletion javascript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"package:macos:arm64": "npm run -w packages/cli package:macos:arm64",
"zombie": "node ./packages/cli/dist/cli.js",
"test": "npm run test --workspaces --if-present",
"postinstall": "if [[ -f .husky/post-install.js ]]; then cd .. && node javascript/.husky/post-install.js; fi"
"postinstall": "bash -c 'if [[ -f .husky/post-install.js ]]; then cd .. && node javascript/.husky/post-install.js; fi'"
},
"engines": {
"node": ">=18"
Expand Down
8 changes: 5 additions & 3 deletions scripts/ci/docker/zombienet_injected.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM docker.io/library/node:18-bullseye-slim
FROM docker.io/library/node:20-bullseye-slim

LABEL io.parity.image.authors="[email protected]" \
io.parity.image.vendor="Parity Technologies" \
Expand Down Expand Up @@ -46,6 +46,8 @@ COPY javascript/package-lock.json ./
RUN npm install --production
RUN chown -R nonroot. /home/nonroot

# RUN ls -la /home/nonroot/zombie-net/packages/cli/dist

# Change `cli` permissions and link to easy call
RUN chmod +x /home/nonroot/zombie-net/packages/cli/dist/cli.js
RUN ln -s /home/nonroot/zombie-net/packages/cli/dist/cli.js /usr/local/bin/zombie
Expand All @@ -60,11 +62,11 @@ RUN chown -R nonroot. /etc/zombie-net
USER nonroot

# install rust
ENV RUST_VERSION=1.75.0
ENV RUST_VERSION=1.80.0
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain $RUST_VERSION -y
ENV PATH $PATH:/home/nonroot/.cargo/bin
# install nextest
RUN cargo install cargo-nextest --locked
RUN cargo install cargo-nextest --locked

# Tini allows us to avoid several Docker edge cases, see https://github.com/krallin/tini.
ENTRYPOINT ["tini", "--", "bash"]
Expand Down
Loading