Skip to content

Commit

Permalink
add workflow
Browse files Browse the repository at this point in the history
add auto compile passwall with openwrt sdk
  • Loading branch information
smallprogram committed Apr 3, 2023
1 parent c3cf36f commit 04c0a4c
Showing 1 changed file with 349 additions and 0 deletions.
349 changes: 349 additions & 0 deletions .github/workflows/Auto compile with openwrt sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,349 @@
#
# Copyright (c) 2022-2023 SMALLPROGRAM <https://github.com/smallprogram>
# Description: Auto compile
#
name: "Auto compile with openwrt sdk"
on:
repository_dispatch:
workflow_dispatch:
inputs:
ssh:
description: 'SSH connection to Actions'
required: false
default: 'false'
# schedule:
# - cron: "0 */4 * * *"
env:
TZ: Asia/Shanghai


jobs:
job_auto_compile:
runs-on: ubuntu-latest
name: build (${{ matrix.platform }})
strategy:
fail-fast: false
matrix:
include:
- platform: x86_64
url_sdk: https://downloads.openwrt.org/snapshots/targets/x86/64/openwrt-sdk-x86-64_gcc-12.2.0_musl.Linux-x86_64.tar.xz

# - platform: zynq_generic
# url_sdk: https://downloads.openwrt.org/snapshots/targets/zynq/generic/openwrt-sdk-zynq-generic_gcc-12.2.0_musl_eabi.Linux-x86_64.tar.xz

- platform: sunxi_cortexa53
url_sdk: https://downloads.openwrt.org/snapshots/targets/sunxi/cortexa53/openwrt-sdk-sunxi-cortexa53_gcc-12.2.0_musl.Linux-x86_64.tar.xz

- platform: sunxi_cortexa7
url_sdk: https://downloads.openwrt.org/snapshots/targets/sunxi/cortexa7/openwrt-sdk-sunxi-cortexa7_gcc-12.2.0_musl_eabi.Linux-x86_64.tar.xz

- platform: sunxi_cortexa8
url_sdk: https://downloads.openwrt.org/snapshots/targets/sunxi/cortexa8/openwrt-sdk-sunxi-cortexa8_gcc-12.2.0_musl_eabi.Linux-x86_64.tar.xz

- platform: rockchip_armv8
url_sdk: https://downloads.openwrt.org/snapshots/targets/rockchip/armv8/openwrt-sdk-rockchip-armv8_gcc-12.2.0_musl.Linux-x86_64.tar.xz

- platform: realtek_rtl838x
url_sdk: https://downloads.openwrt.org/snapshots/targets/realtek/rtl838x/openwrt-sdk-realtek-rtl838x_gcc-12.2.0_musl.Linux-x86_64.tar.xz

- platform: realtek_rtl839x
url_sdk: https://downloads.openwrt.org/snapshots/targets/realtek/rtl839x/openwrt-sdk-realtek-rtl839x_gcc-12.2.0_musl.Linux-x86_64.tar.xz

- platform: realtek_rtl930x
url_sdk: https://downloads.openwrt.org/snapshots/targets/realtek/rtl930x/openwrt-sdk-realtek-rtl930x_gcc-12.2.0_musl.Linux-x86_64.tar.xz

- platform: realtek_rtl931x
url_sdk: https://downloads.openwrt.org/snapshots/targets/realtek/rtl931x/openwrt-sdk-realtek-rtl931x_gcc-12.2.0_musl.Linux-x86_64.tar.xz

- platform: ramips_mt7620
url_sdk: https://downloads.openwrt.org/snapshots/targets/ramips/mt7620/openwrt-sdk-ramips-mt7620_gcc-12.2.0_musl.Linux-x86_64.tar.xz

- platform: ramips_mt7621
url_sdk: https://downloads.openwrt.org/snapshots/targets/ramips/mt7621/openwrt-sdk-ramips-mt7621_gcc-12.2.0_musl.Linux-x86_64.tar.xz

- platform: ramips_rt288x
url_sdk: https://downloads.openwrt.org/releases/22.03.3/targets/ramips/rt288x/openwrt-sdk-22.03.3-ramips-rt288x_gcc-11.2.0_musl.Linux-x86_64.tar.xz

- platform: ramips_rt305x
url_sdk: https://downloads.openwrt.org/releases/22.03.3/targets/ramips/rt305x/openwrt-sdk-22.03.3-ramips-rt305x_gcc-11.2.0_musl.Linux-x86_64.tar.xz

- platform: ramips_rt3883
url_sdk: https://downloads.openwrt.org/releases/22.03.3/targets/ramips/rt3883/openwrt-sdk-22.03.3-ramips-rt3883_gcc-11.2.0_musl.Linux-x86_64.tar.xz

- platform: ramips_mt76x8
url_sdk: https://downloads.openwrt.org/releases/22.03.3/targets/ramips/mt76x8/openwrt-sdk-22.03.3-ramips-mt76x8_gcc-11.2.0_musl.Linux-x86_64.tar.xz

# - platform: pistachio_generic
# url_sdk: https://downloads.openwrt.org/releases/22.03.3/targets/pistachio/generic/openwrt-sdk-22.03.3-pistachio_gcc-11.2.0_musl.Linux-x86_64.tar.xz

# - platform: oxnas_ox820
# url_sdk: https://downloads.openwrt.org/releases/22.03.3/targets/oxnas/ox820/openwrt-sdk-22.03.3-oxnas-ox820_gcc-11.2.0_musl_eabi.Linux-x86_64.tar.xz

# - platform: omap_generic
# url_sdk: https://downloads.openwrt.org/releases/22.03.3/targets/omap/generic/openwrt-sdk-22.03.3-omap_gcc-11.2.0_musl_eabi.Linux-x86_64.tar.xz

# - platform: octeontx_generic
# url_sdk: https://downloads.openwrt.org/releases/22.03.3/targets/octeontx/generic/openwrt-sdk-22.03.3-octeontx_gcc-11.2.0_musl.Linux-x86_64.tar.xz

# - platform: octeon_generic
# url_sdk: https://downloads.openwrt.org/releases/22.03.3/targets/octeon/generic/openwrt-sdk-22.03.3-octeon-generic_gcc-11.2.0_musl.Linux-x86_64.tar.xz

# - platform: mxs_generic
# url_sdk: https://downloads.openwrt.org/releases/22.03.3/targets/mxs/generic/openwrt-sdk-22.03.3-mxs_gcc-11.2.0_musl_eabi.Linux-x86_64.tar.xz

- platform: mvebu_cortexa53
url_sdk: https://downloads.openwrt.org/releases/22.03.3/targets/mvebu/cortexa53/openwrt-sdk-22.03.3-mvebu-cortexa53_gcc-11.2.0_musl.Linux-x86_64.tar.xz

# - platform: mvebu_cortexa72
# url_sdk: https://downloads.openwrt.org/releases/22.03.3/targets/mvebu/cortexa72/openwrt-sdk-22.03.3-mvebu-cortexa72_gcc-11.2.0_musl.Linux-x86_64.tar.xz

- platform: mvebu_cortexa9
url_sdk: https://downloads.openwrt.org/releases/22.03.3/targets/mvebu/cortexa9/openwrt-sdk-22.03.3-mvebu-cortexa9_gcc-11.2.0_musl_eabi.Linux-x86_64.tar.xz

# - platform: mpc85xx_p1010
# url_sdk: https://downloads.openwrt.org/releases/22.03.3/targets/mpc85xx/p1010/openwrt-sdk-22.03.3-mpc85xx-p1010_gcc-11.2.0_musl.Linux-x86_64.tar.xz

# - platform: mpc85xx_p1020
# url_sdk: https://downloads.openwrt.org/releases/22.03.3/targets/mpc85xx/p1020/openwrt-sdk-22.03.3-mpc85xx-p1020_gcc-11.2.0_musl.Linux-x86_64.tar.xz

# - platform: mpc85xx_p2020
# url_sdk: https://downloads.openwrt.org/releases/22.03.3/targets/mpc85xx/p2020/openwrt-sdk-22.03.3-mpc85xx-p2020_gcc-11.2.0_musl.Linux-x86_64.tar.xz

- platform: mediatek_mt7622
url_sdk: https://downloads.openwrt.org/releases/22.03.3/targets/mediatek/mt7622/openwrt-sdk-22.03.3-mediatek-mt7622_gcc-11.2.0_musl.Linux-x86_64.tar.xz

- platform: mediatek_mt7623
url_sdk: https://downloads.openwrt.org/releases/22.03.3/targets/mediatek/mt7623/openwrt-sdk-22.03.3-mediatek-mt7623_gcc-11.2.0_musl_eabi.Linux-x86_64.tar.xz

- platform: mediatek_mt7629
url_sdk: https://downloads.openwrt.org/releases/22.03.3/targets/mediatek/mt7629/openwrt-sdk-22.03.3-mediatek-mt7629_gcc-11.2.0_musl_eabi.Linux-x86_64.tar.xz

# - platform: malta_be
# url_sdk: https://downloads.openwrt.org/releases/22.03.3/targets/malta/be/openwrt-sdk-22.03.3-malta-be_gcc-11.2.0_musl.Linux-x86_64.tar.xz

- platform: layerscape_armv7
url_sdk: https://downloads.openwrt.org/releases/22.03.3/targets/layerscape/armv7/openwrt-sdk-22.03.3-layerscape-armv7_gcc-11.2.0_musl_eabi.Linux-x86_64.tar.xz

- platform: layerscape_armv8_64b
url_sdk: https://downloads.openwrt.org/releases/22.03.3/targets/layerscape/armv8_64b/openwrt-sdk-22.03.3-layerscape-armv8_64b_gcc-11.2.0_musl.Linux-x86_64.tar.xz

# - platform: lantiq_ase
# url_sdk: https://downloads.openwrt.org/releases/22.03.3/targets/lantiq/ase/openwrt-sdk-22.03.3-lantiq-ase_gcc-11.2.0_musl.Linux-x86_64.tar.xz

# - platform: lantiq_xrx200
# url_sdk: https://downloads.openwrt.org/releases/22.03.3/targets/lantiq/xrx200/openwrt-sdk-22.03.3-lantiq-xrx200_gcc-11.2.0_musl.Linux-x86_64.tar.xz

# - platform: lantiq_xway
# url_sdk: https://downloads.openwrt.org/releases/22.03.3/targets/lantiq/xway/openwrt-sdk-22.03.3-lantiq-xway_gcc-11.2.0_musl.Linux-x86_64.tar.xz

# - platform: lantiq_xway_legacy
# url_sdk: https://downloads.openwrt.org/releases/22.03.3/targets/lantiq/xway_legacy/openwrt-sdk-22.03.3-lantiq-xway_legacy_gcc-11.2.0_musl.Linux-x86_64.tar.xz



# 写不动了,估计matrix的并发数量也有限制,各位有精力可以帮忙维护一下
# - platform:
# url_sdk:

# - platform:
# url_sdk:

# - platform:
# url_sdk:

# - platform:
# url_sdk:

# - platform:
# url_sdk:

# - platform:
# url_sdk:

# - platform:
# url_sdk:

# - platform:
# url_sdk:

# - platform:
# url_sdk:

# - platform:
# url_sdk:

# - platform:
# url_sdk:

# - platform:
# url_sdk:

# - platform:
# url_sdk:

# - platform:
# url_sdk:

# - platform:
# url_sdk:

# - platform:
# url_sdk:





steps:
- name: Initialization ${{ matrix.platform }} compile environment
run: |
echo "install packages!!!!!!"
sudo -E apt-get -qq update
sudo -E apt-get -qq install $(curl -fsSL https://github.com/smallprogram/OpenWrtAction/raw/main/diy_script/official_dependence)
sudo -E apt-get -qq autoremove --purge
sudo -E apt-get -qq clean
- name: Checkout
uses: actions/checkout@main
with:
fetch-depth: 0
ref: 'luci'

- name: ${{ matrix.platform }} sdk download
run: |
wget ${{ matrix.url_sdk }}
file_name=$(echo ${{matrix.url_sdk}} | awk -F/ '{print $NF}')
mkdir sdk && tar -xJf $file_name -C ./sdk --strip-components=1
cd sdk
- name: SSH connection to Actions
uses: mxschmitt/[email protected]
if: (github.event.inputs.ssh == 'true' && github.event.inputs.ssh != 'false') || contains(github.event.action, 'ssh')

- name: ${{ matrix.platform }} feeds configuration
run: |
cd sdk
echo "src-git passwall_packages https://github.com/xiaorouji/openwrt-passwall.git;packages" >> feeds.conf.default
echo "src-git passwall_luci https://github.com/xiaorouji/openwrt-passwall.git;luci" >> feeds.conf.default
./scripts/feeds update -a
./scripts/feeds install -a -f -p passwall_packages
./scripts/feeds install luci-app-passwall
echo "CONFIG_PACKAGE_luci-app-passwall=m" >> .config
echo "CONFIG_PACKAGE_luci-app-passwall_Iptables_Transparent_Proxy=y" >> .config
echo "CONFIG_PACKAGE_luci-app-passwall_Nftables_Transparent_Proxy=y" >> .config
echo "CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Brook=y" >> .config
echo "CONFIG_PACKAGE_luci-app-passwall_INCLUDE_ChinaDNS_NG=y" >> .config
echo "CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Haproxy=y" >> .config
echo "CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Hysteria=y" >> .config
echo "CONFIG_PACKAGE_luci-app-passwall_INCLUDE_NaiveProxy=y" >> .config
echo "CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Shadowsocks_Libev_Client=y" >> .config
echo "CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Shadowsocks_Libev_Server=y" >> .config
echo "CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Shadowsocks_Rust_Client=y" >> .config
echo "CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Shadowsocks_Rust_Server=y" >> .config
echo "CONFIG_PACKAGE_luci-app-passwall_INCLUDE_ShadowsocksR_Libev_Client=y" >> .config
echo "CONFIG_PACKAGE_luci-app-passwall_INCLUDE_ShadowsocksR_Libev_Server=y" >> .config
echo "CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Simple_Obfs=y" >> .config
echo "CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Trojan_GO=y" >> .config
echo "CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Trojan_Plus=y" >> .config
echo "CONFIG_PACKAGE_luci-app-passwall_INCLUDE_V2ray=y" >> .config
echo "CONFIG_PACKAGE_luci-app-passwall_INCLUDE_V2ray_Geodata=y" >> .config
echo "CONFIG_PACKAGE_luci-app-passwall_INCLUDE_V2ray_Plugin=y" >> .config
echo "CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Xray=y" >> .config
echo "CONFIG_PACKAGE_luci-app-passwall_INCLUDE_Xray_Plugin=y" >> .config
make defconfig
- name: ${{ matrix.platform }} download
run: |
cd sdk
make download -j8
find dl -size -1024c -exec ls -l {} \;
- name: ${{ matrix.platform }} compile
id: compile
run: |
cd sdk
make package/luci-app-passwall/{clean,compile} -j$(($(nproc)))
echo "status=success" >> $GITHUB_OUTPUT
- name: Organize ${{ matrix.platform }} files
id: organize
if: steps.compile.outputs.status == 'success'
run: |
cd sdk
zip -r passwall_ipk_${{ matrix.platform }}.zip bin/packages/
echo "FIRMWARE=$PWD" >> $GITHUB_ENV
echo "status=success" >> $GITHUB_OUTPUT
- name: Generate release tag
id: tag
if: steps.compile.outputs.status == 'success'
run: |
cd sdk
echo "## :mega:Update content" >> release.txt
psw_version=$(sed -n '9,10p' feeds/passwall_luci/luci-app-passwall/Makefile | awk -F':=' '{ORS="-"}{print $2}' | sed 's/-$/\n/')
echo "PASSWALL_VERSION=$psw_version" >> $GITHUB_ENV
cd feeds/passwall_luci
git_head=$(git rev-parse --short HEAD)
echo "GIT_HEAD=$git_head" >> $GITHUB_ENV
cd ..
cd ..
echo "![](https://img.shields.io/github/downloads/xiaorouji/openwrt-passwall/$psw_version_$git_head/total?style=flat-square)" >> release.txt
echo "### Passwall Version" >> release.txt
echo "**:minidisc: Passwall Version: $psw_version**" >> release.txt
echo "### Packages Version" >> release.txt
echo "**package name**|**package version**" >> release.txt
echo "-|-" >> release.txt
echo "**:ice_cube: brook:**|**$(sed -n '8p' feeds/passwall_packages/brook/Makefile | cut -d'=' -f2)**" >> release.txt
echo "**:ice_cube: chinadns-ng:**|**$(sed -n '8p' feeds/passwall_packages/chinadns-ng/Makefile | cut -d'=' -f2)**" >> release.txt
echo "**:ice_cube: dns2socks:**|**$(sed -n '8p' feeds/passwall_packages/dns2socks/Makefile | cut -d'=' -f2)**" >> release.txt
echo "**:ice_cube: dns2tcp:**|**$(sed -n '8p' feeds/passwall_packages/dns2tcp/Makefile | cut -d'=' -f2)**" >> release.txt
echo "**:ice_cube: gn:**|**$(sed -n '12p' feeds/passwall_packages/gn/Makefile | awk -F':=' '{print $2}' | tr -d '[:space:]')**" >> release.txt
echo "**:ice_cube: hysteria:**|**$(sed -n '8p' feeds/passwall_packages/hysteria/Makefile | cut -d'=' -f2)**" >> release.txt
echo "**:ice_cube: ipt2socks:**|**$(sed -n '8p' feeds/passwall_packages/ipt2socks/Makefile | cut -d'=' -f2)**" >> release.txt
echo "**:ice_cube: microsocks:**|**$(sed -n '8p' feeds/passwall_packages/microsocks/Makefile | cut -d'=' -f2)**" >> release.txt
echo "**:ice_cube: naiveproxy:**|**$(sed -n '8p' feeds/passwall_packages/naiveproxy/Makefile | cut -d'=' -f2)**" >> release.txt
echo "**:ice_cube: pdnsd-alt:**|**$(sed -n '8p' feeds/passwall_packages/pdnsd-alt/Makefile | cut -d'=' -f2)**" >> release.txt
echo "**:ice_cube: shadowsocks-rust:**|**$(sed -n '9p' feeds/passwall_packages/shadowsocks-rust/Makefile | cut -d'=' -f2)**" >> release.txt
echo "**:ice_cube: shadowsocksr-libev:**|**$(sed -n '10p' feeds/passwall_packages/shadowsocksr-libev/Makefile | cut -d'=' -f2)**" >> release.txt
echo "**:ice_cube: simple-obfs:**|**$(sed -n '11p' feeds/passwall_packages/simple-obfs/Makefile | cut -d'=' -f2)**" >> release.txt
echo "**:ice_cube: sing-box:**|**$(sed -n '9p' feeds/passwall_packages/sing-box/Makefile | cut -d'=' -f2)**" >> release.txt
echo "**:ice_cube: ssocks:**|**$(sed -n '14p' feeds/passwall_packages/ssocks/Makefile | cut -d'=' -f2)**" >> release.txt
echo "**:ice_cube: tcping:**|**$(sed -n '12p' feeds/passwall_packages/tcping/Makefile | cut -d'=' -f2)**" >> release.txt
echo "**:ice_cube: trojan-go:**|**$(sed -n '8p' feeds/passwall_packages/trojan-go/Makefile | cut -d'=' -f2)**" >> release.txt
echo "**:ice_cube: trojan-plus:**|**$(sed -n '10p' feeds/passwall_packages/trojan-plus/Makefile | cut -d'=' -f2)**" >> release.txt
echo "**:ice_cube: trojan:**|**$(sed -n '10p' feeds/passwall_packages/trojan/Makefile | cut -d'=' -f2)**" >> release.txt
echo "**:ice_cube: v2ray-core:**|**$(sed -n '8p' feeds/passwall_packages/v2ray-core/Makefile | cut -d'=' -f2)**" >> release.txt
echo "**:ice_cube: v2ray-geoip:**|**$(sed -n '15p' feeds/passwall_packages/v2ray-geodata/Makefile | cut -d'=' -f2)**" >> release.txt
echo "**:ice_cube: v2ray-geosite:**|**$(sed -n '24p' feeds/passwall_packages/v2ray-geodata/Makefile | cut -d'=' -f2)**" >> release.txt
echo "**:ice_cube: v2ray-plugin:**|**$(sed -n '9p' feeds/passwall_packages/v2ray-plugin/Makefile | cut -d'=' -f2)**" >> release.txt
echo "**:ice_cube: xray-core:**|**$(sed -n '4p' feeds/passwall_packages/xray-core/Makefile | cut -d'=' -f2)**" >> release.txt
echo "**:ice_cube: xray-plugin:**|**$(sed -n '8p' feeds/passwall_packages/xray-plugin/Makefile | cut -d'=' -f2)**" >> release.txt
touch release.txt
echo "status=success" >> $GITHUB_OUTPUT
- name: Upload firmware to release
uses: softprops/action-gh-release@v1
if: steps.tag.outputs.status == 'success'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.PASSWALL_VERSION }}_${{ env.GIT_HEAD }}
body_path: ${{ env.FIRMWARE }}/release.txt
files: ${{ env.FIRMWARE }}/passwall_ipk_${{ matrix.platform }}.zip

0 comments on commit 04c0a4c

Please sign in to comment.