lpac/.github/workflows/build.yaml
Coelacanthus 04bd397ea4
feat: add CPack support (#39)
* chore: use GNUInstallDirs

Signed-off-by: Coelacanthus <CoelacanthusHex@gmail.com>

* feat: add CPack support

Signed-off-by: Coelacanthus <CoelacanthusHex@gmail.com>

* fix: Time.h and time.h conflict

* fix: ${DL_LIBRARY} use before init

Signed-off-by: Coelacanthus <CoelacanthusHex@gmail.com>

---------

Signed-off-by: Coelacanthus <CoelacanthusHex@gmail.com>
2024-02-09 00:02:45 +08:00

90 lines
2.8 KiB
YAML

name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
jobs:
build:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-14]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup toolchain
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libpcsclite-dev libcurl4-openssl-dev gcc make cmake gcc-mingw-w64 g++-mingw-w64 unzip ninja-build
- name: Setup toolchain for Windows(Cygwin)
if: runner.os == 'Windows'
uses: egor-tensin/setup-cygwin@v4
with:
packages: cmake gcc-g++ make zip wget ninja
- name: Build for Windows(Cygwin)
if: runner.os == 'Windows'
run: |
mkdir build-cygwin && cd build-cygwin && cmake .. -GNinja -DCPACK_GENERATOR=CygwinBinary && ninja package
- name: Build for Linux
if: runner.os == 'Linux'
shell: bash
run: |
mkdir build && cd build && cmake .. -GNinja && ninja
chmod +x output/lpac
zip -r -j lpac-linux-x86_64.zip output/*
- name: Build for Debian
if: runner.os == 'Linux'
shell: bash
run: |
mkdir build-deb && cd build-deb && cmake .. -GNinja -DCPACK_GENERATOR=DEB && ninja package
- name: Build for Windows(MinGW)
if: runner.os == 'Linux'
shell: bash
run: |
mkdir build-mingw && cd build-mingw && cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=./cmake/linux-mingw64.cmake .. && ninja
wget https://curl.se/windows/dl-8.5.0_3/curl-8.5.0_3-win64-mingw.zip -O curl.zip && unzip curl.zip && mv curl-8.5.0_3-win64-mingw/bin/libcurl-x64.dll output/libcurl.dll
zip -r -j lpac-windows-x86_64-mingw.zip output/*
- name: Build for macOS
if: runner.os == 'macOS'
run: |
mkdir build && cd build && cmake .. && make -j$(sysctl -n hw.ncpu)
chmod +x output/lpac
zip -r -j lpac-macos-universal.zip output/*
shell: bash
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: artifact-${{ matrix.os }}
path: |
build-mingw/lpac-windows-x86_64-mingw.zip
build-cygwin/lpac-*.tar.bz2
build-deb/lpac-*.deb
build/lpac-linux-x86_64.zip
build/lpac-macos-universal.zip
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
files: |
build-mingw/lpac-windows-x86_64-mingw.zip
build-cygwin/lpac-*.tar.bz2
build-deb/lpac-*.deb
build/lpac-linux-x86_64.zip
build/lpac-macos-universal.zip