Skip to content

Commit

Permalink
[Feature] Add Prebuilds for Windows
Browse files Browse the repository at this point in the history
For a long time, I get issues from new users with
QArchive compile errors, mostly from Windows because
it's not developer friendly. Also most of the users
want to try this out with ease, so I introduce prebuilds
for Windows users for now. They should be able to use
QArchive without compiling.

I also include symbolic constants for QArchive which
gives version information.

We also reduce tests on ubuntu since it seems redundant
and makes tests slow, planning to remove more redundant
test to increase test speeds.

We also have a special commit which will make a new release
itself. I have to run scripts/bump_version.sh to make a new
relesae from now on, this is in place to avoid updating the
version number in CMake files and meson build. (Like i did
in the previous version v2.2.8, which has v2.2.7 in cmake files)

Signed-off-by: Divya Antony J R <antonyjr@protonmail.com>
  • Loading branch information
antony-jr committed Dec 11, 2023
1 parent 5bc2feb commit 7ed91db
Show file tree
Hide file tree
Showing 9 changed files with 1,352 additions and 7 deletions.
125 changes: 125 additions & 0 deletions .github/workflows/deploy.yml
@@ -0,0 +1,125 @@
name: Deploy Release

on:
push:
branches:
- master

permissions:
contents: write

jobs:
check:
runs-on: ubuntu-latest
outputs:
deploy: ${{ steps.git.outputs.deploy }}
steps:
- uses: actions/checkout@v3

- name: Install Python3
run: |
sudo apt install -y python3
- id: git
name: Check Commit Message
run: |
git clone https://github.com/antony-jr/QArchive qarc
cd qarc
git tag > /tmp/tags.txt
cd ..
rm -rf qarc
cat /tmp/tags.txt
result=$(python3 scripts/check.py "$(git log -1 --pretty=%B)" "/tmp/tags.txt")
echo "deploy=$result" >> $GITHUB_OUTPUT
- id: make_rel
if: steps.git.outputs.deploy != 'false'
name: Make Relase
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.git.outputs.deploy}}
run: |
git show -s --format="%b" | head -n -2 > body.md
gh release create "$tag" \
--repo="$GITHUB_REPOSITORY" \
--title="$tag" \
--notes-file body.md
notify:
id: notification
name: Notify Qt Modules Repository
needs: [windows-msvc-build]
env:
GITHUB_TOKEN: $${{ secrets.QTMODULES_TOKEN }}
run: gh api repos/antony-jr/qtmodules/dispatches --raw-field event_type=qarchive

windows-msvc:
runs-on: windows-2019
id: windows-msvc-build
needs: check
if: needs.check.outputs.deploy != 'false'
name: windows-msvc-v${{ matrix.toolset }}-${{ matrix.arch }}-qt-${{ matrix.qt_version }}-${{ matrix.build_type }}
strategy:
fail-fast: false
matrix:
qt_version: [5.15.2]
arch: [x64, x86]
build_type: [Release, Debug]
toolset: [14.0, 14.2]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: CMake
uses: lukka/get-cmake@latest

- name: MSVC
uses: TheMrMilchmann/setup-msvc-dev@v2
with:
arch: ${{ matrix.arch }}
toolset: ${{ matrix.toolset }}

- name: Install Conan
id: conan
uses: turtlebrowser/get-conan@main
with:
version: 1.62.0

- name: Make Output Directory
run: |
mkdir -p ${{github.workspace}}/output/QArchive
mkdir -p ${{github.workspace}}/upload
- name: Build
run: |
set QT_VERSION=${{ matrix.qt_version }}
python3 scripts/write_conan.py
mkdir build
cd build
cmake -DQARCHIVE_QT_VERSION_MAJOR=5 -DQARCHIVE_CONAN_BUILD=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
cmake --build . --config ${{ matrix.build_type }}
cmake --install . --prefix=${{ github.workspace }}/output/QArchive --config ${{ matrix.build_type }}
cd ..
- name: Check Contents
working-directory: ${{github.workspace}}
run: ls -R ${{ github.workspace }}/output

- name: Zip Files
run: |
cd ${{ github.workspace }}/output/
7z a ${{ github.workspace }}/upload/windows-msvc-v${{ matrix.toolset }}-qt-${{ matrix.qt_version }}-${{ matrix.arch }}-${{ matrix.build_type }}.zip QArchive
- id: upload_rel
name: Upload Asset
working-directory: ${{ github.workspace }}/upload
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ needs.check.outputs.deploy }}
run: |
gh release upload "$tag" \
--repo="$GITHUB_REPOSITORY" \
windows-msvc-v${{ matrix.toolset }}-qt-${{ matrix.qt_version }}-${{ matrix.arch }}-${{ matrix.build_type }}.zip
37 changes: 35 additions & 2 deletions .github/workflows/tests.yml
Expand Up @@ -12,15 +12,40 @@ env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
jobs:
check:
runs-on: ubuntu-latest
outputs:
deploy: ${{ steps.git.outputs.deploy }}
steps:
- uses: actions/checkout@v3

- name: Install Python3
run: |
sudo apt install -y python3
- id: git
name: Check Commit Message
run: |
git clone https://github.com/antony-jr/QArchive qarc
cd qarc
git tag > /tmp/tags.txt
cd ..
rm -rf qarc
cat /tmp/tags.txt
result=$(python3 scripts/check.py "$(git log -1 --pretty=%B)" "/tmp/tags.txt")
echo "deploy=$result" >> $GITHUB_OUTPUT
ubuntu:
needs: check
if: needs.check.outputs.deploy == 'false'
runs-on: ubuntu-${{ matrix.ubuntu_version }}
name: Ubuntu-${{ matrix.ubuntu_version }}-Qt-${{ matrix.qt_version }}-shared-${{ matrix.shared }}
strategy:
fail-fast: false
matrix:
ubuntu_version: [20.04, 22.04]
qt_version: [5.9.9, 5.12.12, 5.15.2, 6.4.0]
qt_version: [5.9.9, 5.15.2, 6.4.0]
shared: [ON, OFF]

steps:
Expand Down Expand Up @@ -64,6 +89,8 @@ jobs:
run: "ctest --verbose"

macos:
needs: check
if: needs.check.outputs.deploy == 'false'
runs-on: macos-${{ matrix.macos_version }}
name: macos-${{ matrix.macos_version }}-Qt6-${{ matrix.qt6 }}-${{ matrix.shared }}
strategy:
Expand All @@ -89,6 +116,8 @@ jobs:
- name: Run tests
run: meson test -C "${{github.workspace}}/build" --verbose
MSYS2:
needs: check
if: needs.check.outputs.deploy == 'false'
runs-on: windows-latest
name: MSYS2-${{matrix.platform}}
strategy:
Expand Down Expand Up @@ -119,6 +148,8 @@ jobs:
meson compile -C "${{github.workspace}}/build" --verbose
meson test -C "${{github.workspace}}/build" --verbose
Ubuntu-meson:
needs: check
if: needs.check.outputs.deploy == 'false'
runs-on: ubuntu-20.04
name: Linux-GCC${{matrix.cxx}}
strategy:
Expand All @@ -139,6 +170,8 @@ jobs:
meson compile -C "${{github.workspace}}/build" --verbose
meson test -C "${{github.workspace}}/build" --verbose
Ubuntu-meson-clang:
needs: check
if: needs.check.outputs.deploy == 'false'
runs-on: ubuntu-20.04
name: Linux-Clang${{matrix.cxx}}
strategy:
Expand Down
16 changes: 16 additions & 0 deletions CMakeLists.txt
Expand Up @@ -25,6 +25,22 @@ set(CMAKE_AUTOMOC ON)
option(QARCHIVE_STATIC "Static Build of QArchive" ON)
# ---

# This is used to generate pre-build binaries.
option(QARCHIVE_CONAN_BUILD "Use conan to build QArchive" OFF)
if (QARCHIVE_CONAN_BUILD)
set(CMAKE_CXX_STANDARD 14) # Conan wants C++14, I have no idea why.

list(APPEND CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR})
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR})
include(conan.cmake)

conan_cmake_autodetect(settings)
conan_cmake_install(PATH_OR_REFERENCE ${CMAKE_SOURCE_DIR}/conanfile.py
BUILD missing
REMOTE conancenter
SETTINGS ${settings})
endif()

# Find the QtCore library and libarchive.
# In macOS, if libarchive is installed via homebrew,
# it does not link well with CMake. The only workaround to
Expand Down

0 comments on commit 7ed91db

Please sign in to comment.