Skip to content
This repository has been archived by the owner on Sep 13, 2024. It is now read-only.

Commit

Permalink
Improve OWRT package building
Browse files Browse the repository at this point in the history
  • Loading branch information
RoEdAl committed Jul 24, 2023
1 parent 560e6a3 commit 5e1bc97
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 39 deletions.
21 changes: 12 additions & 9 deletions .github/actions/install-openwrt-sdk/action.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
name: Download OpenWRT SDK
description: Download, extract and prepare OpenWRT SDK for specific target (architecture)
description: Download, extract and prepare OpenWRT SDK for specific target
inputs:
openwrt-version:
required: true
description: OpenWRT version
arch:
target:
required: true
description: Target name
description: Target-subtarget pair
arch:
required: false
description: Archtecture name
eabi:
required: false
description: EABI
default: false
runs:
using: composite
steps:
- name: Restore OpenWRT SDK from cache
- name: Restore OpenWRT SDK from cache (${{ inputs.arch }})
id: cache-owrt-sdk-restore
uses: actions/cache/restore@v3
with:
path: owrtsdk
key: openwrt-sdk-${{ inputs.openwrt-version }}-${{ inputs.arch }}
key: openwrt-sdk-${{ inputs.openwrt-version }}-${{ inputs.target }}

- name: Prepare OpenWRT SDK directory
id: prepare-owrt-sdk-dir
Expand All @@ -32,25 +35,25 @@ runs:
if: steps.cache-owrt-sdk-restore.outputs.cache-hit != 'true' && inputs.eabi == 'true'
shell: bash
working-directory: owrtsdk
run: ${{ github.action_path }}/download-owrt-sdk.sh ${{ inputs.arch }} ${{ inputs.openwrt-version }} openwrt-sdk-${{ inputs.openwrt-version }}-${{ inputs.arch }}_gcc-11.2.0_musl_eabi.Linux-x86_64
run: ${{ github.action_path }}/download-owrt-sdk.sh ${{ inputs.target }} ${{ inputs.openwrt-version }} openwrt-sdk-${{ inputs.openwrt-version }}-${{ inputs.target }}_gcc-11.2.0_musl_eabi.Linux-x86_64

- name: Download OpenWRT SDK
id: download-owrt-sdk
if: steps.cache-owrt-sdk-restore.outputs.cache-hit != 'true' && inputs.eabi != 'true'
shell: bash
working-directory: owrtsdk
run: ${{ github.action_path }}/download-owrt-sdk.sh ${{ inputs.arch }} ${{ inputs.openwrt-version }} openwrt-sdk-${{ inputs.openwrt-version }}-${{ inputs.arch }}_gcc-11.2.0_musl.Linux-x86_64
run: ${{ github.action_path }}/download-owrt-sdk.sh ${{ inputs.target }} ${{ inputs.openwrt-version }} openwrt-sdk-${{ inputs.openwrt-version }}-${{ inputs.target }}_gcc-11.2.0_musl.Linux-x86_64

- name: Prepare OpenWRT SDK
id: prepare-owrt-sdk
if: steps.cache-owrt-sdk-restore.outputs.cache-hit != 'true'
shell: bash
working-directory: owrtsdk/${{ inputs.arch }}
working-directory: owrtsdk/${{ inputs.target }}
run: |
./scripts/feeds update -a
./scripts/feeds install -a
- name: Cache OpenWRT SDK
- name: Cache OpenWRT SDK (${{ inputs.arch }})
id: cache-owrt-sdk-save
if: steps.cache-owrt-sdk-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
Expand Down
82 changes: 52 additions & 30 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,12 @@ jobs:
env:
DEBIAN_FRONTEND: noninteractive
run: sudo apt-get install -qq lintian

- name: Configure project
run: cmake -P make-build-dir.cmake

- name: Build packages
run: cmake -P make-package.cmake

- name: Check package
run: lintian --verbose --info package/asterisk-chan-quectel_*.deb

- name: Archive DEB
uses: actions/upload-artifact@v3
with:
Expand All @@ -60,7 +56,6 @@ jobs:
package/asterisk-chan-quectel_*.deb.sha256
retention-days: 1
if-no-files-found: error

- name: Archive TAR.GZ
uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -88,7 +83,7 @@ jobs:
run: |
for p in $(ls *.deb); do
echo "::notice::Installing package $p"
sudo gdebi --non-interactive $p
sudo gdebi --non-interactive $p || echo "::error::Could not install package $p"
done
build-deb-pkg-arch:
Expand Down Expand Up @@ -158,23 +153,58 @@ jobs:
env: |
DEBIAN_FRONTEND: noninteractive
run: |
gdebi --non-interactive package/asterisk-chan-quectel_*.deb || echo "::error::Could not install package ${{ matrix.arch }}"
for p in $(ls package/*.deb); do
pn=$(basename $p)
echo "::notice::Installing package $pn"
gdebi --non-interactive $p || echo "::error::Could not install package $pn"
done
build-openwrt-pkg:
runs-on: ubuntu-latest
needs: pre-build
strategy:
matrix:
arch: [x86-64, x86-generic, ramips-mt7620, bcm47xx-generic, bcm63xx-generic, sunxi-cortexa7, sunxi-cortexa8, sunxi-cortexa53, armvirt-32, rockchip-armv8, bcm27xx-bcm2708]
include:
- arch: sunxi-cortexa7
- target: x86-64
arch: x86_64
- target: x86-generic
arch: i386
cpu-type: pentium4
- target: ramips-mt7620
arch: mipsel
cpu-type: 24kc
- target: bcm47xx-generic
arch: mipsel
cpu-type: mips32
- target: bcm63xx-generic
arch: mips
cpu-type: mips32
- target: armvirt-32
arch: arm
cpu-type: cortex-a15
cpu-subtype: neon-vfpv4
eabi: true
- arch: sunxi-cortexa8
- target: rockchip-armv8
arch: aarch64
cpu-type: generic
- target: bcm27xx-bcm2708
arch: arm
cpu-type: arm1176jzf-s
cpu-subtype: vfp
eabi: true
- arch: bcm27xx-bcm2708
- target: sunxi-cortexa7
arch: arm
cpu-type: cortex-a7
cpu-subtype: neon-vfpv4
eabi: true
- arch: armvirt-32
- target: sunxi-cortexa8
arch: arm
cpu-type: cortex-a8
cpu-subtype: vfpv3
eabi: true
- target: sunxi-cortexa53
arch: aarch64
cpu-type: cortex-a53
steps:
- name: Checkout actions
uses: actions/checkout@v3
Expand All @@ -186,49 +216,43 @@ jobs:
- uses: ./.github/actions/install-openwrt-sdk
with:
openwrt-version: ${{ env.OWRTVER }}
target: ${{ matrix.target }}
arch: ${{ matrix.arch }}
eabi: ${{ matrix.eabi }}
- uses: actions/checkout@v3
with:
fetch-depth: 0
path: asterisk-modules/asterisk-chan-quectel

- name: Configure project
run: cmake -P asterisk-modules/asterisk-chan-quectel/make-build-dir.cmake

- name: Generate OpenWRT Makefile
run: cmake -P asterisk-modules/asterisk-chan-quectel/install-openwrt-makefile.cmake

- name: Check OpenWRT SDK config file
- name: Check OpenWRT SDK config file existience
id: check-owrt-cfg
uses: andstor/file-existence-action@v2
with:
files: "owrtsdk/${{ matrix.arch }}/.config"

files: "owrtsdk/${{ matrix.target }}/.config"
- name: Prepare OpenWRT SDK (symlink)
run: |
owrtsdk=$(cd owrtsdk; pwd)
cd asterisk-modules/asterisk-chan-quectel/install/openwrt
ln -sf ${owrtsdk}/${{ matrix.arch }} ${{ matrix.arch }}
ln -sf ${owrtsdk}/${{ matrix.target }} ${{ matrix.target }}
- name: Prepare OpenWRT SDK (files)
if: steps.check-owrt-cfg.outputs.files_exists != 'true'
working-directory: asterisk-modules/asterisk-chan-quectel/install/openwrt
run: cp feeds-strskx.conf diffconfig build-opk.sh ${{ matrix.arch }}

run: cp feeds-strskx.conf diffconfig build-opk.sh ${{ matrix.target }}
- name: Prepare OpenWRT SDK (feeds)
if: steps.check-owrt-cfg.outputs.files_exists == 'true'
working-directory: asterisk-modules/asterisk-chan-quectel/install/openwrt/${{ matrix.arch }}
working-directory: asterisk-modules/asterisk-chan-quectel/install/openwrt/${{ matrix.target }}
run: ./scripts/feeds install asterisk-chan-quectel

- name: Build OpenWRT packages
working-directory: asterisk-modules/asterisk-chan-quectel/install/openwrt/${{ matrix.arch }}
working-directory: asterisk-modules/asterisk-chan-quectel/install/openwrt/${{ matrix.target }}
run: ./build-opk.sh
- name: Archive IPK
uses: actions/upload-artifact@v3
with:
name: ipk-${{ matrix.arch }}
path: asterisk-modules/asterisk-chan-quectel/install/openwrt/${{ matrix.arch }}/bin/packages/*/strskx/*.ipk
name: pkg-ipk-${{ format('{0}{1}{2}', matrix.arch, matrix.cpu-type && format('_{0}', matrix.cpu-type) || '', matrix.cpu-subtype && format('_{0}', matrix.cpu-subtype) || '') }}
path: asterisk-modules/asterisk-chan-quectel/install/openwrt/${{ matrix.target }}/bin/packages/*/strskx/*.ipk
retention-days: 1
if-no-files-found: error

Expand All @@ -239,9 +263,7 @@ jobs:
needs: [build-openwrt-pkg, deb-pkg-try-install, build-deb-pkg-arch]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download all workflow run artifacts
uses: actions/download-artifact@v3

- uses: actions/download-artifact@v3
- name: Publish packages
uses: softprops/action-gh-release@v1
with:
Expand Down

0 comments on commit 5e1bc97

Please sign in to comment.