forked from hanwckf/rt-n56u
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: CI | ||
|
||
# Controls when the action will run. | ||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
release: | ||
types: [published] | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
build: | ||
name: build | ||
runs-on: ubuntu-20.04 | ||
if: ${{ !(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) }} | ||
env: | ||
build_variant: ${{ matrix.build_variant }} | ||
targets: ${{ matrix.targets }} | ||
images_dir: /opt/images | ||
strategy: | ||
matrix: | ||
include: | ||
- build_variant: "mt7620" | ||
targets: "PSG1208 PSG1218 NEWIFI-MINI MI-MINI MI-3 OYE-001 5K-W20" | ||
- build_variant: "mt7628" | ||
targets: "HC5861B MI-NANO MZ-R13 MZ-R13P 360P2 HC5761A HC5661A" | ||
- build_variant: "mt7621" | ||
targets: "K2P_nano-5.0 K2P-5.0 DIR-878-5.0 RM2100" | ||
- build_variant: "mt7621-usb" | ||
targets: "XY-C1 JCG-836PRO-5.0 JCG-AC860M-5.0 JCG-Y2-5.0 DIR-882-5.0 A3004NS MSG1500 WR1200JS MI-R3G NEWIFI3 B70" | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Prepare environment | ||
run: | | ||
sudo apt update | ||
sudo apt install libtool-bin gperf python-docutils autopoint gettext | ||
- name: Run shellcheck | ||
run: sh ./trunk/tools/shellcheck.sh | ||
- name: Prepare toolchain | ||
run: | | ||
cd toolchain-mipsel | ||
sh dl_toolchain.sh | ||
- name: Start build | ||
run: | | ||
cd trunk | ||
mkdir -p ${images_dir} | ||
for m in $targets; do fakeroot ./build_firmware_ci $m; \ | ||
if [ $? = 0 ]; then cp -f images/*.trx ${images_dir}/$m.trx; else exit 1; fi; \ | ||
./clear_tree_simple >/dev/null 2>&1; done | ||
- name: Create archive | ||
if: ${{ github.event_name != 'release' && success() }} | ||
run: | | ||
ls -lh ${images_dir} | ||
GIT_VERSION=`git rev-parse --short=7 HEAD 2>/dev/null` && [ -n "$GIT_VERSION" ] && \ | ||
image_name=images_${build_variant}_${GIT_VERSION} || image_name=images_${build_variant} | ||
cd ${images_dir}; md5sum *.trx |tee md5sum.txt; 7z a -mx=9 ${image_name}.7z ./* | ||
echo "image_name=${image_name}" >> $GITHUB_ENV | ||
- name: Upload images to Artifact | ||
if: ${{ github.event_name != 'release' && success() }} | ||
uses: actions/upload-artifact@v2.2.1 | ||
with: | ||
name: ${{ env.image_name }} | ||
path: ${{ env.images_dir }}/*.7z | ||
- name: Upload images to Releases | ||
if: ${{ github.event_name == 'release' && success() }} | ||
uses: svenstaro/upload-release-action@2.2.0 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: ${{ env.images_dir }}/*.trx | ||
tag: ${{ github.ref }} | ||
overwrite: true | ||
file_glob: true |