Flatpak support, round two #12558
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: Unit Tests | |
on: | |
push: | |
branches: | |
- main | |
- "releases/**" | |
pull_request: | |
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 Unit 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) | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- run: pip install -r requirements.txt | |
- name: Cache grcov | |
id: cache-grcov | |
uses: actions/cache@v3 | |
with: | |
path: grcov-build/ | |
key: ${{runner.os}}-grcov-v0.8.13 | |
- 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: | | |
mkdir -p build | |
cmake -S . -B $(pwd)/build \ | |
-DCMAKE_CXX_FLAGS=--coverage -DCMAKE_EXE_LINKER_FLAGS=--coverage | |
cmake --build $(pwd)/build --target build_tests -j$(nproc) | |
- name: Running native messaging tests | |
shell: bash | |
working-directory: ./build/tests/nativemessaging | |
run: | | |
export PATH=${{github.workspace}}/grcov-build/bin:$PATH | |
ctest --output-on-failure | |
grcov $(pwd)/CMakeFiles/nativemessaging_tests.dir -s ${{github.workspace}} \ | |
-t lcov --branch --ignore-not-existing > ${{github.workspace}}/nativemessaging_lcov.info | |
- 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 | |
- 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)/unit/CMakeFiles/unit_tests.dir -s ${{github.workspace}} \ | |
-t lcov --branch --ignore-not-existing > ${{github.workspace}}/unit_lcov.info | |
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 | |
uses: codecov/codecov-action@v3 | |
with: | |
directory: . | |
flags: linux_unit_tests | |
name: codecov-poc | |
files: nativemessaging_lcov.info,qml_lcov.info,unit_lcov.info,unitapp_lcov.info | |
verbose: true | |
macos-unit-tests: | |
runs-on: macos-latest | |
defaults: | |
run: | |
shell: bash -el {0} | |
name: Run Unit tests on MacOS | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v3 | |
with: | |
submodules: "recursive" | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
miniconda-version: "latest" | |
environment-file: env.yml | |
activate-environment: vpn | |
- name: Install dependencies | |
run: | | |
./scripts/macos/conda_install_extras.sh | |
export SDKROOT=$(xcrun --sdk macosx --show-sdk-path) | |
brew install ninja | |
- name: Install Qt6 | |
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: Cache grcov | |
id: cache-grcov | |
uses: actions/cache@v3 | |
with: | |
path: grcov-build/ | |
key: ${{runner.os}}-grcov-v0.8.13 | |
- name: Install Grcov | |
if: steps.cache-grcov.outputs.cache-hit != 'true' | |
run: | | |
cargo install grcov --root ${{github.workspace}}/grcov-build --version 0.8.13 | |
- name: Building tests | |
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 build_tests | |
- name: Running native messaging tests | |
working-directory: ./build/tests/nativemessaging | |
run: | | |
export PATH=${{github.workspace}}/grcov-build/bin:$PATH | |
ctest --output-on-failure | |
grcov $(pwd)/CMakeFiles/nativemessaging_tests.dir -s ${{github.workspace}} \ | |
-t lcov --branch --ignore-not-existing > ${{github.workspace}}/nativemessaging_lcov.info | |
- name: Running QML tests | |
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 | |
- name: Running unit tests | |
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)/unit/CMakeFiles/unit_tests.dir -s ${{github.workspace}} \ | |
-t lcov --branch --ignore-not-existing > ${{github.workspace}}/unit_lcov.info | |
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 | |
uses: codecov/codecov-action@v3 | |
with: | |
directory: . | |
flags: macos_unit_tests | |
name: codecov-poc | |
files: auth_lcov.info,nativemessaging_lcov.info,qml_lcov.info,unit_lcov.info,unitapp_lcov.info | |
verbose: true | |
windows-unit-tests: | |
name: Run Unit 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/setup-msbuild@v1.1 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- run: pip 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 build_tests | |
- name: Running native messaging tests | |
shell: bash | |
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 | |
rust-unit-tests: | |
strategy: | |
matrix: | |
os: [ubuntu-22.04, windows-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
name: Run Unit tests for Rust (${{ matrix.os }}) | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v3 | |
- name: Signature library tests | |
shell: bash | |
working-directory: ./signature | |
run: cargo test -- --nocapture |