From e89cb2c3fd289dfefa9e447f837e80acfbd9ade8 Mon Sep 17 00:00:00 2001 From: Brian Hsu Date: Wed, 29 May 2024 20:28:41 +0800 Subject: [PATCH] test enable AudioTest. --- .github/actions/run-unit-test/action.yaml | 30 +++++++++---------- .../actions/upload-testing-report/action.yaml | 16 ++++++++++ .github/workflows/unitTest.yaml | 21 ++++++++++++- 3 files changed, 51 insertions(+), 16 deletions(-) create mode 100644 .github/actions/upload-testing-report/action.yaml diff --git a/.github/actions/run-unit-test/action.yaml b/.github/actions/run-unit-test/action.yaml index 7c00af75..f15e2004 100644 --- a/.github/actions/run-unit-test/action.yaml +++ b/.github/actions/run-unit-test/action.yaml @@ -2,34 +2,34 @@ name: "Run Unit Test And Coverage Report" runs: using: "composite" steps: - - name: "Setup Git Information" + - name: "Prepare Building Environment" shell: bash run: | - git config --global user.email "brianhsu.hsu+githu@gmail.com" - git config --global user.name "GitHub Action" + apt-get -yq update + apt-get -yq install curl xorg-dev libglu1-mesa libgl1-mesa-dev xvfb libxinerama1 libxcursor1 libswt-gtk-4-java libswt-gtk-4-jni libxml2-utils bc zip apt-transport-https gnupg git locales-all + echo "deb https://deb.debian.org/debian unstable main non-free contrib" > /etc/apt/sources.list.d/openjdk.list + echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" > /etc/apt/sources.list.d/sbt.list + echo "deb https://repo.scala-sbt.org/scalasbt/debian /" > /etc/apt/sources.list.d/sbt_old.list + curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | apt-key add + apt-get -yq update + apt-get -yq install openjdk-11-jdk sbt - - name: "Prepare Building Environment" + - name: "Setup Git Information" shell: bash run: | - apt-get update -yqq - apt-get install apt-transport-https -yqq - echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | tee /etc/apt/sources.list.d/sbt.list - echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | tee /etc/apt/sources.list.d/sbt_old.list - curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | apt-key add - apt-get update - apt-get -y install sbt - apt-get -y install xorg-dev libglu1-mesa libgl1-mesa-dev xvfb libxinerama1 libxcursor1 libswt-gtk-4-java libswt-gtk-4-jni libxml2-utils bc zip + git config --global user.email "brianhsu.hsu+githu@gmail.com" + git config --global user.name "GitHub Action" - name: "Run Unit Test and Coverage Report" shell: bash run: | ./distclean - xvfb-run --auto-servernum sbt coverage test coverageAggregate + xvfb-run --auto-servernum sbt coverage test coverageAggregate -Duser.home=/tmp/pulse-home - - name: "Archive Test Reports" + - name: Archive Test Results + if: always() uses: actions/upload-artifact@v4 with: name: test-results path: target/test-reports-html/ - diff --git a/.github/actions/upload-testing-report/action.yaml b/.github/actions/upload-testing-report/action.yaml new file mode 100644 index 00000000..f5e600b7 --- /dev/null +++ b/.github/actions/upload-testing-report/action.yaml @@ -0,0 +1,16 @@ +name: "Upload Testing Report" +runs: + using: "composite" + steps: + - name: 'Archive Testing Report' + shell: bash + run: | + tar -cvzf test-report.tar.gz -C target/ test-reports-html/ + + - name: 'Upload Testing Report to GitHub Workflow' + uses: actions/upload-artifact@v4 + with: + name: test-report.tar.gz + path: test-report.tar.gz + + diff --git a/.github/workflows/unitTest.yaml b/.github/workflows/unitTest.yaml index 18d6e66c..b30d22d7 100644 --- a/.github/workflows/unitTest.yaml +++ b/.github/workflows/unitTest.yaml @@ -16,14 +16,33 @@ jobs: env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} EXCLUDE_TEST_TAG: moe.brianhsu.AudioOutputTest + LANG: en_US.utf-8 container: - image: openjdk:11 + image: debian:sid steps: - name: "Checkout Source Code" uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Show env + env: + TEST_ENV: abcd + run: | + echo $TEST_ENV + + - name: Install pulseaudio + run: | + apt-get -yq update + apt-get -yq install pulseaudio + + - name: Start pulseaudio + run: | + pulseaudio & + - name: List sound card + run: | + pactl list + - name: Unit test uses: ./.github/actions/run-unit-test