|
1 | 1 | name: prudynt-t |
2 | 2 | on: |
3 | 3 | workflow_dispatch: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - '**' |
4 | 7 |
|
5 | 8 | env: |
6 | 9 | TAG_NAME: release |
7 | | - TOOLCHAIN_MUSL: /home/runner/work/prudynt-t/prudynt-t/mipsel-thingino-linux-musl_sdk-buildroot/bin/mipsel-linux- |
| 10 | + TOOLCHAIN_URL: https://github.com/themactep/thingino-firmware/releases/download/toolchain-x86_64/thingino-toolchain-x86_64_xburst1_4_4_musl_gcc14-linux-mipsel.tar.gz |
| 11 | + TOOLCHAIN_DIR: /opt/mipsel-thingino-linux-musl_sdk-buildroot |
| 12 | + CCACHE_DIR: ${{ github.workspace }}/.ccache |
8 | 13 |
|
9 | 14 | jobs: |
10 | | - buildroot: |
11 | | - name: prudynt |
| 15 | + native-build: |
| 16 | + name: prudynt-build |
12 | 17 | runs-on: ubuntu-latest |
13 | 18 | strategy: |
14 | 19 | fail-fast: false |
15 | 20 | matrix: |
16 | | - include: |
17 | | - - target: T10 |
18 | | - build_type: static |
19 | | - - target: T20 |
20 | | - build_type: static |
21 | | - - target: T21 |
22 | | - build_type: static |
23 | | - - target: T23 |
24 | | - build_type: static |
25 | | - - target: T30 |
26 | | - build_type: static |
27 | | - - target: T31 |
28 | | - build_type: static |
29 | | - - target: C100 |
30 | | - build_type: static |
31 | | - - target: T10 |
32 | | - build_type: dynamic |
33 | | - - target: T20 |
34 | | - build_type: dynamic |
35 | | - - target: T21 |
36 | | - build_type: dynamic |
37 | | - - target: T23 |
38 | | - build_type: dynamic |
39 | | - - target: T30 |
40 | | - build_type: dynamic |
41 | | - - target: T31 |
42 | | - build_type: dynamic |
43 | | - - target: C100 |
44 | | - build_type: dynamic |
| 21 | + target: |
| 22 | + - T10 |
| 23 | + - T20 |
| 24 | + - T21 |
| 25 | + - T23 |
| 26 | + - T30 |
| 27 | + - T31 |
| 28 | + - C100 |
| 29 | + build_type: |
| 30 | + - static |
| 31 | + - dynamic |
| 32 | + - hybrid |
45 | 33 |
|
46 | 34 | steps: |
47 | 35 | - name: Checkout source |
48 | 36 | uses: actions/checkout@v4 |
49 | 37 | with: |
50 | | - submodules: 'true' |
| 38 | + submodules: true |
51 | 39 |
|
52 | | - - name: Setup cache directories |
| 40 | + - name: Install dependencies |
53 | 41 | run: | |
54 | | - mkdir -p /tmp/ccache |
55 | | - ln -s /tmp/ccache ${HOME}/.ccache |
| 42 | + sudo apt-get update |
| 43 | + sudo apt-get install -y --no-install-recommends --no-install-suggests \ |
| 44 | + build-essential bc bison cpio curl file flex git libncurses-dev \ |
| 45 | + make rsync unzip wget whiptail gcc lzop u-boot-tools \ |
| 46 | + ca-certificates cmake ccache |
56 | 47 |
|
57 | | - - name: Setup ccache |
58 | | - uses: actions/cache@v4 |
59 | | - if: always() |
60 | | - with: |
61 | | - path: /tmp/ccache |
62 | | - key: ${{ runner.os }}-ccache-${{ github.sha }} |
63 | | - restore-keys: | |
64 | | - ${{ runner.os }}-ccache- |
65 | | -
|
66 | | - - name: Update system sources |
67 | | - run: sudo apt-get update |
68 | | - |
69 | | - - name: Install build dependencies |
| 48 | + - name: Download and extract toolchain |
70 | 49 | run: | |
71 | | - sudo apt-get install -y --no-install-recommends --no-install-suggests build-essential bc bison cpio curl file flex git libncurses-dev make rsync unzip wget whiptail gcc lzop u-boot-tools ca-certificates ccache |
| 50 | + mkdir -p /opt |
| 51 | + cd /opt |
| 52 | + wget "$TOOLCHAIN_URL" -O thingino-toolchain.tar.gz |
| 53 | + tar -xf thingino-toolchain.tar.gz |
| 54 | + cd mipsel-thingino-linux-musl_sdk-buildroot |
| 55 | + ./relocate-sdk.sh |
72 | 56 |
|
73 | | - - name: Download toolchain |
| 57 | + - name: Set up toolchain and ccache env vars |
74 | 58 | run: | |
75 | | - wget https://github.com/themactep/thingino-firmware/releases/download/toolchain/thingino-toolchain_xburst1_musl_gcc14-linux-mipsel.tar.gz |
76 | | - tar -xf thingino-toolchain_xburst1_musl_gcc14-linux-mipsel.tar.gz |
77 | | - cd mipsel-thingino-linux-musl_sdk-buildroot; ./relocate-sdk.sh |
78 | | - cd ../ |
| 59 | + echo "TOOLCHAIN_DIR=${TOOLCHAIN_DIR}" >> $GITHUB_ENV |
| 60 | + echo "PATH=${TOOLCHAIN_DIR}/bin:/usr/lib/ccache:$PATH" >> $GITHUB_ENV |
| 61 | + echo "CC=ccache ${TOOLCHAIN_DIR}/bin/mipsel-linux-gcc" >> $GITHUB_ENV |
| 62 | + echo "CXX=ccache ${TOOLCHAIN_DIR}/bin/mipsel-linux-g++" >> $GITHUB_ENV |
| 63 | + echo "PRUDYNT_CROSS=ccache ${TOOLCHAIN_DIR}/bin/mipsel-linux-" >> $GITHUB_ENV |
79 | 64 |
|
80 | | - - name: Build deps for target |
| 65 | + - name: Restore ccache |
| 66 | + id: restore-ccache |
| 67 | + if: always() |
| 68 | + uses: actions/cache@v4 |
| 69 | + with: |
| 70 | + path: ${{ github.workspace }}/.ccache |
| 71 | + key: ccache-${{ matrix.target }}-${{ matrix.build_type }}-${{ github.sha }} |
| 72 | + |
| 73 | + - name: Set build suffix |
| 74 | + id: suffix |
81 | 75 | run: | |
82 | | - PRUDYNT_CROSS="ccache $TOOLCHAIN_MUSL" ./build.sh deps ${{ matrix.target }} ${{ matrix.build_type == 'static' && '-static' || '' }} |
| 76 | + case "${{ matrix.build_type }}" in |
| 77 | + static) echo "SUFFIX=-static" >> $GITHUB_ENV ;; |
| 78 | + hybrid) echo "SUFFIX=-hybrid" >> $GITHUB_ENV ;; |
| 79 | + *) echo "SUFFIX=" >> $GITHUB_ENV ;; |
| 80 | + esac |
83 | 81 |
|
84 | | - - name: Build prudynt for target |
| 82 | + - name: Build deps |
85 | 83 | run: | |
86 | | - PRUDYNT_CROSS="$TOOLCHAIN_MUSL" ./build.sh prudynt ${{ matrix.target }} ${{ matrix.build_type == 'static' && '-static' || '' }} |
| 84 | + ./build.sh deps ${{ matrix.target }} $SUFFIX |
87 | 85 |
|
88 | | - - name: Rename prudynt for release |
| 86 | + - name: Build prudynt |
89 | 87 | run: | |
90 | | - mv bin/prudynt bin/prudynt-${{ matrix.target }}-${{ matrix.build_type }} |
| 88 | + ./build.sh prudynt ${{ matrix.target }} $SUFFIX |
| 89 | + mv bin/prudynt "bin/prudynt-${{ matrix.target }}-${{ matrix.build_type }}" |
91 | 90 |
|
92 | 91 | - name: Upload binary as artifact |
93 | 92 | uses: actions/upload-artifact@v4 |
94 | 93 | with: |
95 | 94 | name: prudynt-${{ matrix.target }}-${{ matrix.build_type }} |
96 | | - path: | |
97 | | - bin/prudynt-${{ matrix.target }}-${{ matrix.build_type }} |
| 95 | + path: bin/prudynt-${{ matrix.target }}-${{ matrix.build_type }} |
98 | 96 |
|
99 | 97 | - name: Upload binary to release |
100 | 98 | if: github.event_name != 'pull_request' |
|
0 commit comments