Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use caching to speed up functional tests #10053

Merged
merged 16 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/build_addons.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# A reusable workflow to build addons
on:
workflow_call:
inputs:
test-addons-name:
required: true
type: string

jobs:
build-test-addons:
name: Build Test Addons
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Setup addons cache
id: addons-cache
uses: actions/cache@v4
with:
path: build-addons/
key: test-addons-${{ hashFiles('addons/', 'test/functional/addons/') }}

- name: Install build dependencies
if: steps.addons-cache.outputs.cache-hit != 'true'
shell: bash
run: |
git submodule init
git submodule update 3rdparty/i18n
sudo apt-get update
sudo apt-get install -y $(./scripts/linux/getdeps.py -b linux/debian/control)

- name: Build test addons
if: steps.addons-cache.outputs.cache-hit != 'true'
shell: bash
run: |
mkdir -p build-addons/
cmake -S $(pwd)/tests/functional/addons -B build-addons/
cmake --build build-addons/

- uses: actions/upload-artifact@v4
with:
name: ${{ inputs.test-addons-name }}
path: build-addons/
33 changes: 23 additions & 10 deletions .github/workflows/linux_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ concurrency:
cancel-in-progress: true

jobs:
build_test_addons:
name: Build Test Addons
uses: ./.github/workflows/build_addons.yaml
with:
test-addons-name: test-addons-${{ github.sha }}

build_test_app:
name: Build Test Client
runs-on: ubuntu-22.04
Expand All @@ -27,30 +33,31 @@ jobs:
submodules: "recursive"
- run: |
sudo apt-get update
sudo apt-get install -y $(./scripts/linux/getdeps.py -a linux/debian/control)
sudo apt-get install -y $(./scripts/linux/getdeps.py -a linux/debian/control) ccache

- uses: actions/setup-python@v5
with:
python-version: "3.9"
cache: "pip"
- run: pip install -r requirements.txt

- name: Setup compiler cache
uses: actions/cache@v4
with:
path: ~/.cache/ccache
key: ccache-${{ runner.os }}-${{ runner.arch }}-${{ github.sha }}
lookup-only: github.event_name == 'pull_request'
restore-keys: ccache-${{ runner.os }}-${{ runner.arch }}-${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.sha }}

- name: Compile test client
shell: bash
run: |
mkdir -p build/cmake
cmake -S $(pwd) -B build/cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake -S $(pwd) -B build/cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache
cmake --build build/cmake
cp ./build/cmake/src/mozillavpn build/

- name: Compile test addons
shell: bash
run: |
mkdir -p build/addons
cmake -S $(pwd)/tests/functional/addons -B build/addons \
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/qt_dist/lib/cmake
cmake --build build/addons

- uses: actions/upload-artifact@v4
with:
name: test-client-${{ github.sha }}
Expand Down Expand Up @@ -78,6 +85,7 @@ jobs:
name: Functional tests
needs:
- build_test_app
- build_test_addons
runs-on: ubuntu-22.04
timeout-minutes: 45
strategy:
Expand All @@ -93,6 +101,11 @@ jobs:
name: test-client-${{ github.sha }}
path: build/

- uses: actions/download-artifact@v4
with:
name: test-addons-${{ github.sha }}
path: build/addons/

- name: Install test dependecies
run: |
sudo apt-get update
Expand Down
30 changes: 22 additions & 8 deletions .github/workflows/macos_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ concurrency:
cancel-in-progress: true

jobs:
build_test_addons:
name: Build Test Addons
uses: ./.github/workflows/build_addons.yaml
with:
test-addons-name: test-addons-${{ github.sha }}

build_test_app:
name: Build Test Client
runs-on: macos-latest
Expand All @@ -32,9 +38,17 @@ jobs:
- uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
environment-file: env.yml
environment-file: "env.yml"
activate-environment: vpn

- name: Setup compiler cache
uses: actions/cache@v4
with:
path: ~/Library/Caches/ccache
key: ccache-${{ runner.os }}-${{ runner.arch }}-${{ github.sha }}
lookup-only: github.event_name == 'pull_request'
restore-keys: ccache-${{ runner.os }}-${{ runner.arch }}-${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.sha }}

- name: Install build dependencies
run: |
./scripts/macos/conda_install_extras.sh
Expand All @@ -50,17 +64,11 @@ jobs:
run: |
mkdir -p build/cmake
cmake -S $(pwd) -B build/cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/qt_dist/lib/cmake
cmake --build build/cmake
cp -r ./build/cmake/src/Mozilla\ VPN.app/ build/Mozilla\ VPN.app

- name: Compile test addons
run: |
mkdir -p build/addons
cmake -S $(pwd)/tests/functional/addons -B build/addons \
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/qt_dist/lib/cmake
cmake --build build/addons

- uses: actions/upload-artifact@v4
with:
name: test-client-${{ github.sha }}
Expand All @@ -86,6 +94,7 @@ jobs:
name: Functional tests
needs:
- build_test_app
- build_test_addons
runs-on: macos-latest
timeout-minutes: 45
strategy:
Expand All @@ -101,6 +110,11 @@ jobs:
name: test-client-${{ github.sha }}
path: build/

- uses: actions/download-artifact@v4
with:
name: test-addons-${{ github.sha }}
path: build/addons/

- uses: actions/setup-python@v5
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
Expand Down
28 changes: 16 additions & 12 deletions .github/workflows/wasm_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ concurrency:
cancel-in-progress: true

jobs:
wasmQt6:
build_test_addons:
name: Build Test Addons
uses: ./.github/workflows/build_addons.yaml
with:
test-addons-name: test-addons-${{ github.sha }}

build_test_app:
name: Wasm Qt6
runs-on: ubuntu-20.04
outputs:
Expand Down Expand Up @@ -62,17 +68,9 @@ jobs:
cmake --build build/cmake -j4
cp -r build/cmake/wasm_build build/wasm_build

- name: Compile test addons
shell: bash
run: |
mkdir -p build/addons
cmake -S $(pwd)/tests/functional/addons -B build/addons \
-DCMAKE_PREFIX_PATH=/opt/$QTVERSION/gcc_64/lib/cmake
cmake --build build/addons

- uses: actions/upload-artifact@v4
with:
name: WebAssembly Build Qt6
name: test-wasm-${{ github.sha }}
path: |
build/
!build/cmake/
Expand All @@ -96,7 +94,8 @@ jobs:
functionaltests:
name: Functional tests
needs:
- wasmQt6
- build_test_app
- build_test_addons
runs-on: ubuntu-20.04
timeout-minutes: 45
strategy:
Expand All @@ -112,9 +111,14 @@ jobs:

- uses: actions/download-artifact@v4
with:
name: WebAssembly Build Qt6
name: test-wasm-${{ github.sha }}
path: build/

- uses: actions/download-artifact@v4
with:
name: test-addons-${{ github.sha }}
path: build/addons/

- uses: actions/setup-python@v5
with:
python-version: "3.9"
Expand Down
1 change: 1 addition & 0 deletions env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ dependencies:
- clang=16.0.6
- clang-tools=16.0.6
- clangxx=16.0.6
- ccache=4.10.1
- python=3.9
- nodejs=18.16.*
- pip=22.3.1
Expand Down
1 change: 1 addition & 0 deletions src/dnshelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ struct dnsData {
QString ipAddress;
QString dnsType;
};

class DNSHelper final {
public:
static QString getDNS(const QString& fallbackAddress);
Expand Down
Loading