Skip to content

Commit

Permalink
use conan.
Browse files Browse the repository at this point in the history
  • Loading branch information
antony-jr committed Nov 21, 2023
1 parent 2012678 commit b64cfa4
Show file tree
Hide file tree
Showing 3 changed files with 143 additions and 44 deletions.
119 changes: 100 additions & 19 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,52 +5,133 @@ on:
branches:
- add-prebuilts

env:
BUILD_TYPE: Release

jobs:
windows:
runs-on: windows-latest
name: MSYS2-${{matrix.platform}}
windows-msvc:
runs-on: windows-2019
name: windows-msvc-qt-${{ matrix.qt_version }}-${{ matrix.build_type }}
strategy:
fail-fast: false
matrix:
qt_version: [5.15.2]
arch: [x64, x86]
build_type: [Release, Debug]

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 }}

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

- name: Make Output Directory
run: |
mkdir -p ${{github.workspace}}/output/QArchive
mkdir -p ${{github.workspace}}/upload
- name: Build
run: |
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
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-qt-${{ matrix.qt_version }}-${{ matrix.arch }}-${{ matrix.build_type }}.zip QArchive
- name: Upload Bundles
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ github.workspace }}/upload/windows-msvc-qt-${{ matrix.qt_version }}-${{ matrix.arch }}-${{ matrix.build_type }}.zip
tag: prebuilt
overwrite: true
prerelease: true
release_name: "Prebuilt Library"
body: "Prebuilt binaries for QArchive, to use with Qt prebuilds. (Work in Progress)"

windows-mingw:
runs-on: windows-2019
name: windows-${{matrix.platform}}-qt-${{matrix.qt_version}}
strategy:
matrix:
qt_version: [5.15.2]
platform: ['MINGW64']
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3

- uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.platform}}
pacboy: >-
cc:p
libarchive:p
meson:p
ninja:p
pkgconf:p
qt5-base:p
cmake:p
install: >-
p7zip
wget
- name: Install Conan
id: conan
uses: turtlebrowser/get-conan@main
with:
version: 1.52.0

- name: Make Output Directory
run: |
mkdir -p ${{github.workspace}}/output/QArchive
- name: Compile and Test
- name: Build and Upload
run: |
meson setup "${{github.workspace}}/build" --prefix "${{github.workspace}}/output/QArchive" -Dauto_features=disabled -Dwarning_level=3 -Dcpp_std=c++20
meson compile -C "${{github.workspace}}/build" --verbose
meson test -C "${{github.workspace}}/build" --verbose
meson install -C "${{github.workspace}}/build"
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
cd ..
cd output
7z a windows-Qt-5.15.11-${{ matrix.platform }}.zip QArchive
mkdir upload
mv windows-Qt-5.15.11-${{ matrix.platform }}.zip upload/
7z a windows-${{matrix.platform}}-qt-${{matrix.qt_version}}.zip QArchive
cp windows-${{matrix.platform}}-qt-${{matrix.qt_version}}.zip upload/
wget "https://github.com/tcnksm/ghr/releases/download/v0.16.2/ghr_v0.16.2_windows_amd64.zip"
7z x ghr_v0.16.2_windows_amd64.zip
ghr_v0.16.2_windows_amd64/ghr.exe -u antony-jr -r QArchive -t ${{ secrets.GITHUB_TOKEN }} -replace -delete -draft -prerelease prebuilt upload/
7z x ghr_v0.16.2_windows_amd64.zip
ghr_v0.16.2_windows_amd64/ghr.exe -u antony-jr \
-r QArchive \
-t ${{ secrets.GITHUB_TOKEN }} \
-replace \
-prerelease \
prebuilt upload/
25 changes: 0 additions & 25 deletions conanfile.py

This file was deleted.

43 changes: 43 additions & 0 deletions scripts/write_conan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env python3
import os

print("Write Conan, A Simple Script to Write Conanfile.py")
print("Copyright (C) 2023-Present, Antony J.R\n")

contents = '''#!/usr/bin/env python3
from conans import ConanFile, CMake
class Conan(ConanFile):
name = "QArchive"
version = "{}"
settings = "arch"
generators = ["cmake_find_package", "cmake", "json"]
def configure(self):
self.requires("libarchive/3.6.2")
self.requires("qt/{}")
self.requires("zlib/1.2.12")
self.options["qt"].shared = {}
'''

build_shared = "True"
qarchive_version = "2.2.7"
qt_version = "5.15.2"

if 'STATIC_BUILD' in os.environ:
build_shared = "False"
if 'QARCHIVE_VERSION' in os.environ:
qarchive_version = os.environ['QARCHIVE_VERSION']
if 'QT_VERSION' in os.environ:
qt_version = os.environ['QT_VERSION']

print("SHARED BUILD: {}".format(build_shared))
print("QT_VERSION: {}".format(qt_version))
print("QARCHIVE_VERSION: {}".format(qarchive_version))

fp = open('conanfile.py', 'wt')
fp.write(contents.format(qarchive_version, qt_version, build_shared))
fp.close()

print("\nFile Written.")

0 comments on commit b64cfa4

Please sign in to comment.