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

ci(PR): manage validator checks in PR.yml #3767

Merged
merged 17 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/actions/message/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ outputs:
description: If enable native Windows build.
macos:
description: If enable macOS build.
validator:
description: If enable validator checks.
release:
description: If enable release build.

Expand Down
4 changes: 4 additions & 0 deletions .github/actions/message/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const WINDOWS_NATIVE = "E1-forcenatwin";
const MACOS = "E2-forcemacos";
const RELEASE = "E3-forcerelease";
const SKIP_CI = "[skip-ci]";
const VALIDATOR_LABEL = "check-validator";
const [owner, repo] = ["gear-tech", "gear"];

/**
Expand Down Expand Up @@ -75,6 +76,7 @@ async function main() {
const build =
!skipCI &&
(isDepbot || BUILD_LABELS.some((label) => labels.includes(label)));
const validator = !skipCI && labels.includes(VALIDATOR_LABEL);
const win_native = !skipCI && labels.includes(WINDOWS_NATIVE);
const macos = !skipCI && labels.includes(MACOS);
const release = !skipCI && labels.includes(RELEASE);
Expand All @@ -85,12 +87,14 @@ async function main() {
core.setOutput("win-native", win_native);
core.setOutput("macos", macos);
core.setOutput("release", release);
core.setOutput("validator", !skipCI);

console.log("---");
console.log("build: ", build);
console.log("check: ", !skipCI);
console.log("native windows: ", win_native);
console.log("macos: ", macos);
console.log("validator: ", validator);
console.log("release: ", release);

// Mock checks if skipping CI.
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
check: ${{ steps.config.outputs.check }}
win-native: ${{ steps.config.outputs.win-native }}
macos: ${{ steps.config.outputs.macos }}
validator: ${{ steps.config.outputs.validator }}
release: ${{ steps.config.outputs.release }}
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -68,3 +69,13 @@ jobs:
macos: ${{ needs.status.outputs.macos == 'true' }}
win-native: ${{ needs.status.outputs.win-native == 'true' }}
release: ${{ needs.status.outputs.release == 'true' }}

validator:
needs: status
if: ${{ needs.status.outputs.validator == 'true' }}
uses: ./.github/workflows/validation.yml
secrets:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VARA_VALIDATOR_8: ${{ secrets.VARA_VALIDATOR_8 }}
SSH_VARA_USERNAME: ${{ secrets.SSH_VARA_USERNAME }}
VARA_SSH_PRIVATE_KEY: ${{ secrets.VARA_SSH_PRIVATE_KEY }}
clearloop marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 3 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ jobs:
env:
RUSTUP_HOME: /tmp/rustup_home
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/docs
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
18 changes: 11 additions & 7 deletions .github/workflows/validation.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
name: Live check on Vara Network Validator machine

on:
pull_request:
types: [synchronize, labeled, opened, reopened, ready_for_review]
branches: [master]
workflow_dispatch:
workflow_call:
secrets:
GITHUB_TOKEN:
required: true
VARA_VALIDATOR_8:
required: true
SSH_VARA_USERNAME:
required: true
VARA_SSH_PRIVATE_KEY:
required: true

env:
CARGO_TERM_COLOR: always

jobs:
tag-image:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'check-validator')
outputs:
image_tag: ${{ steps.image-tag.outputs.tag }}
steps:
Expand All @@ -25,10 +31,8 @@ jobs:

build-update-validator:
runs-on: [kuberunner]
if: contains(github.event.pull_request.labels.*.name, 'check-validator')
needs: tag-image
steps:

- name: Checkout repo
uses: actions/checkout@v4

Expand Down Expand Up @@ -56,7 +60,7 @@ jobs:

- name: SSH into VM
uses: appleboy/ssh-action@v1.0.3
env:
env:
NEW_IMAGE: ${{ needs.tag-image.outputs.image_tag }}
with:
host: ${{ secrets.VARA_VALIDATOR_8 }}
Expand Down