RSDK-851 rpc js tests #1006
Workflow file for this run
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: Build and Test | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ main ] | |
pull_request_target: | |
branches: [ main ] | |
types: [ labeled ] | |
jobs: | |
test_passing: | |
name: All Tests Passing | |
needs: [build_and_test] | |
runs-on: ubuntu-latest | |
if: always() | |
steps: | |
- name: Check Results | |
run: | | |
echo Main Tests: ${{ needs.build_and_test.result }} | |
[ "${{ needs.build_and_test.result }}" == "success" ] | |
build_and_test: | |
name: Build and Test | |
runs-on: [x64, qemu-host] | |
container: | |
image: ghcr.io/viamrobotics/canon:amd64-cache | |
options: --platform linux/amd64 | |
timeout-minutes: 20 | |
if: | | |
github.event_name == 'workflow_dispatch' || github.event_name == 'push' || | |
(github.event_name == 'pull_request_target' && github.event.label.name == 'safe to test' && contains(github.event.pull_request.labels.*.name, 'safe to test')) | |
steps: | |
- name: Check out main branch code | |
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push' | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Check out PR branch code | |
if: github.event_name == 'pull_request_target' | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 2 | |
- name: Set main env vars | |
if: github.event_name != 'pull_request_target' | |
run: | | |
echo "GITHUB_X_HEAD_SHA=${GITHUB_SHA}" >> $GITHUB_ENV | |
echo "GITHUB_X_HEAD_REF=${GITHUB_REF_NAME}" >> $GITHUB_ENV | |
- name: Set PR env vars | |
if: github.event_name == 'pull_request_target' | |
env: | |
GITHUB_HEAD_REF_SAN: ${{ github.event.pull_request.head.label }} | |
run: | | |
echo "GITHUB_X_HEAD_SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV | |
echo "GITHUB_X_HEAD_REF=${GITHUB_HEAD_REF_SAN}" >> $GITHUB_ENV | |
echo "GITHUB_X_PR_BASE_SHA=${{ github.event.pull_request.base.sha }}" >> $GITHUB_ENV | |
echo "GITHUB_X_PR_BASE_REF=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV | |
- name: Verify no uncommitted changes from "make build lint" | |
run: | | |
git init | |
git add . | |
chown -R testbot . | |
sudo -u testbot bash -lc 'make build lint' | |
GEN_DIFF=$(git status -s) | |
if [ -n "$GEN_DIFF" ]; then | |
echo '"make build lint" resulted in changes not in git' 1>&2 | |
git status | |
exit 1 | |
fi | |
- name: Test web client | |
run: sudo -u testbot bash -lc 'make test-web' | |
# | |
# - name: Test | |
# env: | |
# TEST_MONGODB_URI: ${{ secrets.TEST_MONGODB_URI }} | |
# MONGODB_TEST_OUTPUT_URI: ${{ secrets.MONGODB_TEST_OUTPUT_URI }} | |
# run: | | |
# sudo -u testbot bash -lc 'echo "${{ secrets.ARTIFACT_GOOGLE_APPLICATION_CREDENTIALS }}" | base64 -d > artifact_google_creds.json' | |
# export ARTIFACT_GOOGLE_APPLICATION_CREDENTIALS=`pwd`/artifact_google_creds.json | |
# sudo -u testbot --preserve-env=ARTIFACT_GOOGLE_APPLICATION_CREDENTIALS,TEST_MONGODB_URI,MONGODB_TEST_OUTPUT_URI,GITHUB_SHA,GITHUB_RUN_ID,GITHUB_RUN_NUMBER,GITHUB_RUN_ATTEMPT,GITHUB_X_PR_BASE_SHA,GITHUB_X_PR_BASE_REF,GITHUB_X_HEAD_REF,GITHUB_X_HEAD_SHA,GITHUB_REPOSITORY bash -lc 'make cover' | |
# | |
# # this one runs as root for CAP_SETUID | |
# - name: test run-as-user | |
# env: | |
# TEST_SUBPROC_USER: testbot | |
# run: go test -v ./pexec -run TestManagedProcessStart | |
# | |
# - name: Add Coverage PR Comment | |
# uses: marocchino/[email protected] | |
# if: github.event_name == 'pull_request' | |
# with: | |
# recreate: true | |
# path: code-coverage-results.md | |
# GITHUB_TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }} |