Integrate Zenoh uTransport into Rust TA #86
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: TCK Tests | |
on: | |
push: | |
branches: [ "main"] | |
pull_request: | |
branches: [ "main"] | |
permissions: | |
contents: read | |
jobs: | |
run_tests: | |
runs-on: ubuntu-20.04 | |
continue-on-error: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Build Rust Test Agent | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --manifest-path test_agent/rust/Cargo.toml | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
cache: maven | |
- name: Build up_client_socket_java with Maven | |
working-directory: up_client_socket/java | |
run: | | |
mvn clean install --file pom.xml | |
- name: Build java_test_agent with Maven | |
working-directory: test_agent/java | |
run: | | |
mvn clean install --file pom.xml | |
- name: Set up Python 3.8.7 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.8.7" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 pytest | |
pip install multimethod | |
cd scripts | |
python install_dependencies.py | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --exclude scripts/up-python --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 --ignore E203,E402,W503,W504,F811 . --exclude scripts/up-python --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Get Behave Scripts | |
uses: actions/github-script@v6 | |
id: check-env | |
with: | |
result-encoding: string | |
script: | | |
const feature_file_list = []; | |
const fs = require('fs'); | |
const path = require('path'); | |
const subProcess = require('child_process') | |
function traverseDir(dir) { | |
fs.readdirSync(dir).forEach(file => { | |
let fullPath = path.join(dir, file); | |
if (fs.lstatSync(fullPath).isDirectory()) { | |
traverseDir(fullPath); | |
} else { | |
core.info("Adding file: " + fullPath); | |
feature_file_list.push({ filename: file, path: fullPath.replace("test_manager/", "") }); | |
} | |
}); | |
} | |
traverseDir("./test_manager/features/tests"); | |
fs.writeFileSync('./test_manager/feature_file_list.json', JSON.stringify(feature_file_list)); | |
var feature_json = JSON.parse(fs.readFileSync('./test_manager/testData/workflow_test_data.json', 'utf8')); | |
for(var feature_file_name in feature_json){ | |
for (var language in feature_json[feature_file_name]["ues"]){ | |
for (var transport in feature_json[feature_file_name]["transports"]){ | |
var command_str = "behave --define uE1=" + language + "--define transport=" + transport + "--format json --outfile './reports/" + feature_file_name + "_" + language + ".json' --format html --outfile './reports/" + feature_file_name + "_" + language + ".html' 'features/tests/" + feature_json[feature_file_name]["path"] + feature_file_name + ".feature'" | |
subProcess.exec('ls', (err, stdout, stderr) => { | |
if (err) { | |
console.error(err) | |
process.exit(1) | |
} else { | |
console.log(`The stdout Buffer from shell: ${stdout.toString()}`) | |
console.log(`The stderr Buffer from shell: ${stderr.toString()}`) | |
} | |
}) | |
} | |
} | |
} | |
# - name: TCK Behave Tests | |
# run: | | |
# pwd | |
# ls -l | |
# cd test_manager | |
# # Read JSON file content | |
# content=$(<./feature_file_list.json) | |
# # Loop through each JSON object | |
# echo "$content" | jq -c '.[]' | while IFS='' read -r obj; do | |
# # Extract filename and full path from the current JSON object | |
# filename=$(echo "$obj" | jq -r '.filename') | |
# full_path=$(echo "$obj" | jq -r '.path') | |
# # Run behave command | |
# echo "Running Test: $filename" | |
# behave --define uE1=python --define transport=socket --format json --outfile "./reports/${filename}_python.json" --format html --outfile "./reports/${filename}_python.html" "$full_path" | |
# behave --define uE1=java --define transport=socket --format json --outfile "./reports/${filename}_java.json" --format html --outfile "./reports/${filename}_java.html" "$full_path" | |
# echo "Finished Test: $filename" | |
# done | |
# behave --define uE1=rust --define transport=zenoh --format json --outfile "./reports/register_and_send_zenoh.json" --format html --outfile "./reports/register_and_send_zenoh.html" "/up-tck/test_manager/features/tests/transport_rpc/register_and_send_zenoh.feature" | |
# behave --define uE1=rust --define transport=zenoh --format json --outfile "./reports/register_and_unregister_zenoh.json" --format html --outfile "./reports/register_and_unregister_zenoh.html" "/up-tck/test_manager/features/tests/transport_rpc/register_and_unregister_zenoh.feature" | |
- name: Get Behave Scripts | |
uses: actions/github-script@v6 | |
with: | |
result-encoding: string | |
script: | | |
const feature_file_list = [] | |
const fs = require('fs') | |
const path = require('path'); | |
function traverseDir(dir) { | |
fs.readdirSync(dir).forEach(file => { | |
let fullPath = path.join(dir, file); | |
if (fs.lstatSync(fullPath).isDirectory()) { | |
traverseDir(fullPath); | |
} else { | |
feature_file_list.push({ filename: file, path: fullPath }); | |
} | |
}); | |
} | |
traverseDir("./test_manager/reports"); | |
const json_list = [] | |
try { | |
for (let i = 0; i < feature_file_list.length; i++){ | |
file_extension = path.parse(feature_file_list[i]["filename"]).ext | |
file_name = path.parse(feature_file_list[i]["filename"]).name | |
if (file_extension == ".json" && file_name != "summary") { | |
json_list.push(JSON.parse(fs.readFileSync(feature_file_list[i]["path"]))); | |
} | |
} | |
for (let i = 0; i < json_list.length; i++) { | |
if (json_list[i][0].status != "passed") { | |
core.setFailed("One or more features failed") | |
core.error("\u001b[38;2;255;0;0mFeature:" + json_list[i][0].name + " [failed]") | |
} else{ | |
core.info("\u001b[38;2;0;255;0mFeature:" + json_list[i][0].name + " [passed]") | |
} | |
} | |
} catch(err) { | |
core.error("\u001b[38;2;255;0;0mError while reading or parsing the JSON") | |
core.setFailed(err) | |
} | |
- name: Upload Test Reports | |
uses: actions/upload-artifact@v4 | |
with: | |
name: behave-test-reports | |
path: ./test_manager/reports/*.html |