|
| 1 | +# https://webui.me |
| 2 | +# https://github.com/webui-dev/webui |
| 3 | +# Copyright (c) 2020-2025 Hassan Draga. |
| 4 | +# Licensed under MIT License. |
| 5 | +# All rights reserved. |
| 6 | +# Canada. |
| 7 | + |
| 8 | +name: Linux-Arch |
| 9 | +on: |
| 10 | + workflow_call: |
| 11 | + |
| 12 | +jobs: |
| 13 | + setup: |
| 14 | + runs-on: archlinux |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + - name: Install Dependencies |
| 18 | + run: | |
| 19 | + sudo pacman -Syu --noconfirm npm |
| 20 | + - name: Bundle WebUI Bridge |
| 21 | + run: | |
| 22 | + npm i -g esbuild |
| 23 | + chmod +x bridge/build.sh |
| 24 | + bridge/build.sh |
| 25 | + - uses: actions/cache@v4 |
| 26 | + with: |
| 27 | + path: bridge/webui_bridge.h |
| 28 | + key: ${{ runner.os }}-${{ github.sha }}-bridge |
| 29 | + |
| 30 | + build: |
| 31 | + needs: setup |
| 32 | + runs-on: archlinux |
| 33 | + permissions: |
| 34 | + contents: write |
| 35 | + strategy: |
| 36 | + matrix: |
| 37 | + include: |
| 38 | + - cc: gcc |
| 39 | + arch: x64 |
| 40 | + - cc: clang |
| 41 | + arch: x64 |
| 42 | + fail-fast: false |
| 43 | + env: |
| 44 | + ARTIFACT: webui-linux-arch-${{ matrix.cc }}-${{ matrix.arch }} |
| 45 | + CC: ${{ matrix.cc }} |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@v4 |
| 48 | + - uses: actions/cache/restore@v4 |
| 49 | + with: |
| 50 | + path: bridge/webui_bridge.h |
| 51 | + key: ${{ runner.os }}-${{ github.sha }}-bridge |
| 52 | + fail-on-cache-miss: true |
| 53 | + - name: Install Build Tools |
| 54 | + run: | |
| 55 | + sudo pacman -Syu --noconfirm $CC make |
| 56 | + if [ "$CC" == "clang" ]; then |
| 57 | + sudo pacman -Syu --noconfirm llvm lld |
| 58 | + fi |
| 59 | + - name: Build Debug Target |
| 60 | + run: make debug |
| 61 | + - name: Build Release Target |
| 62 | + if: ${{ !cancelled() }} |
| 63 | + run: make |
| 64 | + - name: Build TLS Debug Target |
| 65 | + run: make WEBUI_USE_TLS=1 debug |
| 66 | + - name: Build TLS Release Target |
| 67 | + run: make WEBUI_USE_TLS=1 |
| 68 | + - name: Build Examples |
| 69 | + run: | |
| 70 | + examples_base_dir=$(pwd)/examples/C |
| 71 | + for example in $(find $examples_base_dir/* -maxdepth 0 -type d); do |
| 72 | + echo "> $example" |
| 73 | + cd $example || (exit_code=1 && continue) |
| 74 | + if ! make; then |
| 75 | + echo "Failed to build '$example'" |
| 76 | + exit_code=1 |
| 77 | + continue |
| 78 | + fi |
| 79 | + if [[ ! -e "main" || ! -e "main-dyn" ]] ; then |
| 80 | + echo "Failed to find executable for '$example'" && find . |
| 81 | + exit_code=1 |
| 82 | + continue |
| 83 | + fi |
| 84 | + done |
| 85 | + exit $exit_code |
| 86 | + - name: Prepare Artifact |
| 87 | + run: | |
| 88 | + cp -r include dist |
| 89 | + mv dist/ "$ARTIFACT" |
| 90 | + - name: Upload Artifact |
| 91 | + uses: actions/upload-artifact@v4 |
| 92 | + with: |
| 93 | + name: ${{ env.ARTIFACT }} |
| 94 | + path: ${{ env.ARTIFACT }} |
| 95 | + - name: Prepare Release |
| 96 | + if: > |
| 97 | + github.repository_owner == 'webui-dev' |
| 98 | + && (github.ref_type == 'tag' || (github.ref_name == 'main' && github.event_name == 'push')) |
| 99 | + run: | |
| 100 | + zip -r "$ARTIFACT.zip" "$ARTIFACT" |
| 101 | + if [ $GITHUB_REF_TYPE == tag ]; then |
| 102 | + echo "TAG=$GITHUB_REF_NAME" >> $GITHUB_ENV |
| 103 | + else |
| 104 | + { |
| 105 | + echo "IS_PRERELEASE=true"; |
| 106 | + echo "TAG=nightly"; |
| 107 | + echo "TITLE=WebUI Nightly Build $(date -u +'%Y-%m-%d %H:%M:%S UTC')" |
| 108 | + echo "BODY=Generated from commit $GITHUB_SHA." |
| 109 | + } >> $GITHUB_ENV |
| 110 | + fi |
| 111 | + - name: Update Nightly Tag |
| 112 | + if: env.IS_PRERELEASE |
| 113 | + uses: richardsimko/update-tag@v1 |
| 114 | + env: |
| 115 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 116 | + with: |
| 117 | + tag_name: nightly |
| 118 | + - name: Release |
| 119 | + if: > |
| 120 | + github.repository_owner == 'webui-dev' |
| 121 | + && (github.ref_type == 'tag' || (github.ref_name == 'main' && github.event_name == 'push')) |
| 122 | + uses: ncipollo/release-action@v1 |
| 123 | + with: |
| 124 | + artifacts: ${{ env.ARTIFACT }}.zip |
| 125 | + tag: ${{ env.TAG }} |
| 126 | + body: ${{ env.BODY }} |
| 127 | + name: ${{ env.TITLE }} |
| 128 | + prerelease: ${{ env.IS_PRERELEASE }} |
| 129 | + allowUpdates: true |
0 commit comments