Skip to content

Commit

Permalink
Merge pull request #8245 from mozilla-mobile/5560-goodbye-auth-tests
Browse files Browse the repository at this point in the history
VPN-5560 - Do not run auth_tests on PRs
  • Loading branch information
brizental authored Oct 10, 2023
2 parents b0c16c8 + 7f449ee commit 3b70bfb
Show file tree
Hide file tree
Showing 3 changed files with 198 additions and 27 deletions.
129 changes: 129 additions & 0 deletions .github/workflows/auth_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
name: Auth Tests
on:
# Only run on push to main or release branches.
push:
branches:
- main
- "releases/**"

# Restrict tests to the most recent commit.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
linux-unit-tests:
runs-on: ubuntu-22.04
name: Run auth tests on Linux
steps:
- name: Clone repository
uses: actions/checkout@v3
with:
submodules: "recursive"

- name: Install dependences
run: |
sudo apt-get update
sudo apt-get install -y $(./scripts/linux/getdeps.py -a linux/debian/control)
pip3 install -r requirements.txt
- name: Building tests
shell: bash
run: |
mkdir -p build
cmake -S . -B $(pwd)/build \
-DCMAKE_CXX_FLAGS=--coverage -DCMAKE_EXE_LINKER_FLAGS=--coverage
cmake --build $(pwd)/build --target app_auth_tests -j$(nproc)
- name: Running tests
shell: bash
working-directory: ./build/tests/auth_tests
run: |
export PATH=${{github.workspace}}/grcov-build/bin:$PATH
ctest --output-on-failure
macos-unit-tests:
runs-on: macos-latest
name: Run auth tests on MacOS

steps:
- name: Clone repository
uses: actions/checkout@v3
with:
submodules: "recursive"

- name: Install dependencies
shell: bash
run: |
pip3 install -r requirements.txt
brew install ninja
- name: Install Qt6
shell: bash
run: |
wget https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/mozillavpn.v2.mozillavpn.cache.level-3.toolchains.v3.qt-mac.latest/artifacts/public%2Fbuild%2Fqt6_mac.zip -O mac.zip
unzip -a mac.zip
sudo mv qt_dist /opt
cd ..
- name: Install Grcov
if: steps.cache-grcov.outputs.cache-hit != 'true'
shell: bash
run: |
cargo install grcov --root ${{github.workspace}}/grcov-build --version 0.8.13
- name: Building tests
shell: bash
run: |
export PATH=/opt/qt_dist/bin:${{github.workspace}}/grcov-build/bin:$PATH
mkdir -p build
cmake -S . -B $(pwd)/build -GNinja \
-DCMAKE_CXX_FLAGS=--coverage -DCMAKE_EXE_LINKER_FLAGS=--coverage
cmake --build $(pwd)/build --target app_auth_tests
- name: Running tests
shell: bash
working-directory: ./build/tests/auth_tests
run: |
export PATH=/opt/qt_dist/bin:${{github.workspace}}/grcov-build/bin:$PATH
ctest --output-on-failure
windows-unit-tests:
name: Run auth tests on Windows
runs-on: windows-latest

steps:
- name: Clone repository
uses: actions/checkout@v3
with:
submodules: "recursive"

- name: Install Qt
shell: pwsh
run: |
Invoke-WebRequest -Uri https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/mozillavpn.v2.mozillavpn.cache.level-3.toolchains.v3.qt-win.latest/artifacts/public%2Fbuild%2Fqt6_win.zip -OutFile win.zip
Expand-Archive win.zip
mv win\QT_OUT "C:\\MozillaVPNBuild"
- name: Add msvc dev commands to PATH
uses: ilammy/msvc-dev-cmd@v1

- name: Add msbuild to PATH
uses: microsoft/[email protected]

- name: Install depedencies
shell: bash
run: |
pip3 install -r requirements.txt
- name: Building tests
run: |
mkdir ./build
cmake -S . -B ./build -GNinja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH="C:\MozillaVPNBuild\lib\cmake"
cmake --build ./build --target app_auth_tests
- name: Running tests
shell: bash
working-directory: ./build/tests/auth_tests
run: |
ctest --output-on-failure
92 changes: 66 additions & 26 deletions .github/workflows/test_unit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Clone repository
uses: actions/checkout@v3
with:
submodules: 'recursive'
submodules: "recursive"

- name: Install dependences
run: |
Expand Down Expand Up @@ -51,26 +51,38 @@ jobs:
-DCMAKE_CXX_FLAGS=--coverage -DCMAKE_EXE_LINKER_FLAGS=--coverage
cmake --build $(pwd)/build --target build_tests -j$(nproc)
- name: Running tests
- name: Running native messaging tests
shell: bash
working-directory: ./build
working-directory: ./build/tests/nativemessaging
run: |
export PATH=${{github.workspace}}/grcov-build/bin:$PATH
ctest --output-on-failure
grcov $(pwd)/tests/nativemessaging/CMakeFiles/nativemessaging_tests.dir -s ${{github.workspace}} \
grcov $(pwd)/CMakeFiles/nativemessaging_tests.dir -s ${{github.workspace}} \
-t lcov --branch --ignore-not-existing > ${{github.workspace}}/nativemessaging_lcov.info
grcov $(pwd)/tests/qml/CMakeFiles/qml_tests.dir -s ${{github.workspace}} \
- name: Running QML tests
shell: bash
working-directory: ./build/tests/qml
run: |
export PATH=${{github.workspace}}/grcov-build/bin:$PATH
ctest --output-on-failure
grcov $(pwd)/CMakeFiles/qml_tests.dir -s ${{github.workspace}} \
-t lcov --branch --ignore-not-existing > ${{github.workspace}}/qml_lcov.info
grcov $(pwd)/tests/unit/CMakeFiles/unit_tests.dir -s ${{github.workspace}} \
-t lcov --branch --ignore-not-existing > ${{github.workspace}}/unit_lcov.info
- name: Running unit tests
shell: bash
working-directory: ./build/tests
run: |
export PATH=${{github.workspace}}/grcov-build/bin:$PATH
ctest --test-dir unit --output-on-failure
ctest --test-dir unit_tests --output-on-failure
grcov $(pwd)/tests/auth_tests/CMakeFiles/app_auth_tests.dir -s ${{github.workspace}} \
-t lcov --branch --ignore-not-existing > ${{github.workspace}}/auth_lcov.info
grcov $(pwd)/unit/CMakeFiles/unit_tests.dir -s ${{github.workspace}} \
-t lcov --branch --ignore-not-existing > ${{github.workspace}}/unit_lcov.info
grcov $(pwd)/tests/unit_tests/CMakeFiles/app_unit_tests.dir -s ${{github.workspace}} \
grcov $(pwd)/unit_tests/CMakeFiles/app_unit_tests.dir -s ${{github.workspace}} \
-t lcov --branch --ignore-not-existing > ${{github.workspace}}/unitapp_lcov.info
- name: Upload coverage for linux unit tests to Codecov
Expand All @@ -79,7 +91,7 @@ jobs:
directory: .
flags: linux_unit_tests
name: codecov-poc
files: auth_lcov.info,nativemessaging_lcov.info,qml_lcov.info,unit_lcov.info,unitapp_lcov.info
files: nativemessaging_lcov.info,qml_lcov.info,unit_lcov.info,unitapp_lcov.info
verbose: true

macos-unit-tests:
Expand All @@ -90,7 +102,7 @@ jobs:
- name: Clone repository
uses: actions/checkout@v3
with:
submodules: 'recursive'
submodules: "recursive"

- name: Install dependencies
shell: bash
Expand Down Expand Up @@ -128,26 +140,38 @@ jobs:
-DCMAKE_CXX_FLAGS=--coverage -DCMAKE_EXE_LINKER_FLAGS=--coverage
cmake --build $(pwd)/build --target build_tests
- name: Running tests
- name: Running native messaging tests
shell: bash
working-directory: ./build
working-directory: ./build/tests/nativemessaging
run: |
export PATH=/opt/qt_dist/bin:${{github.workspace}}/grcov-build/bin:$PATH
export PATH=${{github.workspace}}/grcov-build/bin:$PATH
ctest --output-on-failure
grcov $(pwd)/tests/nativemessaging/CMakeFiles/nativemessaging_tests.dir -s ${{github.workspace}} \
grcov $(pwd)/CMakeFiles/nativemessaging_tests.dir -s ${{github.workspace}} \
-t lcov --branch --ignore-not-existing > ${{github.workspace}}/nativemessaging_lcov.info
grcov $(pwd)/tests/qml/CMakeFiles/qml_tests.dir -s ${{github.workspace}} \
- name: Running QML tests
shell: bash
working-directory: ./build/tests/qml
run: |
export PATH=${{github.workspace}}/grcov-build/bin:$PATH
ctest --output-on-failure
grcov $(pwd)/CMakeFiles/qml_tests.dir -s ${{github.workspace}} \
-t lcov --branch --ignore-not-existing > ${{github.workspace}}/qml_lcov.info
grcov $(pwd)/tests/unit/CMakeFiles/unit_tests.dir -s ${{github.workspace}} \
-t lcov --branch --ignore-not-existing > ${{github.workspace}}/unit_lcov.info
- name: Running unit tests
shell: bash
working-directory: ./build/tests
run: |
export PATH=${{github.workspace}}/grcov-build/bin:$PATH
ctest --test-dir unit --output-on-failure
ctest --test-dir unit_tests --output-on-failure
grcov $(pwd)/tests/auth_tests/CMakeFiles/app_auth_tests.dir -s ${{github.workspace}} \
-t lcov --branch --ignore-not-existing > ${{github.workspace}}/auth_lcov.info
grcov $(pwd)/unit/CMakeFiles/unit_tests.dir -s ${{github.workspace}} \
-t lcov --branch --ignore-not-existing > ${{github.workspace}}/unit_lcov.info
grcov $(pwd)/tests/unit_tests/CMakeFiles/app_unit_tests.dir -s ${{github.workspace}} \
grcov $(pwd)/unit_tests/CMakeFiles/app_unit_tests.dir -s ${{github.workspace}} \
-t lcov --branch --ignore-not-existing > ${{github.workspace}}/unitapp_lcov.info
- name: Upload coverage for macos unit tests to Codecov
Expand All @@ -167,15 +191,15 @@ jobs:
- name: Clone repository
uses: actions/checkout@v3
with:
submodules: 'recursive'
submodules: "recursive"

- name: Install Qt
shell: pwsh
run: |
Invoke-WebRequest -Uri https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/mozillavpn.v2.mozillavpn.cache.level-3.toolchains.v3.qt-win.latest/artifacts/public%2Fbuild%2Fqt6_win.zip -OutFile win.zip
Expand-Archive win.zip
mv win\QT_OUT "C:\\MozillaVPNBuild"
- name: Add msvc dev commands to PATH
uses: ilammy/msvc-dev-cmd@v1

Expand All @@ -193,8 +217,24 @@ jobs:
cmake -S . -B ./build -GNinja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH="C:\MozillaVPNBuild\lib\cmake"
cmake --build ./build --target build_tests
- name: Running tests
- name: Running native messaging tests
shell: bash
working-directory: ./build
working-directory: ./build/tests/nativemessaging
run: |
export PATH=${{github.workspace}}/grcov-build/bin:$PATH
ctest --output-on-failure
- name: Running QML tests
shell: bash
working-directory: ./build/tests/qml
run: |
export PATH=${{github.workspace}}/grcov-build/bin:$PATH
ctest --output-on-failure
- name: Running unit tests
shell: bash
working-directory: ./build/tests
run: |
export PATH=${{github.workspace}}/grcov-build/bin:$PATH
ctest --test-dir unit --output-on-failure
ctest --test-dir unit_tests --output-on-failure
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,11 @@ if(NOT CMAKE_CROSSCOMPILING)
add_subdirectory(tests/nativemessaging EXCLUDE_FROM_ALL)
add_subdirectory(tests/unit EXCLUDE_FROM_ALL)
add_subdirectory(tests/qml EXCLUDE_FROM_ALL)
add_subdirectory(tests/auth_tests EXCLUDE_FROM_ALL)
add_subdirectory(tests/unit_tests EXCLUDE_FROM_ALL)

# E2E Tests
add_subdirectory(tests/auth_tests EXCLUDE_FROM_ALL)

# Dummy Testing Client
add_subdirectory(tests/dummyvpn EXCLUDE_FROM_ALL)
endif()
Expand Down

0 comments on commit 3b70bfb

Please sign in to comment.