Skip to content

Commit

Permalink
feat(repo): run native tests on pr in taskdb dir (#433)
Browse files Browse the repository at this point in the history
* feat(repo): run native tests on pr in taskdb dir

* test

* include changes
  • Loading branch information
RogerLamTd authored Dec 17, 2024
1 parent bbe246b commit 9ed4ac2
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 2 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/ci-build-test-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
version_toolchain:
type: string
required: true
taskdb:
type: string
required: true

env:
CI: 1
Expand All @@ -21,7 +24,6 @@ jobs:
name: Build and test
runs-on: [taiko-runner]
timeout-minutes: 120

env:
TARGET: ${{ inputs.version_name }}
CI: 1
Expand All @@ -32,6 +34,11 @@ jobs:
with:
submodules: recursive

- name: taskdb check
if: ${{ inputs.taskdb != '' }}
run: |
echo "TASKDB=${{ inputs.taskdb }}" >> $GITHUB_ENV
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ inputs.version_toolchain }}
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/ci-integration-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
version_toolchain:
type: string
required: true
taskdb:
type: string
required: true


env:
CI: 1
Expand All @@ -31,6 +35,11 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: taskdb check
if: ${{ inputs.taskdb != '' }}
run: |
echo "TASKDB=${{ inputs.taskdb }}" >> $GITHUB_ENV
- uses: actions-rs/toolchain@v1
with:
Expand Down
32 changes: 31 additions & 1 deletion .github/workflows/ci-native.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,48 @@
name: CI - Native

on: workflow_call
on:
workflow_call:
pull_request:
paths:
- "taskdb/**"

jobs:
set-taskdb:
runs-on: ubuntu-latest
outputs:
taskdb: ${{ steps.check_file.outputs.taskdb }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Check if specific file changed
id: check_file
run: |
BASE_BRANCH=${{ github.event.pull_request.base.ref }}
if git diff --name-only origin/$BASE_BRANCH ${{ github.sha }} | grep -q "taskdb/src/redis_db.rs"; then
echo "redis changed"
echo "::set-output name=taskdb::raiko-tasks/redis-db"
else
echo "redis unchanged"
echo "::set-output name=taskdb::"
fi
build-test-native:
name: Build and test native
needs: set-taskdb
uses: ./.github/workflows/ci-build-test-reusable.yml
with:
version_name: "native"
version_toolchain: "nightly-2024-04-17"
taskdb: ${{ needs.set-taskdb.outputs.taskdb }}

integration-test-native:
name: Run integration tests on native
needs: set-taskdb
uses: ./.github/workflows/ci-integration-reusable.yml
with:
version_name: "native"
version_toolchain: "nightly-2024-04-17"
taskdb: ${{ needs.set-taskdb.outputs.taskdb }}

0 comments on commit 9ed4ac2

Please sign in to comment.