-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from hello-ag/feature/PR_test_github_action
Add files to checkout new PR and run unit tests
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
cd repos | ||
git clone $3 stretch_body_PR_testing | ||
cd stretch_body_PR_testing | ||
git fetch origin pull/$1/head:$2 | ||
git checkout $2 | ||
cd body | ||
declare -a TestFiles=("test_arm" "test_dxl_comms" "test_end_of_arm" "test_hello_utils" "test_robot_params" "test_timing_stats" "test_base" "test_dynamixel_hello_XL430" "test_end_of_arm_tools" "test_lift" "test_robot" "test_timing_stats" "test_arm" "test_device" "test_dynamixel_XL430" "test_hello_utils" "test_pimu" "test_steppers" ) | ||
declare -a TestFiles2=("test_hello_utils") | ||
declare -a TestFiles3=("test_robot_params") | ||
# Iterate the string array using for loop | ||
for fileName in ${TestFiles2[@]}; do | ||
python -m unittest test.$fileName | ||
done | ||
cd ../.. | ||
rm -rf stretch_body_PR_testing | ||
exit | ||
~^Z |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Checkout new PR | ||
on: | ||
pull_request_target: | ||
jobs: | ||
Checkout_PR_and_run_tests: | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Repository checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: save the ssh key for access to robot to the file | ||
run: 'echo "$SSH_KEY" > the_key' | ||
shell: bash | ||
env: | ||
SSH_KEY: ${{ secrets.STRETCH_SSH_KEY_GITHUB_ACTION }} | ||
- run: chmod 400 the_key | ||
|
||
- name: Print out PR reference values | ||
run: | | ||
echo github.base_ref: ${{ github.base_ref }} | ||
echo github.head_ref: ${{ github.head_ref }} | ||
echo github.ref: ${{ github.ref }} | ||
- name: Replace PR number, Branch name and Cloning URL | ||
run: sed -e "s/\$1/${PR_NUMBER}/g" -e "s|\$2|${BRANCH_NAME}|g" -e "s|\$3|${CLONE_URL}|g" .github/workflows/pr_checkout_commands.sh > ssh_commands_pr_info.sh; cat ssh_commands_pr_info.sh | ||
env: | ||
PR_NUMBER: ${{ github.event.number }} | ||
BRANCH_NAME: ${{ github.head_ref }} | ||
CLONE_URL: ${{ github.event.repository.clone_url }} | ||
|
||
- name: Log into stretch using ssh and run tests | ||
run: ssh -i the_key hello-robot@"${STRETCH_IP}" -p "$STRETCH_PORT" -tt -o StrictHostKeyChecking=no < ./ssh_commands_pr_info.sh | ||
env: | ||
STRETCH_IP: 72.134.86.243 | ||
STRETCH_PORT: 43771 |