Test #3465
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: Test | |
on: | |
workflow_dispatch: | |
workflow_call: | |
secrets: | |
MONGODB_TEST_OUTPUT_URI: | |
required: true | |
DOCKER_PUBLIC_READONLY_PAT: | |
required: true | |
env: | |
MONGODB_TEST_OUTPUT_URI: ${{ secrets.MONGODB_TEST_OUTPUT_URI }} | |
jobs: | |
build_and_test: | |
name: Build and Test | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- arch: [buildjet-8vcpu-ubuntu-2204] | |
image: ghcr.io/viamrobotics/rdk-devenv:amd64-go121 | |
platform: linux/amd64 | |
platform_name: linux-amd64 | |
test_cmd: "make cover test-web" | |
- arch: [buildjet-8vcpu-ubuntu-2204-arm] | |
image: ghcr.io/viamrobotics/rdk-devenv:arm64-go121 | |
platform: linux/arm64 | |
platform_name: linux-arm64 | |
test_cmd: "make cover test-web" | |
runs-on: ${{ matrix.arch }} | |
container: | |
image: ${{ matrix.image }} | |
options: --platform ${{ matrix.platform }} | |
timeout-minutes: 30 | |
steps: | |
- name: Check out code | |
if: github.event_name != 'pull_request_target' | |
uses: actions/checkout@v3 | |
- 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: 0 # 0 so we can analyze history for coverage | |
- 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: just chown | |
run: chown -R testbot:testbot . | |
# - name: Verify no uncommitted changes from "make build lint" | |
# run: | | |
# git init | |
# git add . | |
# chown -R testbot:testbot . | |
# sudo -Hu 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 | |
run: | | |
sudo --preserve-env=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 -Hu testbot bash -lc '${{ matrix.test_cmd }}' | |
- name: Upload test.json | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-${{ matrix.platform_name }}.json | |
path: json.log | |
retention-days: 30 | |
# Now that RDK is public, can't directly comment without token having full read/write access | |
# code-coverage-comment.yml will trigger seperately and post the actual comments | |
- name: Prepare code comment | |
run: | | |
echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> pr.env | |
- name: Mark appimage label | |
if: contains(github.event.pull_request.labels.*.name, 'appimage') || contains(github.event.pull_request.labels.*.name, 'appimage-ignore-tests') | |
run: | | |
echo "APPIMAGE=true" >> pr.env | |
- name: Mark static label | |
if: contains(github.event.pull_request.labels.*.name, 'static-build') || contains(github.event.pull_request.labels.*.name, 'static-ignore-tests') | |
run: | | |
echo "STATIC=true" >> pr.env | |
- name: Upload code coverage | |
uses: actions/upload-artifact@v3 | |
with: | |
name: pr-code-coverage | |
path: | | |
pr.env | |
code-coverage-results.md | |
retention-days: 1 | |
test32: | |
if: false | |
name: 32-bit test | |
runs-on: buildjet-8vcpu-ubuntu-2204-arm | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.ref }} | |
fetch-depth: ${{ github.event_name == 'pull_request_target' && '0' || '1' }} # 0 aka full history, so we can analyze history for coverage | |
- uses: docker/login-action@v2 | |
with: | |
username: viambuild | |
password: ${{ secrets.DOCKER_PUBLIC_READONLY_PAT }} | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v3 | |
- name: Test | |
run: | | |
docker run \ | |
--platform linux/arm/v7 \ | |
-v `pwd`:/rdk \ | |
ghcr.io/viamrobotics/rdk-devenv:armhf-cache \ | |
sudo -Hu testbot bash -lc 'cd /rdk && go test -v -tags=no_tflite ./...' | |
test_pi: | |
if: false | |
name: Test Raspberry Pi Code | |
runs-on: pi4 | |
timeout-minutes: 5 | |
steps: | |
- name: Clean Workspace | |
run: | | |
shopt -s dotglob | |
sudo chown -R `whoami` ./ | |
rm -rf ./* | |
- name: Check out main branch code | |
if: github.event_name != 'pull_request_target' | |
uses: actions/checkout@v3 | |
- 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 }} | |
- name: Test | |
run: make test-pi | |
test_e2e: | |
if: false | |
name: Test End-to-End | |
runs-on: [buildjet-8vcpu-ubuntu-2204] | |
container: ghcr.io/viamrobotics/rdk-devenv:amd64-cache | |
steps: | |
- name: Check out main branch code | |
if: github.event_name != 'pull_request_target' | |
uses: actions/checkout@v3 | |
- 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 }} | |
- name: Install dependencies | |
run: | | |
apt-get -qy install libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb netcat-openbsd lsof | |
- name: Run e2e Tests | |
run: | | |
chown -R testbot:testbot . | |
sudo -Hu testbot bash -lc 'make build-web test-e2e E2E_ARGS="-k"' | |
test_passing: | |
name: All Tests Passing | |
needs: [test_pi, build_and_test, test_e2e, test32] | |
runs-on: [ubuntu-latest] | |
if: always() | |
steps: | |
- name: Check Results | |
run: | | |
echo Pi Tests: ${{ needs.test_pi.result }} | |
echo Main Tests: ${{ needs.build_and_test.result }} | |
echo E2E Tests: ${{ needs.test_e2e.result }} | |
echo 32-bit Tests: ${{ needs.test32.result }} | |
[ "${{ needs.test_pi.result }}" == "success" ] && \ | |
[ "${{ needs.build_and_test.result }}" == "success" ] && \ | |
[ "${{ needs.test_e2e.result }}" == "success" ] && \ | |
[ "${{ needs.test32.result }}" == "success" ] |