Skip to content

Commit d9af5b2

Browse files
committed
Adding Arch Linux Artifact
1 parent 27c877f commit d9af5b2

File tree

1 file changed

+124
-28
lines changed

1 file changed

+124
-28
lines changed

.github/workflows/linux_arch.yml

Lines changed: 124 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,130 @@ on:
1010
workflow_call:
1111

1212
jobs:
13-
build:
14-
runs-on: ubuntu-latest
13+
setup:
14+
runs-on: ubuntu-22.04
1515
steps:
16-
- name: Check out the repository
17-
uses: actions/checkout@v4
18-
19-
- name: Set up Docker Buildx
20-
uses: docker/setup-buildx-action@v2
21-
22-
- name: Build Arch Linux Docker Image
16+
- uses: actions/checkout@v4
17+
- name: Install Docker
18+
run: |
19+
sudo apt-get update
20+
sudo apt-get install -y docker.io
21+
sudo systemctl start docker
22+
sudo systemctl enable docker
23+
- name: Pull Arch Linux Docker Image
2324
run: |
24-
docker build -t archlinux:latest - <<EOF
25-
FROM archlinux:latest
26-
RUN pacman -Syu --noconfirm git npm make gcc clang llvm lld
27-
EOF
25+
docker pull archlinux:latest
26+
- name: Create and Start Arch Linux Container
27+
run: |
28+
docker run -d --name archlinux_container -v ${{ github.workspace }}:/workspace -w /workspace archlinux:latest tail -f /dev/null
29+
- name: Install Dependencies in Arch Linux Container
30+
run: |
31+
docker exec archlinux_container bash -c "
32+
pacman -Syu --noconfirm &&
33+
pacman -S --noconfirm base-devel git npm
34+
"
35+
- name: Bundle WebUI Bridge
36+
run: |
37+
docker exec archlinux_container bash -c "
38+
npm i -g esbuild &&
39+
chmod +x bridge/build.sh &&
40+
./bridge/build.sh
41+
"
42+
- uses: actions/cache@v4
43+
with:
44+
path: bridge/webui_bridge.h
45+
key: ${{ runner.os }}-${{ github.sha }}-bridge
2846

29-
- name: Run build inside Arch Linux container
30-
run: |
31-
docker run --rm \
32-
-v ${{ github.workspace }}:/workspace \
33-
-w /workspace \
34-
archlinux:latest \
35-
bash -c "
36-
npm i -g esbuild &&
37-
chmod +x bridge/build.sh &&
38-
./bridge/build.sh &&
39-
make debug &&
40-
make &&
41-
make WEBUI_USE_TLS=1 debug &&
42-
make WEBUI_USE_TLS=1
43-
"
47+
build:
48+
needs: setup
49+
runs-on: ubuntu-22.04
50+
permissions:
51+
contents: write
52+
strategy:
53+
matrix:
54+
include:
55+
- cc: gcc
56+
arch: x64
57+
- cc: clang
58+
arch: x64
59+
fail-fast: false
60+
env:
61+
ARTIFACT: webui-linux-arch-${{ matrix.cc }}-${{ matrix.arch }}
62+
CC: ${{ matrix.cc }}
63+
steps:
64+
- uses: actions/checkout@v4
65+
- uses: actions/cache/restore@v4
66+
with:
67+
path: bridge/webui_bridge.h
68+
key: ${{ runner.os }}-${{ github.sha }}-bridge
69+
fail-on-cache-miss: true
70+
- name: Install Build Tools in Arch Linux Container
71+
run: |
72+
docker exec archlinux_container bash -c "
73+
if [ \"$CC\" == \"clang\" ]; then
74+
pacman -S --noconfirm clang
75+
else
76+
pacman -S --noconfirm gcc
77+
fi
78+
"
79+
- name: Build Debug Target
80+
run: |
81+
docker exec archlinux_container bash -c "make debug"
82+
- name: Build Release Target
83+
if: ${{ !cancelled() }}
84+
run: |
85+
docker exec archlinux_container bash -c "make"
86+
- name: Build TLS Debug Target
87+
run: |
88+
docker exec archlinux_container bash -c "make WEBUI_USE_TLS=1 debug"
89+
- name: Build TLS Release Target
90+
run: |
91+
docker exec archlinux_container bash -c "make WEBUI_USE_TLS=1"
92+
- name: Prepare Artifact
93+
run: |
94+
docker exec archlinux_container bash -c "
95+
cp -r include dist &&
96+
mv dist/ \"$ARTIFACT\"
97+
"
98+
- name: Upload Artifact
99+
uses: actions/upload-artifact@v4
100+
with:
101+
name: ${{ env.ARTIFACT }}
102+
path: ${{ env.ARTIFACT }}
103+
- name: Prepare Release
104+
if: >
105+
github.repository_owner == 'webui-dev'
106+
&& (github.ref_type == 'tag' || (github.ref_name == 'main' && github.event_name == 'push'))
107+
run: |
108+
docker exec archlinux_container bash -c "
109+
zip -r \"$ARTIFACT.zip\" \"$ARTIFACT\"
110+
"
111+
if [ $GITHUB_REF_TYPE == tag ]; then
112+
echo "TAG=$GITHUB_REF_NAME" >> $GITHUB_ENV
113+
else
114+
{
115+
echo "IS_PRERELEASE=true";
116+
echo "TAG=nightly";
117+
echo "TITLE=WebUI Nightly Build $(date -u +'%Y-%m-%d %H:%M:%S UTC')";
118+
echo "BODY=Generated from commit $GITHUB_SHA.";
119+
} >> $GITHUB_ENV
120+
fi
121+
- name: Update Nightly Tag
122+
if: env.IS_PRERELEASE
123+
uses: richardsimko/update-tag@v1
124+
env:
125+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
126+
with:
127+
tag_name: nightly
128+
- name: Release
129+
if: >
130+
github.repository_owner == 'webui-dev'
131+
&& (github.ref_type == 'tag' || (github.ref_name == 'main' && github.event_name == 'push'))
132+
uses: ncipollo/release-action@v1
133+
with:
134+
artifacts: ${{ env.ARTIFACT }}.zip
135+
tag: ${{ env.TAG }}
136+
body: ${{ env.BODY }}
137+
name: ${{ env.TITLE }}
138+
prerelease: ${{ env.IS_PRERELEASE }}
139+
allowUpdates: true

0 commit comments

Comments
 (0)