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

feat: Run tests on Windows & macOS in CI #4970

Merged
merged 101 commits into from
Nov 18, 2023
Merged
Show file tree
Hide file tree
Changes from 99 commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
8cacd5e
Create test-windows.yml
Wissididom Sep 25, 2023
f950da5
Fix restore-keys and made Create build directory run on windows
Wissididom Sep 25, 2023
168eb3f
Move cd from create to install
Wissididom Sep 25, 2023
fddc92f
Move mkdir to install
Wissididom Sep 25, 2023
4c101c7
Output directory contents before running nmake
Wissididom Sep 25, 2023
301870b
Change bash syntax to pwsh syntax in 2 places
Wissididom Sep 25, 2023
bf9185d
Change bash syntax to pwsh syntax in 1 other place
Wissididom Sep 25, 2023
eaff46d
Change group name to hopefully prevent automatic cancellations
Wissididom Sep 25, 2023
25f0646
Ensure PowerShell is being used for installing Conan
Wissididom Sep 25, 2023
a153c9e
Add conan toolchain and precompiled headers cmake switch
Wissididom Sep 25, 2023
66821c1
Add `Env:` to -DBUILD_WITH_QT6
Wissididom Sep 25, 2023
b14ad9b
Remove `dir` before `nmake`
Wissididom Sep 25, 2023
acd5100
Disable PCH for now
Wissididom Sep 25, 2023
cf99ec6
diff-checked a little bit with the build workflow
Wissididom Sep 25, 2023
5473cc3
Remove includes and just use the matrix
Wissididom Sep 25, 2023
3838b77
Change 6.5.0 to 6.2.4
Wissididom Sep 25, 2023
d43bed2
Remove accidental tabs
Wissididom Sep 25, 2023
e479c2e
Initial MacOS Implementation
Wissididom Sep 26, 2023
b8089b6
Remove `NMake Makefiles` from macos test workflow
Wissididom Sep 26, 2023
8da3932
Disable PCH for MacOS
Wissididom Sep 26, 2023
0376b1a
Add missing double quote in make command
Wissididom Sep 26, 2023
b74df1c
Test ChatGPT's suggestion on fixing the C++ error in `InputCompletion…
Wissididom Sep 26, 2023
6912c86
ChatGPT Fix
Wissididom Sep 26, 2023
2dc5414
Use docker-machine to hopefully bypass the `docker: command not found…
Wissididom Sep 26, 2023
fcbc47d
Don't use a removed brew command!
Wissididom Sep 26, 2023
e18560a
Replace docker-machine and virtualbox with colima
Wissididom Sep 26, 2023
57ec311
Make sure Colima is getting stopped
Wissididom Sep 26, 2023
44ac461
Try to run docker without colima. If that doesn't work, I'll revert.
Wissididom Sep 26, 2023
9867aa0
Revert Test for without Colima
Wissididom Sep 26, 2023
94a8ad0
Make Post Setup Colima run even if earlier Jobs failed
Wissididom Sep 26, 2023
f18af11
Replace `completion.begin() + 3` with `2`
Wissididom Sep 26, 2023
95d8ec6
Revert cpp changes
Wissididom Sep 26, 2023
e5ca379
Ran prettier
Wissididom Sep 26, 2023
4f93d10
Merge branch 'main' into split-tests
Wissididom Oct 8, 2023
27ca6c9
Merge branch 'main' into split-tests
Wissididom Oct 16, 2023
fb09a27
Merge branch 'main' into split-tests
Wissididom Oct 24, 2023
46752b9
Hopefully fix windows test workflow
Wissididom Nov 2, 2023
d36e3fd
Merge branch 'main' into split-tests
Wissididom Nov 2, 2023
c7a1168
Fix typo in uses (use -> uses)
Wissididom Nov 2, 2023
d85d948
Remove unnecessary hyphens
Wissididom Nov 2, 2023
b234620
Remove src from pubsub server test build and run
Wissididom Nov 3, 2023
7b6b323
list directory contents for pubsub-server-test to find out where the …
Wissididom Nov 3, 2023
ea3a3cb
Remove `-la` because pwsh doesn't understand that
Wissididom Nov 3, 2023
efee6ea
Add `.exe` to the executable file of pubsub test
Wissididom Nov 3, 2023
9f4f381
Remove ls and tree from pubsub server test
Wissididom Nov 3, 2023
b15ce7a
Use pipenv
Wissididom Nov 3, 2023
884f107
Name Windows test file
Wissididom Nov 3, 2023
a917f68
Replace `<` by `|` for redirecting stdout of pipenv to stdin of pip3
Wissididom Nov 3, 2023
4548493
Change to pipenv install
Wissididom Nov 3, 2023
6ede3f8
Add `pipenv lock -r` before installing Pipfile
Wissididom Nov 3, 2023
d52fa02
Merge branch 'main' into split-tests
Wissididom Nov 3, 2023
dcc6d2e
Try `pipenv sync` before `pipenv install`
Wissididom Nov 3, 2023
098ff8d
Add name to Pipfile with pwsh logic
Wissididom Nov 3, 2023
e8ed29e
Upgrade to `macos-13` runner image to see if that fixes the problem w…
Wissididom Nov 4, 2023
3fb29e2
Download pubsub-server-test binaries instead of building it everytime
Wissididom Nov 4, 2023
baaa52f
Use `duskmoon314/httpbin-rs` instead of the old httpbin
Wissididom Nov 4, 2023
dc902e4
Merge branch 'main' into split-tests
Wissididom Nov 4, 2023
7a29255
Fix paths for real this time.
Wissididom Nov 4, 2023
25ba2ed
Move to `go-httpbin` because `httpbin-rs` doesn't support the `/statu…
Wissididom Nov 5, 2023
f81bfde
Remove `httpbin-rs` checkout step
Wissididom Nov 5, 2023
4706575
Remove httpbin directory
Wissididom Nov 5, 2023
0a9616e
Fix Invoke-WebRequest typo
Wissididom Nov 5, 2023
d9b5ef2
Merge branch 'main' into split-tests
Wissididom Nov 5, 2023
f598398
Merge branch 'main' into split-tests
Wissididom Nov 5, 2023
fe93163
Move to httpbox
Wissididom Nov 6, 2023
02cb473
Download crt and key because the pubsub-server seems to require it
Wissididom Nov 6, 2023
314fb10
Change directory instead of running the pubsub-server from the parent…
Wissididom Nov 6, 2023
27ad8f5
Fix paths
Wissididom Nov 6, 2023
b75e1a7
Try specifying C++20 in CMakeLists
Wissididom Nov 6, 2023
c0d399f
Remove unneccessary env variable from test-windows.yml
Wissididom Nov 7, 2023
cf9bb5c
Test specifying 2 instead of 1 to make ubuntu fail
Wissididom Nov 12, 2023
51c8b72
Make ubuntu test output verbose
Wissididom Nov 12, 2023
ce4a7b9
Revert changing EXPECT_CALL from 1 to 2
Wissididom Nov 12, 2023
e0affb5
Try using ctest on Mac
Wissididom Nov 17, 2023
09ae668
Try using ctest on Windows
Wissididom Nov 17, 2023
a4b9dc5
Remove old test line because ctest seems to work on all platforms
Wissididom Nov 17, 2023
ddfbc7e
Make MacOS Workflow Verbose
Wissididom Nov 17, 2023
b15c09d
Revert making MacOS Workflow Verbose because the Subprocess abort did…
Wissididom Nov 17, 2023
bee0d78
Revert editing the tests/CMakeLists.txt
Wissididom Nov 17, 2023
1709f1a
Add exclude-test option to ctest
Wissididom Nov 17, 2023
408a6e8
Change exclude-test to label-exclude
Wissididom Nov 17, 2023
7884ba6
Change to exclude-regex
Wissididom Nov 17, 2023
9ce5f26
Merge branch 'main' into split-tests
Wissididom Nov 17, 2023
9feff87
Extract pubsub server version to env variable
Wissididom Nov 17, 2023
a186590
Get version in filename from env var
Wissididom Nov 17, 2023
d9add37
Change Qt to 6.5.0 on Windows
Wissididom Nov 17, 2023
8488115
Add changelog entry
Wissididom Nov 17, 2023
3c3a8fd
Put httpbox to another step and use cargo to checkout and install
Wissididom Nov 17, 2023
5ebef03
Run httpbox in foreground temporarily to see why the network requests…
Wissididom Nov 17, 2023
26cb51b
Make httpbox run in background again because it seems to work as expe…
Wissididom Nov 17, 2023
e4ccc1f
Try moving httpbox back to the Test step to see if background jobs ge…
Wissididom Nov 18, 2023
165e882
Make cargo install a separate step and move crt and key download to t…
Wissididom Nov 18, 2023
146e9de
Change MacOS Qt to 6.5.0
Wissididom Nov 18, 2023
6ef344b
Remove clang-tidy-review and if macos conditions
Wissididom Nov 18, 2023
effe3fd
Remove `shell: bash`'s
Wissididom Nov 18, 2023
65c7988
Remove LTO stuff
Wissididom Nov 18, 2023
0795f73
Remove LTO stuff from Windows
Wissididom Nov 18, 2023
596acd9
Remove if windows checks
Wissididom Nov 18, 2023
fbe87c0
Remove powershell because it's the default according to https://githu…
Wissididom Nov 18, 2023
298731b
Remove PCH env variable from test-windows.yml
Wissididom Nov 18, 2023
b6bf6b3
Merge branch 'master' into split-tests
pajlada Nov 18, 2023
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
91 changes: 91 additions & 0 deletions .github/workflows/test-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
name: Test MacOS

on:
pull_request:
workflow_dispatch:
merge_group:

env:
TWITCH_PUBSUB_SERVER_IMAGE: ghcr.io/chatterino/twitch-pubsub-server-test:v1.0.6
QT_QPA_PLATFORM: minimal

concurrency:
group: test-macos-${{ github.ref }}
cancel-in-progress: true

jobs:
test-macos:
name: "Test ${{ matrix.os }}, Qt ${{ matrix.qt-version }}"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-13]
qt-version: [5.15.2, 6.5.0]
plugins: [false]
fail-fast: false
env:
C2_BUILD_WITH_QT6: ${{ startsWith(matrix.qt-version, '6.') && 'ON' || 'OFF' }}
QT_MODULES: ${{ startsWith(matrix.qt-version, '6.') && 'qt5compat qtimageformats' || '' }}

steps:
- name: Enable plugin support
if: matrix.plugins
run: |
echo "C2_PLUGINS=ON" >> "$GITHUB_ENV"

- name: Set BUILD_WITH_QT6
if: startsWith(matrix.qt-version, '6.')
run: |
echo "C2_BUILD_WITH_QT6=ON" >> "$GITHUB_ENV"

- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0 # allows for tags access

- name: Install Qt
uses: jurplel/[email protected]
with:
cache: true
cache-key-prefix: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}-v2
modules: ${{ env.QT_MODULES }}
version: ${{ matrix.qt-version }}

- name: Install dependencies
run: |
brew install boost openssl rapidjson p7zip create-dmg cmake tree docker colima

- name: Setup Colima
run: |
colima start

- name: Build
run: |
mkdir build-test
cd build-test
cmake \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DBUILD_TESTS=On \
-DBUILD_APP=OFF \
-DUSE_PRECOMPILED_HEADERS=OFF \
-DCHATTERINO_PLUGINS="$C2_PLUGINS" \
-DBUILD_WITH_QT6="$C2_BUILD_WITH_QT6" \
..
make -j"$(sysctl -n hw.logicalcpu)"

- name: Test
timeout-minutes: 30
run: |
docker pull kennethreitz/httpbin
docker pull ${{ env.TWITCH_PUBSUB_SERVER_IMAGE }}
docker run --network=host --detach ${{ env.TWITCH_PUBSUB_SERVER_IMAGE }}
docker run -p 9051:80 --detach kennethreitz/httpbin
ctest --repeat until-pass:4 --output-on-failure --exclude-regex ClassicEmoteNameFiltering
working-directory: build-test

- name: Post Setup Colima
if: always()
run: |
colima stop
working-directory: build-test
158 changes: 158 additions & 0 deletions .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
---
name: Test Windows

on:
pull_request:
workflow_dispatch:
merge_group:

env:
TWITCH_PUBSUB_SERVER_TAG: v1.0.7
QT_QPA_PLATFORM: minimal
# Last known good conan version
# 2.0.3 has a bug on Windows (conan-io/conan#13606)
CONAN_VERSION: 2.0.2

concurrency:
group: test-windows-${{ github.ref }}
cancel-in-progress: true

jobs:
test-windows:
name: "Test ${{ matrix.os }}, Qt ${{ matrix.qt-version }}"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
qt-version: [5.15.2, 6.5.0]
plugins: [false]
skip-artifact: [false]
skip-crashpad: [false]
fail-fast: false
env:
C2_BUILD_WITH_QT6: ${{ startsWith(matrix.qt-version, '6.') && 'ON' || 'OFF' }}
QT_MODULES: ${{ startsWith(matrix.qt-version, '6.') && 'qt5compat qtimageformats' || '' }}

steps:
- name: Enable plugin support
if: matrix.plugins
run: |
echo "C2_PLUGINS=ON" >> "$Env:GITHUB_ENV"

- name: Set Crashpad
if: matrix.skip-crashpad == false
run: |
echo "C2_ENABLE_CRASHPAD=ON" >> "$Env:GITHUB_ENV"

- name: Set BUILD_WITH_QT6
if: startsWith(matrix.qt-version, '6.')
run: |
echo "C2_BUILD_WITH_QT6=ON" >> "$Env:GITHUB_ENV"

- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0 # allows for tags access

- name: Install Qt
uses: jurplel/[email protected]
with:
cache: true
cache-key-prefix: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}-v2
modules: ${{ env.QT_MODULES }}
version: ${{ matrix.qt-version }}

- name: Enable Developer Command Prompt
uses: ilammy/[email protected]

- name: Setup conan variables
if: startsWith(matrix.os, 'windows')
run: |
"C2_USE_OPENSSL3=$(if ($Env:C2_BUILD_WITH_QT6 -eq "on") { "True" } else { "False" })" >> "$Env:GITHUB_ENV"
"C2_CONAN_CACHE_SUFFIX=$(if ($Env:C2_BUILD_WITH_QT6 -eq "on") { "-QT6" } else { "`" })" >> "$Env:GITHUB_ENV"

- name: Setup sccache
# sccache v0.5.3
uses: nerixyz/ccache-action@9a7e8d00116ede600ee7717350c6594b8af6aaa5
with:
variant: sccache
# only save on the default (master) branch
save: ${{ github.event_name == 'push' }}
key: sccache-test-${{ matrix.os }}-${{ matrix.qt-version }}-${{ matrix.skip-crashpad }}
Wissididom marked this conversation as resolved.
Show resolved Hide resolved
restore-keys: |
sccache-test-${{ matrix.os }}-${{ matrix.qt-version }}

- name: Cache conan packages
uses: actions/cache@v3
with:
key: ${{ runner.os }}-conan-user-${{ hashFiles('**/conanfile.py') }}${{ env.C2_CONAN_CACHE_SUFFIX }}
path: ~/.conan2/

- name: Install Conan
run: |
python3 -c "import site; import sys; print(f'{site.USER_BASE}\\Python{sys.version_info.major}{sys.version_info.minor}\\Scripts')" >> "$Env:GITHUB_PATH"
pip3 install --user "conan==${{ env.CONAN_VERSION }}"

- name: Setup Conan
run: |
conan --version
conan profile detect -f

- name: Install dependencies
run: |
mkdir build-test
cd build-test
conan install .. `
-s build_type=RelWithDebInfo `
-c tools.cmake.cmaketoolchain:generator="NMake Makefiles" `
-b missing `
--output-folder=. `
-o with_openssl3="$Env:C2_USE_OPENSSL3"

- name: Build
env:
# Enable PCH on Windows, later we can have it depend on the run/Qt Version like in the build workflow, I just want to make it work
C2_WINDOWS_USE_PCH: True
run: |
cmake `
-G"NMake Makefiles" `
-DCMAKE_BUILD_TYPE=RelWithDebInfo `
-DBUILD_TESTS=On `
-DBUILD_APP=OFF `
-DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" `
-DUSE_PRECOMPILED_HEADERS=${{ env.C2_WINDOWS_USE_PCH }} `
Wissididom marked this conversation as resolved.
Show resolved Hide resolved
-DBUILD_WITH_CRASHPAD="$Env:C2_ENABLE_CRASHPAD" `
-DCHATTERINO_PLUGINS="$Env:C2_PLUGINS" `
-DBUILD_WITH_QT6="$Env:C2_BUILD_WITH_QT6" `
..
set cl=/MP
nmake /S /NOLOGO
working-directory: build-test

- name: Download and extract Twitch PubSub Server Test
run: |
mkdir pubsub-server-test
Invoke-WebRequest -Uri "https://github.com/Chatterino/twitch-pubsub-server-test/releases/download/${{ env.TWITCH_PUBSUB_SERVER_TAG }}/server-${{ env.TWITCH_PUBSUB_SERVER_TAG }}-windows-amd64.zip" -outfile "pubsub-server.zip"
Expand-Archive pubsub-server.zip -DestinationPath pubsub-server-test
rm pubsub-server.zip
cd pubsub-server-test
Invoke-WebRequest -Uri "https://github.com/Chatterino/twitch-pubsub-server-test/raw/${{ env.TWITCH_PUBSUB_SERVER_TAG }}/cmd/server/server.crt" -outfile "server.crt"
Invoke-WebRequest -Uri "https://github.com/Chatterino/twitch-pubsub-server-test/raw/${{ env.TWITCH_PUBSUB_SERVER_TAG }}/cmd/server/server.key" -outfile "server.key"
cd ..

- name: Cargo Install httpbox
run: |
cargo install --git https://github.com/kevinastone/httpbox --rev 89b971f

- name: Test
timeout-minutes: 30
run: |
httpbox --port 9051 &
cd ..\pubsub-server-test
.\server.exe 127.0.0.1:9050 &
cd ..\build-test
ctest --repeat until-pass:4 --output-on-failure --exclude-regex ClassicEmoteNameFiltering
working-directory: build-test

- name: Clean Conan cache
run: conan cache clean --source --build --download "*"
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,6 @@ jobs:
docker pull ${{ env.TWITCH_PUBSUB_SERVER_IMAGE }}
docker run --network=host --detach ${{ env.TWITCH_PUBSUB_SERVER_IMAGE }}
docker run -p 9051:80 --detach kennethreitz/httpbin
ctest --repeat until-pass:4
ctest --repeat until-pass:4 --output-on-failure
working-directory: build-test
shell: bash
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
- Dev: Refactor `IrcMessageHandler`, removing a bunch of clang-tidy warnings & changing its public API. (#4927)
- Dev: `Details` file properties tab is now populated on Windows. (#4912)
- Dev: Removed `Outcome` from network requests. (#4959)
- Dev: Added Tests for Windows and MacOS in CI. (#4970)

## 2.4.6

Expand Down
Loading