Skip to content

Commit

Permalink
Add workflow for auto builds for GPL
Browse files Browse the repository at this point in the history
  • Loading branch information
Waujito committed Sep 10, 2024
1 parent 6dbb790 commit 3eaf3b6
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 4 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/build-gpl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Build GPL

on:
push:
# branches:
# - main
paths-ignore:
- 'README.md'

workflow_dispatch:


jobs:
build_gpl:
name: build ${{ matrix.gplv }}
runs-on: ubuntu-latest
strategy:
matrix:
include:
- gplv: ax1500v1
link: "https://static.tp-link.com/upload/gpl-code/2023/202303/20230319/ax1500v1_gpl_20230314.tar.gz"
# - gplv: ax1500v1.2
# link: "https://static.tp-link.com/upload/gpl-code/2023/202304/20230406/ax1500v1.20_gpl_20230404.tar.gz"
# - gplv: ax10v1
# link: "https://static.tp-link.com/resources/gpl/ax10v1_gpl_20200701.tar.gz"
#
# - gplv: ax10v1.2
# link: "https://static.tp-link.com/resources/gpl/ax10v1.20_gpl_20200701.tar.gz"
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Build docker image
run: |
docker pull waujito/tplax1500gpl:1.3
docker tag waujito/tplax1500gpl:1.3 router_build
- name: Prepare gpl code
run: |
wget -q -O router.tar.gz ${{ matrix.link }}
mkdir router
tar -xf router.tar.gz -C ./router
mv $(find ./router -maxdepth 2 -mindepth 2) ./router
- name: Patch gpl code
run: |
docker run --rm -v ./router:/router -w /router --user 1001 router_build bash -c "patch -p1 < ../router.patch"
docker run --rm -v ./router:/router -w /router --user 1001 router_build bash -c "mkdir -p Iplatform/openwrt/dl/ && cp /luci-0.11.1.tar.gz /router/Iplatform/openwrt/dl"
docker run --rm -v ./router:/router -w /router --user 1001 router_build bash -c "mkdir -p Iplatform/openwrt/dl/ && cp /mtd-utils-1.4.5.tar.gz /router/Iplatform/openwrt/dl"
docker run --rm -v ./router:/router -w /router --user 1001 router_build bash -c "mkdir -p Iplatform/openwrt/dl/ && cp /libubox-2013-07-04-11e8afea0f7eb34f8c23a8e589ee659c46f3f8aa.tar.gz /router/Iplatform/openwrt/dl"
- name: Build GPL
run: |
set -o pipefail
docker run --rm -v ./router:/router -w /router/Iplatform/build --user 1001 router_build bash -c "((make SHELL=/bin/bash V=s) || ((echo CONFIG_L2TP_IP=y >> ../../bcm675x/bcm963xx_router/kernel/linux-4.1/.config) && (echo CONFIG_L2TP_ETH=y >> ../../bcm675x/bcm963xx_router/kernel/linux-4.1/.config) && make SHELL=/bin/bash V=s))" | tee build.log
- name: Compress built GPL
run: |
tar -czf gpl-${{ matrix.gplv }}.tar.gz router
- name: Upload built GPL
uses: actions/upload-artifact@v4
with:
name: gpl-${{ matrix.gplv }}
path: ./gpl-${{ matrix.gplv }}.tar.gz

- name: Upload build log
if: always()
uses: actions/upload-artifact@v4
with:
name: logs-${{ matrix.gplv }}
path: ./build.log
28 changes: 24 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
FROM ubuntu:24.04 AS downloader

RUN apt-get update
RUN apt-get install -y curl wget git tar

# This archive should be copied to /Iplatform/openwrt/dl/ (prehaps a dl dir should be created)
# https://git.codelinaro.org Is the gitlab mirror after codeaurora has been turned off.
# This archibe points to the luci commit hash specified in the GPL sources (as of June 2024)
RUN wget https://git.codelinaro.org/clo/qsdk/luci/-/archive/1cdab340cd5ed15be8f25d9fe97accda9ac62ee2/luci-1cdab340cd5ed15be8f25d9fe97accda9ac62ee2.tar.gz -O luci-0.11.1.tar.gz

RUN git clone git://git.infradead.org/mtd-utils.git mtd-utils-1.4.5 --recursive && cd mtd-utils-1.4.5 && git remote -v && git checkout 5319b84974fcb71504aed2d1b8285e9c0a4a4bb8


RUN rm -rf mtd-utils-1.4.5/.git && /bin/tar cfz mtd-utils-1.4.5.tar.gz mtd-utils-1.4.5

RUN git clone git://nbd.name/luci2/libubox.git libubox-2013-07-04 --recursive && (cd libubox-2013-07-04 && git remote -v && git checkout 11e8afea0f7eb34f8c23a8e589ee659c46f3f8aa) && rm -rf libubox-2013-07-04/.git && /bin/tar cfz libubox-2013-07-04-11e8afea0f7eb34f8c23a8e589ee659c46f3f8aa.tar.gz libubox-2013-07-04


FROM ubuntu:12.04 AS environment
WORKDIR /

Expand All @@ -12,22 +30,24 @@ RUN apt-get install -y libtool cmake libproxy-dev uuid-dev liblzo2-dev autoconf

# We need user because of GPL make requires non-root user
RUN useradd ubuntu -s /bin/bash -m
RUN useradd github_ci -u 1001 -s /bin/bash -m

# We should add user to dip group to get access to pppd suid-based package
RUN usermod -aG dip ubuntu
RUN usermod -aG dip github_ci

# Add user to the sudoers file (We do not need any security inside the docker container)
RUN printf 'ubuntu\tALL=(ALL:ALL)\tNOPASSWD:ALL\n' >> /etc/sudoers
RUN printf 'github_ci\tALL=(ALL:ALL)\tNOPASSWD:ALL\n' >> /etc/sudoers

# Dont ask why
RUN ln -s /usr/sbin/zic /usr/bin/zic

# Patches that should be applied to the sources.
COPY router.patch /

# This archive should be copied to /Iplatform/openwrt/dl/ (prehaps a dl dir should be created)
# https://git.codelinaro.org Is the gitlab mirror after codeaurora has been turned off.
# This archibe points to the luci commit hash specified in the GPL sources (as of June 2024)
RUN wget https://git.codelinaro.org/clo/qsdk/luci/-/archive/1cdab340cd5ed15be8f25d9fe97accda9ac62ee2/luci-1cdab340cd5ed15be8f25d9fe97accda9ac62ee2.tar.gz -O luci-0.11.1.tar.gz
COPY --from=downloader luci-0.11.1.tar.gz .
COPY --from=downloader mtd-utils-1.4.5.tar.gz .
COPY --from=downloader libubox-2013-07-04-11e8afea0f7eb34f8c23a8e589ee659c46f3f8aa.tar.gz .

CMD [ "/bin/bash", "-c", "sudo -iu ubuntu" ]

0 comments on commit 3eaf3b6

Please sign in to comment.