Skip to content

Commit

Permalink
Build both Windows and Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
Gatsik committed May 19, 2024
1 parent 3658ba8 commit 87d6611
Showing 1 changed file with 77 additions and 8 deletions.
85 changes: 77 additions & 8 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@ on:
required: true

jobs:
release:
build-windows:
runs-on: ubuntu-latest
env:
UID_FILENAME: faf-uid.exe
UID_PLATFORM: win32
MXE_DIR: /usr/lib/mxe
MXE_TARGET: x86_64-w64-mingw32.static
MXE_PACKAGE_PREFIX: mxe-x86-64-w64-mingw32.static

steps:
- uses: actions/checkout@v4

- name: Configure MXE
run: |
echo "deb https://pkg.mxe.cc/repos/apt focal main" | sudo tee /etc/apt/sources.list.d/mxeapt.list
Expand Down Expand Up @@ -65,9 +64,11 @@ jobs:
unzip \
wget \
xz-utils \
# faf-uid dependencies
$MXE_PACKAGE_PREFIX-jsoncpp \
$MXE_PACKAGE_PREFIX-cryptopp \
$MXE_PACKAGE_PREFIX-icu4c
- name: Build
run: |
$MXE_DIR/usr/bin/$MXE_TARGET-cmake \
Expand All @@ -77,15 +78,83 @@ jobs:
-DUID_SKIP_LEGACY=On \
-B build
make -C build
ls build/
ls build/$UID_FILENAME
- name: Create draft release
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: faf-uid.exe
path: build/faf-uid.exe

build-linux:
runs-on: ubuntu-latest
env:
JSONCPP_VERSION: 1.7.7
CRYPTOPP_VERSION: 8_9_0

steps:
- uses: actions/checkout@v4

- name: Build jsoncpp
run: |
wget https://github.com/open-source-parsers/jsoncpp/archive/$JSONCPP_VERSION.tar.gz -O jsoncpp.tar.gz
tar xfz jsoncpp.tar.gz
mkdir jsoncpp-build
cmake \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF \
-DBUILD_STATIC_LIBS=ON \
-DBUILD_SHARED_LIBS=OFF \
-B jsoncpp-build \
-S jsoncpp-$JSONCPP_VERSION
make -C jsoncpp-build
- name: Build cryptopp
wget https://github.com/weidai11/cryptopp/archive/CRYPTOPP_$CRYPTOPP_VERSION.zip -O cryptopp.zip
unzip ./cryptopp.zip
mv cryptopp-CRYPTOPP_$CRYPTOPP_VERSION cryptopp
make -C cryptopp -f GNUmakefile CXXFLAGS='-DCRYPTOPP_NO_BACKWARDS_COMPATIBILITY_562 -DNDEBUG -O3' libcryptopp.a

- name: Build
cmake \
-DJSONCPP_LIBRARIES=$(pwd)/jsoncpp-build/src/lib_json/libjsoncpp.a \
-DJSONCPP_INCLUDE_DIRS=$(pwd)/jsoncpp-$JSONCPP_VERSION/include \
-DCRYPTOPP_LIBRARIES=$(pwd)/cryptopp/libcryptopp.a \
-DCRYPTOPP_INCLUDE_DIRS=$(pwd)/cryptopp \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-B build
make -C build

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: faf-uid
path: build/faf-uid

create-release:
needs: [build-windows, build-linux]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: faf-uid.exe
path: release-artifacts/

- name: Download Linux artifact
uses: actions/download-artifact@v4
with:
name: faf-uid
path: release-artifacts/

- name: Create release
id: create_release
uses: ncipollo/release-action@v1
uses: ncipollo/release-action@v1.14.0
with:
commit: ${{ github.sha }}
tag: ${{ github.event.inputs.version }}
draft: true
prerelease: true
artifacts: build/${{ env.UID_FILENAME }}
artifacts: "release-artifacts/*"

0 comments on commit 87d6611

Please sign in to comment.