ci: parallelize Linux tests and skip HAR packaging on PRs (#2678)

This commit is contained in:
KKRainbow authored and GitHub committed 2026-10-12 09:09:52 +08:00
1 parent f8a45ccc20
commit 1649ec0013
9 files changed
+1032 -555

No files matched your search

+38 -15
View File
@@ -80,29 +80,62 @@ jobs:
uses: ErBWs/setup-ohos@v1
- name: Install ohrs
if: github.event_name != 'pull_request'
uses: taiki-e/install-action@v2
with:
tool: ohrs
- name: Build HAR
id: package
env:
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
- name: Prepare OHOS tools
run: |
set -euo pipefail
sudo apt-get install -qqy \
pkg-config curl libgl1-mesa-dev expect llvm clang lldb lld
rustup component add rustfmt
sudo mkdir -p "$OHOS_NDK_HOME/native/llvm"
sudo tee "$OHOS_NDK_HOME/native/llvm/aarch64-unknown-linux-ohos-clang.sh" >/dev/null <<'EOF'
#!/bin/sh
exec "$OHOS_NDK_HOME/native/llvm/bin/clang" \
-target aarch64-linux-ohos \
--sysroot="$OHOS_NDK_HOME/native/sysroot" \
-D__MUSL__ "$@"
EOF
sudo chmod +x \
"$OHOS_NDK_HOME/native/llvm/aarch64-unknown-linux-ohos-clang.sh"
- name: Check formatting
run: |
cargo fmt --all --manifest-path \
easytier-contrib/easytier-ohrs/Cargo.toml -- --check
- name: Test OHOS bridge
run: |
cargo test --locked --manifest-path \
easytier-contrib/easytier-ohrs/Cargo.toml \
-p easytier-ohos-core -p easytier-ohos-features \
--lib -- --test-threads=1
- name: Check OHOS bindings
run: |
cargo check --locked --manifest-path \
easytier-contrib/easytier-ohrs/Cargo.toml \
-p easytier-ohrs --tests
- name: Check OHOS target
if: github.event_name == 'pull_request'
working-directory: easytier-contrib/easytier-ohrs
run: |
source env.sh
cargo check --locked -p easytier-ohrs --tests \
--target aarch64-unknown-linux-ohos
- name: Build HAR
if: github.event_name != 'pull_request'
id: package
env:
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
run: |
set -euo pipefail
cargo_version=$(cargo metadata --format-version 1 --no-deps \
--manifest-path easytier/Cargo.toml | jq -r '.packages[0].version')
last_tag=$(git describe --tags --abbrev=0 HEAD 2>/dev/null || true)
@@ -149,17 +182,6 @@ jobs:
echo
} > "$package_dir/CHANGELOG.md"
sudo mkdir -p "$OHOS_NDK_HOME/native/llvm"
sudo tee "$OHOS_NDK_HOME/native/llvm/aarch64-unknown-linux-ohos-clang.sh" >/dev/null <<'EOF'
#!/bin/sh
exec "$OHOS_NDK_HOME/native/llvm/bin/clang" \
-target aarch64-linux-ohos \
--sysroot="$OHOS_NDK_HOME/native/sysroot" \
-D__MUSL__ "$@"
EOF
sudo chmod +x \
"$OHOS_NDK_HOME/native/llvm/aarch64-unknown-linux-ohos-clang.sh"
cd easytier-contrib/easytier-ohrs
source env.sh
ohrs build --release --arch aarch
@@ -167,6 +189,7 @@ jobs:
mv package.har "$package_name.har"
- name: Upload HAR
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v5
with:
name: ${{ steps.package.outputs.name }}
+5 -16
View File
@@ -43,6 +43,7 @@ jobs:
env:
RELEVANT_PATHS: >-
["Cargo.toml", "Cargo.lock", "rust-toolchain.toml", ".cargo/**",
".config/nextest.toml",
"pnpm-lock.yaml", "pnpm-workspace.yaml", "package.json", "easytier/**",
"easytier-core/**", "easytier-proto/**", "easytier-rpc-build/**",
"easytier-web/**", "easytier-gui/src-tauri/**",
@@ -166,23 +167,11 @@ jobs:
path: tests.tar.zst
retention-days: 1
test_matrix:
name: Test (${{ matrix.name }})
run-tests:
name: Run tests
runs-on: ubuntu-latest
needs: [ pre_job, pre-test ]
if: needs.pre_job.outputs.should_skip != 'true'
strategy:
fail-fast: false
matrix:
include:
- name: "easytier"
opts: "-E 'not test(tests::three_node)' --test-threads 1 --no-fail-fast"
- name: "three_node"
opts: "-E 'test(tests::three_node) and not test(subnet_proxy_three_node_test)' --test-threads 1 --no-fail-fast"
- name: "three_node::subnet_proxy_three_node_test"
opts: "-E 'test(subnet_proxy_three_node_test)' --test-threads 1 --no-fail-fast"
steps:
- uses: actions/checkout@v5
@@ -217,11 +206,11 @@ jobs:
run: |
sudo prlimit --pid $$ --nofile=1048576:1048576
sudo -E env "PATH=$PATH" EASYTIER_LINUX_BPF_INTEGRATION=required \
cargo nextest run --archive-file tests.tar.zst ${{ matrix.opts }}
cargo nextest run --archive-file tests.tar.zst --profile ci --no-fail-fast
test:
runs-on: ubuntu-latest
needs: [ pre_job, ci-scripts, check, pre-test, test_matrix ]
needs: [ pre_job, ci-scripts, check, pre-test, run-tests ]
if: ${{ always() }}
steps:
- name: Mark result as failed