Skip to content

Commit

Permalink
Update build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
offici5l authored Nov 2, 2024
1 parent c98abef commit e591723
Showing 1 changed file with 25 additions and 48 deletions.
73 changes: 25 additions & 48 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,53 +7,30 @@ env:
VERSION: 1.1

jobs:
build:
runs-on: windows-latest

build_termux:
runs-on: ubuntu-latest
strategy:
matrix:
architecture: [aarch64, arm, i686, x86_64]
steps:
- uses: actions/checkout@v4
- name: Build miasst_termux
run: |
if [[ "${{ matrix.architecture }}" == "aarch64" || "${{ matrix.architecture }}" == "arm" ]]; then
docker run --privileged aptman/qus -s -- -p aarch64 arm
fi
docker run --name ${{ matrix.architecture }} --privileged \
-v $(pwd)/main.c:/data/data/com.termux/files/home/main.c \
-v $(pwd)/libs:/data/data/com.termux/files/home/libs \
termux/termux-docker:${{ matrix.architecture }} bash -c "pkg install libc++ && yes | pkg install clang && yes | pkg install libusb && clang -o miasst_termux_${{ matrix.architecture }} main.c libs/*.c -lusb-1.0 -lcurl"
docker cp ${{ matrix.architecture }}:/data/data/com.termux/files/home/miasst_termux_${{ matrix.architecture }} ./
- name: Upload Release Assets (Termux)
run: |
gh release upload ${{ env.VERSION }} ./miasst_termux_${{ matrix.architecture }} --clobber
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}

build_windows:
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- target: "32"
clangtarget: "i686"
- target: "64"
clangtarget: "x86_64"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install MinGW-w64
run: |
sudo apt-get install -y gcc-mingw-w64-i686 gcc-mingw-w64-x86-64
- name: Download and extract libusb and curl
run: |
mkdir -p include/libusb-1.0 && curl -L -o libusb.7z https://github.com/libusb/libusb/releases/download/v1.0.27/libusb-1.0.27.7z && 7z x -aoa -olibusb libusb.7z && rm libusb.7z && cp libusb/include/* include/libusb-1.0 && cp libusb/MinGW${{ matrix.arch.target }}/dll/* include/libusb-1.0 && rm -r libusb && mkdir -p include/curl && curl -L -o curl.zip https://curl.se/windows/dl-8.10.1_7/curl-8.10.1_7-win${{ matrix.arch.target }}-mingw.zip && unzip curl.zip && rm curl.zip && cp curl-8.10.1_7-win${{ matrix.arch.target }}-mingw/lib/* include/curl && cp curl-8.10.1_7-win${{ matrix.arch.target }}-mingw/include/curl/* include/curl && rm -r curl-8.10.1_7-win${{ matrix.arch.target }}-mingw
- name: Build Project
run: |
${{ matrix.arch.clangtarget }}-w64-mingw32-gcc -o miasst_windows_${{ matrix.arch.target }}.exe main.c libs/*.c -Iinclude -Linclude/curl -Linclude/libusb-1.0 -lcurl -lusb-1.0
- name: Upload Release Assets
run: |
gh release upload ${{ env.VERSION }} ./miasst_windows_${{ matrix.arch.target }}.exe --clobber
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
- name: Checkout code
uses: actions/checkout@v4

- name: Set up MSYS2
uses: msys2/setup-msys2@v2
with:
update: true
install: mingw-w64-x86_64-toolchain

- name: Install libusb
run: |
pacman -Syu --noconfirm
pacman -S --needed --noconfirm mingw-w64-x86_64-libusb
- name: Compile main.c
shell: msys2 {0}
run: |
gcc main.c -o miasst.exe -L/mingw64/lib -I/mingw64/include -lusb-1.0
- name: Verify the Build
shell: msys2 {0}
run: |
./main.exe

0 comments on commit e591723

Please sign in to comment.