Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
53 changes: 53 additions & 0 deletions .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: "unit-tests"

on:
pull_request:
push:
schedule:
# Run daily at 00:15 UTC (the 15 is to avoid periods of high load)
- cron: "15 0 * * *"
workflow_dispatch:

permissions: {}

concurrency:
group: "${{github.workflow}}-${{github.ref}}"

# Cancel in-progress jobs for efficiency
cancel-in-progress: true

jobs:
lint:
Comment thread
sitaowang1998 marked this conversation as resolved.
Resolved
strategy:
matrix:
os: ["ubuntu-latest"]
runs-on: "${{matrix.os}}"
Comment thread
kirkrodrigues marked this conversation as resolved.
Resolved
steps:
- uses: "actions/checkout@v4"
with:
submodules: "recursive"

- uses: "actions/setup-python@v5"
with:
python-version: "3.10"

- name: "Install task"
run: "npm install -g @go-task/cli"

- if: "matrix.os == 'macos-latest'"
name: "Install coreutils (for md5sum)"
run: "brew install coreutils"

@coderabbitai coderabbitai Bot Dec 1, 2024 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove or enable macOS-specific step.

There's a macOS-specific step for installing coreutils, but macOS isn't included in the OS matrix. Either remove this step or add macOS to the matrix as suggested above.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rabbit is correct.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kirkrodrigues, glad I could help!

- name: "Log tool versions"
run: |-
md5sum --version
python --version
tar --version
task --version

- name: "Install project dependencies "
timeout-minutes: 10
continue-on-error: false
Comment thread
kirkrodrigues marked this conversation as resolved.
Resolved
run: "task deps:lib_install"

- run: "task test:unit-test"
26 changes: 26 additions & 0 deletions build-tasks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: "3"

tasks:
target:
internal: true
vars:
TARGET: "{{default \"all\" .TARGET}}"
requires:
vars:
- name: "TARGET"
enum:
- "all"
- "spider_client"
- "spider_worker"
- "spider_task_executor"
- "unitTest"
- "worker_test"
Comment thread
kirkrodrigues marked this conversation as resolved.
Resolved
deps: ["::config-cmake-project"]
Comment thread
kirkrodrigues marked this conversation as resolved.
Resolved
cmds:
- "cmake --build {{.G_BUILD_SPIDER_DIR}} --target {{.TARGET}} --parallel"
Comment thread
kirkrodrigues marked this conversation as resolved.
Resolved

clean:
internal: true
deps: ["::config-cmake-project"]
Comment thread
sitaowang1998 marked this conversation as resolved.
Resolved
cmds:
- "cmake --build {{.G_BUILD_SPIDER_DIR}} --target clean --parallel"
Comment thread
kirkrodrigues marked this conversation as resolved.
Resolved
2 changes: 2 additions & 0 deletions lint-tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ tasks:
.github/ \
lint-tasks.yaml \
dep-tasks.yaml \
test-tasks.yaml \
build-tasks.yaml \
taskfile.yaml
Comment thread
kirkrodrigues marked this conversation as resolved.
Resolved

clang-format:
Expand Down
1 change: 1 addition & 0 deletions taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ version: "3"
includes:
lint: "lint-tasks.yaml"
deps: "dep-tasks.yaml"
test: "test-tasks.yaml"
utils: "tools/yscope-dev-utils/taskfiles/utils.yml"

vars:
Expand Down
20 changes: 20 additions & 0 deletions test-tasks.yaml
Comment thread
kirkrodrigues marked this conversation as resolved.
Resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: "3"

includes:
build: "build-tasks.yaml"
Comment thread
kirkrodrigues marked this conversation as resolved.
Resolved

vars:
G_TEST_BINARY: "{{.G_BUILD_SPIDER_DIR}}/tests/unitTest"

tasks:
unit-test:
Comment thread
kirkrodrigues marked this conversation as resolved.
Resolved
cmds:
# Add build in cmds to serialize the build
- task: "build:target"
vars: {TARGET: "unitTest"}
- task: "build:target"
vars: {TARGET: "spider_task_executor"}
- task: "build:target"
vars: {TARGET: "worker_test"}
Comment thread
kirkrodrigues marked this conversation as resolved.
Resolved
# Tests tagged with storage requires mysql. Skip them for now.
- "{{.G_TEST_BINARY}} \"~[storage]\""