OSDN Git Service

CI: don't use fixed tag
[v2raya/v2raya-openwrt.git] / .github / workflows / multi-arch-build.yml
1 name: Build v2rayA feed
2
3 on:
4   workflow_dispatch:
5   release:
6     types:
7       - published
8
9 jobs:
10   build:
11     name: Build packages for ${{ matrix.arch }}
12     runs-on: ubuntu-latest
13     strategy:
14       fail-fast: false
15       matrix:
16         include:
17           - arch: aarch64_cortex-a53
18             runtime_test: true
19           - arch: aarch64_cortex-a72
20             runtime_test: false
21           - arch: aarch64_generic
22             runtime_test: false
23           - arch: arm_arm1176jzf-s_vfp
24             runtime_test: false
25           - arch: arm_arm926ej-s
26             runtime_test: false
27           - arch: arm_cortex-a15_neon-vfpv4
28             runtime_test: true
29           - arch: arm_cortex-a5_vfpv4
30             runtime_test: false
31           - arch: arm_cortex-a7
32             runtime_test: false
33           - arch: arm_cortex-a7_neon-vfpv4
34             runtime_test: false
35           - arch: arm_cortex-a8_vfpv3
36             runtime_test: false
37           - arch: arm_cortex-a9
38             runtime_test: false
39           - arch: arm_cortex-a9_neon
40             runtime_test: false
41           - arch: arm_cortex-a9_vfpv3-d16
42             runtime_test: false
43           - arch: arm_fa526
44             runtime_test: false
45           - arch: arm_mpcore
46             runtime_test: false
47           - arch: arm_xscale
48             runtime_test: false
49           - arch: i386_pentium-mmx
50             runtime_test: true
51           - arch: i386_pentium4
52             runtime_test: false
53           - arch: mips64_octeonplus
54             runtime_test: false
55           - arch: mips_24kc
56             runtime_test: false
57           - arch: mips_4kec
58             runtime_test: false
59           - arch: mips_mips32
60             runtime_test: false
61           - arch: mipsel_24kc
62             runtime_test: false
63           - arch: mipsel_24kc_24kf
64             runtime_test: false
65           - arch: mipsel_74kc
66             runtime_test: false
67           - arch: mipsel_mips32
68             runtime_test: false
69           - arch: x86_64
70             runtime_test: true
71
72     steps:
73       - uses: actions/checkout@v3
74         with:
75           fetch-depth: 0
76
77       - name: Build
78         uses: immortalwrt/gh-action-sdk@v4
79         env:
80           ARCH: ${{ matrix.arch }}-openwrt-21.02
81           FEEDNAME: v2raya_ci
82           PACKAGES: ca-certificates v2fly-geodata v2ray-core xray-core v2raya luci-app-v2raya
83           NO_REFRESH_CHECK: 1
84
85       - name: Generate metadata
86         env:
87           BUILD_ARCH: ${{ matrix.arch }}
88           DEBIAN_FRONTEND: noninteractive
89           USIGN_KEY: ${{ secrets.USIGN_KEY }}
90         run: |
91           sudo -H apt -qq install signify-openbsd
92           sudo -H chown -R runner:runner bin
93           ./scripts/generate_index.sh
94
95       - name: Upload feed
96         uses: Pendect/action-rsyncer@2554a1e574cf229fb144f23ea5971dbdca8ae8e3
97         with:
98           flags: '-ahvHP'
99           options: '--delete'
100           src: 'bin/packages/${{ matrix.arch }}/v2raya_ci/'
101           dest: '${{ secrets.OSDN_USER }}@storage.osdn.net:/storage/groups/v/v2/v2raya/openwrt/${{ matrix.arch }}/'
102         env:
103           DEPLOY_KEY: ${{ secrets.OSDN_KEY }}
104
105       - name: Move created packages to project dir
106         run: cp bin/packages/${{ matrix.arch }}/v2raya_ci/*.ipk . || true
107
108       - name: Store packages
109         uses: actions/upload-artifact@v3
110         if: github.event_name != 'release'
111         with:
112           name: ${{ matrix.arch }}-${{ github.sha }}-packages
113           path: "*.ipk"
114
115       - name: Release packages
116         uses: floralatin/upload-release-action@3688e13ae053ba3052eb4f0cfe03e78deb8f88d7
117         if: github.event_name == 'release'
118         with:
119           overwrite: true
120           repo_token: ${{ github.token }}
121           tag: ${{ github.ref }}
122           file: "*.ipk"
123           file_glob: true
124
125       - name: Store logs
126         uses: actions/upload-artifact@v3
127         with:
128           name: ${{ matrix.arch }}-${{ github.sha }}-logs
129           path: logs/
130
131       - name: Remove logs
132         run: sudo rm -rf logs/ || true
133
134       - name: Register QEMU
135         if: ${{ matrix.runtime_test }}
136         run: |
137           sudo docker run --rm --privileged aptman/qus -s -- -p
138
139       - name: Build Docker container
140         if: ${{ matrix.runtime_test }}
141         run: |
142           docker build -t test-container --build-arg ARCH .github/workflows/
143         env:
144           ARCH: ${{ matrix.arch }}-openwrt-21.02
145
146       - name: Test via Docker container
147         if: ${{ matrix.runtime_test }}
148         run: |
149           docker run --rm -v $GITHUB_WORKSPACE:/ci test-container