fix: 去掉并行构建,gitea不支持
This commit is contained in:
@@ -4,73 +4,7 @@ on:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-builder
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
target:
|
||||
- name: linux-amd64
|
||||
toolchain: ""
|
||||
cmake_extra: ""
|
||||
build_testing: ON
|
||||
- name: linux-arm64
|
||||
toolchain: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-linux-arm64.cmake
|
||||
cmake_extra: ""
|
||||
build_testing: OFF
|
||||
- name: linux-armhf
|
||||
toolchain: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-linux-armhf.cmake
|
||||
cmake_extra: ""
|
||||
build_testing: OFF
|
||||
- name: windows-amd64
|
||||
toolchain: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-windows-amd64.cmake
|
||||
cmake_extra: -DBUILD_EXAMPLES=OFF
|
||||
build_testing: OFF
|
||||
- name: baremetal-arm32
|
||||
toolchain: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-baremetal-arm32.cmake
|
||||
cmake_extra: -DBUILD_EXAMPLES=OFF -DBUILD_SHARED=OFF
|
||||
build_testing: OFF
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install cross-compilers
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
gcc-arm-linux-gnueabihf \
|
||||
gcc-aarch64-linux-gnu \
|
||||
gcc-mingw-w64-x86-64 \
|
||||
gcc-arm-none-eabi
|
||||
|
||||
- name: Configure
|
||||
run: cmake -S . -B build -DBUILD_TESTING=${{ matrix.target.build_testing }} ${{ matrix.target.toolchain }} ${{ matrix.target.cmake_extra }}
|
||||
|
||||
- name: Build
|
||||
run: cmake --build build
|
||||
|
||||
- name: Run tests
|
||||
if: matrix.target.build_testing == 'ON'
|
||||
run: ctest --test-dir build --output-on-failure
|
||||
|
||||
- name: Package
|
||||
run: |
|
||||
PKG="datarouter-${{ matrix.target.name }}"
|
||||
mkdir -p "dist/$PKG"
|
||||
for f in datarouter.h datarouter_config_template.h LICENSE README.md; do
|
||||
if [ -f "$f" ]; then cp "$f" "dist/$PKG/"; fi
|
||||
done
|
||||
for f in libDataRouter.a libDataRouter.so libDataRouter.dll libDataRouter.dll.a example example.exe; do
|
||||
if [ -f "build/$f" ]; then cp "build/$f" "dist/$PKG/"; fi
|
||||
done
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: datarouter-${{ matrix.target.name }}
|
||||
path: dist/datarouter-${{ matrix.target.name }}
|
||||
|
||||
release:
|
||||
needs: build
|
||||
runs-on: ubuntu-builder
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -89,9 +23,39 @@ jobs:
|
||||
[ -n "$TAG" ] || exit 78
|
||||
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: artifacts
|
||||
- name: Install cross-compilers
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
gcc-arm-linux-gnueabihf \
|
||||
gcc-aarch64-linux-gnu \
|
||||
gcc-mingw-w64-x86-64 \
|
||||
gcc-arm-none-eabi
|
||||
|
||||
- name: Build all targets
|
||||
run: |
|
||||
for entry in \
|
||||
"linux-amd64|ON|" \
|
||||
"linux-arm64|OFF|-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-linux-arm64.cmake" \
|
||||
"linux-armhf|OFF|-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-linux-armhf.cmake" \
|
||||
"windows-amd64|OFF|-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-windows-amd64.cmake -DBUILD_EXAMPLES=OFF" \
|
||||
"baremetal-arm32|OFF|-DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-baremetal-arm32.cmake -DBUILD_EXAMPLES=OFF -DBUILD_SHARED=OFF"
|
||||
do
|
||||
IFS='|' read -r name testing extra <<< "$entry"
|
||||
echo ">>> Building $name"
|
||||
cmake -S . -B "build-$name" -DBUILD_TESTING=$testing $extra
|
||||
cmake --build "build-$name"
|
||||
[ "$testing" = "ON" ] && ctest --test-dir "build-$name" --output-on-failure
|
||||
|
||||
pkg="datarouter-$name"
|
||||
mkdir -p "dist/$pkg"
|
||||
for f in datarouter.h datarouter_config_template.h LICENSE README.md; do
|
||||
if [ -f "$f" ]; then cp "$f" "dist/$pkg/"; fi
|
||||
done
|
||||
for f in libDataRouter.a libDataRouter.so libDataRouter.dll libDataRouter.dll.a example example.exe; do
|
||||
if [ -f "build-$name/$f" ]; then cp "build-$name/$f" "dist/$pkg/"; fi
|
||||
done
|
||||
done
|
||||
|
||||
- name: Create release & upload assets
|
||||
run: |
|
||||
@@ -107,7 +71,7 @@ jobs:
|
||||
|
||||
ID=$(echo "$RESP" | python3 -c "import sys,json;print(json.load(sys.stdin)['id'])")
|
||||
|
||||
for dir in artifacts/*/; do
|
||||
for dir in dist/*/; do
|
||||
name="$(basename "$dir").tar.gz"
|
||||
tar czf "/tmp/$name" -C "$dir" .
|
||||
echo "Uploading $name"
|
||||
|
||||
Reference in New Issue
Block a user