Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
chenmozhijin committed Sep 22, 2024
1 parent 7626f1b commit 82c5621
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/action/prepare/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ runs:
using: "composite"
steps:
# 建立环境
- name: 移动文件
run: mv $GITHUB_WORKSPACE /opt/OpenWrt-K
- name: 复制文件
run: mkdir -p /opt/OpenWrt-K && cp -RT $GITHUB_WORKSPACE /opt/OpenWrt-K
shell: bash
- name: Setup Python
uses: actions/setup-python@v5
Expand Down
30 changes: 20 additions & 10 deletions .github/workflows/build-openwrt-py.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ jobs:

- name: 准备
id: run
run: PYTHONPATH=/opt/OpenWrt-K python3 -m build_helper --task prepare
working-directory: /opt/OpenWrt-K
run: python3 -m build_helper --task prepare

- name: 上传
uses: ./../../../../../opt/OpenWrt-K/.github/action/upload
Expand All @@ -59,7 +60,8 @@ jobs:

- name: 准备编译
id: prepare
run: PYTHONPATH=/opt/OpenWrt-K python3 -m build_helper --task build-prepare --config ${{ matrix.config }}
working-directory: /opt/OpenWrt-K
run: python3 -m build_helper --task build-prepare --config ${{ matrix.config }}

- name: 缓存toolchain
uses: actions/cache@v4
Expand All @@ -82,7 +84,8 @@ jobs:
- name: 编译
id: build
run: PYTHONPATH=/opt/OpenWrt-K python3 -m build_helper --task base-builds --config ${{ matrix.config }}
working-directory: /opt/OpenWrt-K
run: python3 -m build_helper --task base-builds --config ${{ matrix.config }}
env:
CACHE_HIT: ${{ steps.cache-toolchain.outputs.cache-hit }}

Expand All @@ -104,7 +107,8 @@ jobs:

- name: 准备编译
id: prepare
run: PYTHONPATH=/opt/OpenWrt-K python3 -m build_helper --task build-prepare --config ${{ matrix.config }}
working-directory: /opt/OpenWrt-K
run: python3 -m build_helper --task build-prepare --config ${{ matrix.config }}

- name: 缓存ccache
uses: actions/cache@v4
Expand All @@ -117,7 +121,8 @@ jobs:
- name: 编译
id: build
run: PYTHONPATH=/opt/OpenWrt-K python3 -m build_helper --task build_packages --config ${{ matrix.config }}
working-directory: /opt/OpenWrt-K
run: python3 -m build_helper --task build_packages --config ${{ matrix.config }}

- name: 上传
if: success() || failure()
Expand All @@ -137,7 +142,8 @@ jobs:

- name: 准备编译
id: prepare
run: PYTHONPATH=/opt/OpenWrt-K python3 -m build_helper --task build-prepare --config ${{ matrix.config }}
working-directory: /opt/OpenWrt-K
run: python3 -m build_helper --task build-prepare --config ${{ matrix.config }}

- name: 缓存ccache
uses: actions/cache@v4
Expand All @@ -150,7 +156,8 @@ jobs:
- name: 编译
id: build
run: PYTHONPATH=/opt/OpenWrt-K python3 -m build_helper --task build_image_builder --config ${{ matrix.config }}
working-directory: /opt/OpenWrt-K
run: python3 -m build_helper --task build_image_builder --config ${{ matrix.config }}

- name: 上传
if: success() || failure()
Expand All @@ -170,11 +177,13 @@ jobs:

- name: 准备构建
id: prepare
run: PYTHONPATH=/opt/OpenWrt-K python3 -m build_helper --task build-prepare --config ${{ matrix.config }}
working-directory: /opt/OpenWrt-K
run: python3 -m build_helper --task build-prepare --config ${{ matrix.config }}

- name: 构建
id: build
run: PYTHONPATH=/opt/OpenWrt-K python3 -m build_helper --task build_images --config ${{ matrix.config }}
working-directory: /opt/OpenWrt-K
run: python3 -m build_helper --task build_images --config ${{ matrix.config }}

- name: 上传
if: success() || failure()
Expand All @@ -192,4 +201,5 @@ jobs:
uses: ./.github/action/prepare

- name: 发布
run: PYTHONPATH=/opt/OpenWrt-K python3 -m build_helper --task releases --config ${{ matrix.config }}
working-directory: /opt/OpenWrt-K
run: python3 -m build_helper --task releases --config ${{ matrix.config }}
3 changes: 3 additions & 0 deletions build_helper/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ def apt(*args: str) -> None:
sudo("mount", "-o", "compress=zstd", lv_devname, paths.root)
sudo("chown", "-R", "runner:runner", paths.root)

if not os.path.exists(os.path.join(paths.root, ".github")):
os.makedirs(os.path.join(paths.root, ".github"))
os.symlink(os.path.join(paths.openwrt_k, ".github"), os.path.join(paths.root, ".github"))
# 打印剩余空间
total, used, free = shutil.disk_usage(paths.root)
logger.info(f"工作区空间使用情况: {used / (1024**3):.2f}/{total / (1024**3):.2f}GB,剩余: {free / (1024**3):.2f}GB")
Expand Down

0 comments on commit 82c5621

Please sign in to comment.