ci:fic script #334
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
name: MAIN_CI | |
on: | |
push: | |
branches: [ main ] | |
paths-ignore: | |
- '.github/workflows/app_ci.yml' | |
- 'target_root_app/**' | |
- 'doc/**' | |
- 'tutorial/**' | |
- 'README.md' | |
- 'README_zh_CN.md' | |
- 'DEVELOPNOTE.md' | |
- 'CHANGELOG.md' | |
- '.readthedocs.yaml' | |
pull_request: | |
branches: [ main ] | |
paths-ignore: | |
- '.github/workflows/app_ci.yml' | |
- 'target_root_app/**' | |
- 'doc/**' | |
- 'tutorial/**' | |
- 'README.md' | |
- 'README_zh_CN.md' | |
- 'DEVELOPNOTE.md' | |
- 'CHANGELOG.md' | |
- '.readthedocs.yaml' | |
workflow_dispatch: | |
jobs: | |
main_build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: clean | |
shell: bash -l {0} | |
run: | | |
rm -rf ./.git | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-activate-base: true | |
activate-environment: "" | |
- name: Install prerequisites | |
shell: bash -l {0} | |
run: | | |
sudo apt update | |
sudo apt install -y wget device-tree-compiler ninja-build git build-essential flex \ | |
pkg-config zlib1g-dev libsdl2-dev libglib2.0-0 libglib2.0-dev libsdl1.2-dev \ | |
libpixman-1-dev libfdt-dev autoconf automake libtool librbd-dev libmpc-dev \ | |
libaio-dev make cmake gcc python3 vim swig python3-dev libedit-dev mtd-utils \ | |
libncurses5-dev liblzma-dev lua5.3 liblua5.3-dev libxml2-dev doxygen graphviz \ | |
libgtk-3-dev libcap-ng-dev libattr1-dev bison gperf intltool libslirp-dev \ | |
libvirglrenderer-dev libsdl2-image-dev | |
- name: Cache toolchain | |
uses: actions/cache@v3 | |
env: | |
cache-name: toolchain | |
with: | |
path: | | |
$HOME/gcc-riscv64-unknown-linux-gnu | |
$HOME/gcc-riscv64-unknown-elf | |
key: ${{ runner.os }}-cache-${{ env.cache-name }} | |
restore-keys: | | |
${{ runner.os }}-cache- | |
- name: Download and extract prebuilt toolchain | |
shell: bash -l {0} | |
run: | | |
RISCV_GLIBC_TOOLCHAIN=$HOME/gcc-riscv64-unknown-linux-gnu | |
RISCV_NEWLIBC_TOOLCHAIN=$HOME/gcc-riscv64-unknown-elf | |
if [ ! -d "$RISCV_GLIBC_TOOLCHAIN" ]; then | |
# download prebuilt toolchain | |
wget https://github.com/riscv/riscv-gnu-toolchain/releases/download/2021.08.07/riscv64-glibc-ubuntu-20.04-nightly-2021.08.07-nightly.tar.gz | |
tar -xzf riscv64-glibc-ubuntu-20.04-nightly-2021.08.07-nightly.tar.gz | |
mv riscv $RISCV_GLIBC_TOOLCHAIN | |
rm -f *.tar.gz | |
# strip binaries | |
cd $RISCV_GLIBC_TOOLCHAIN | |
set +e | |
for i in `find libexec bin -type f` | |
do | |
strip -s $i | |
done | |
cd - | |
$RISCV_GLIBC_TOOLCHAIN/bin/riscv64-unknown-linux-gnu-gcc -v | |
fi | |
if [ ! -d "$RISCV_NEWLIBC_TOOLCHAIN" ]; then | |
# download prebuilt toolchain | |
wget https://static.dev.sifive.com/dev-tools/freedom-tools/v2020.12/riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14.tar.gz | |
tar -xzf riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14.tar.gz | |
mv riscv64-unknown-elf-toolchain-10.2.0-2020.12.8-x86_64-linux-ubuntu14 $RISCV_NEWLIBC_TOOLCHAIN | |
rm -f *.tar.gz | |
# strip binaries | |
cd $RISCV_NEWLIBC_TOOLCHAIN | |
set +e | |
for i in `find libexec bin -type f` | |
do | |
strip -s $i | |
done | |
cd - | |
$RISCV_NEWLIBC_TOOLCHAIN/bin/riscv64-unknown-elf-gcc -v | |
fi | |
- name: Build all | |
shell: bash -l {0} | |
run: | | |
# replace pkexec with sudo for ci | |
sed -i 's/pkexec/sudo/g' build.sh | |
export TOOLCHAIN_ROOT_PATH=$HOME | |
./build.sh all | |
# perupload | |
sudo rm -rf ./output/rootfs/bootfs ./output/rootfs/rootfs ./output/rootfs/target | |
tar -czf output.tar.gz output/ update_tools/ run.sh update_tools.sh | |
tar -czf toolchain.tar.gz $HOME/gcc-riscv64-unknown-linux-gnu $HOME/gcc-riscv64-unknown-elf | |
- name: Upload build asserts | |
uses: actions/[email protected] | |
with: | |
name: output | |
path: | | |
output.tar.gz | |
retention-days: 1 | |
- name: Upload prebuilt toolchain | |
uses: actions/[email protected] | |
with: | |
name: prebuilt_toolchain | |
path: | | |
toolchain.tar.gz | |
qemu_w64_build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: clean | |
shell: bash -l {0} | |
run: | | |
rm -rf ./.git | |
- name: build_docker_image | |
shell: bash -l {0} | |
run: | | |
cd qemu-8.0.0 | |
./tests/docker/docker.py --engine docker build -t qemu/fedora -f tests/docker/dockerfiles/fedora-win64-cross.docker --registry registry.gitlab.com/qemu-project/qemu --add-current-user | |
- uses: addnab/docker-run-action@v3 | |
with: | |
image: qemu/fedora:latest | |
options: -w /home/runner/work/quard_star_tutorial/quard_star_tutorial -v /home/runner:/home/runner | |
shell: bash -l {0} | |
run: | | |
dnf update -y | |
dnf install -y zstd wget | |
wget https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-libslirp-4.7.0-1-any.pkg.tar.zst | |
tar -I zstd -xvf mingw-w64-x86_64-libslirp-4.7.0-1-any.pkg.tar.zst | |
cp ./mingw64/bin/libslirp-0.dll /usr/x86_64-w64-mingw32/sys-root/mingw/bin/libslirp-0.dll | |
mkdir /usr/x86_64-w64-mingw32/sys-root/mingw/include/slirp | |
cp ./mingw64/include/slirp/libslirp-version.h /usr/x86_64-w64-mingw32/sys-root/mingw/include/slirp/libslirp-version.h | |
cp ./mingw64/include/slirp/libslirp.h /usr/x86_64-w64-mingw32/sys-root/mingw/include/slirp/libslirp.h | |
cp ./mingw64/lib/libslirp.a /usr/x86_64-w64-mingw32/sys-root/mingw/lib/libslirp.a | |
cp ./mingw64/lib/libslirp.dll.a /usr/x86_64-w64-mingw32/sys-root/mingw/lib/libslirp.dll.a | |
cp ./.github/workflows/res/slirp.pc /usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig/slirp.pc | |
./build.sh qemu_w64 | |
cp /usr/x86_64-w64-mingw32/sys-root/mingw/bin/*.dll ./output/qemu_w64/ | |
- name: Upload build asserts | |
uses: actions/[email protected] | |
with: | |
name: qemu_w64 | |
path: | | |
output/qemu_w64 | |
run.bat | |
retention-days: 1 | |
qemu_macos_build: | |
runs-on: macos-12 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: clean | |
shell: bash -l {0} | |
run: | | |
rm -rf ./.git | |
- name: Install prerequisites | |
run: | | |
brew install libslirp libffi gettext glib pkg-config autoconf automake pixman ninja dylibbundler | |
- name: Build all | |
run: | | |
./build.sh qemu_macos | |
dylibbundler -od -b -x ./output/qemu_macos/bin/qemu-system-riscv64 -d ./output/qemu_macos/libs/ | |
tar -czf qemu_macos.tar.gz output/ | |
- name: Upload build asserts | |
uses: actions/[email protected] | |
with: | |
name: qemu_macos | |
path: | | |
qemu_macos.tar.gz | |
retention-days: 1 | |
quard_star_tools_build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v3 | |
with: | |
version: '6.5.3' | |
modules: 'qt5compat qtwebsockets' | |
aqtversion: ==3.1.7 | |
- name: Install prerequisites | |
shell: bash -l {0} | |
run: | | |
sudo apt update | |
sudo apt install -y make gcc upx-ucl | |
- name: build depend | |
run: | | |
cd quard_star_tools/depend | |
sudo apt install fcitx-libs-dev qtbase5-private-dev libxkbcommon-dev extra-cmake-modules tree | |
export PATH=$Qt6_DIR/bin:$PATH | |
export PATH=$Qt6_DIR/../../Qt/Tools/CMake/bin:$PATH | |
export Qt6GuiTools_DIR=$Qt6_DIR | |
./build_fcitx_qt6.sh | |
cp ./fcitx-qt5-1.2.7/build/qt6/platforminputcontext/libfcitxplatforminputcontextplugin-qt6.so ./ | |
- name: Build all | |
shell: bash -l {0} | |
run: | | |
cd quard_star_tools | |
git describe --always --long --abbrev=10 --exclude '*' | awk '{print "\""$0"\""}' > git_tag.inc | |
sed -i 's/git_tag.inc/git_tag.ci.inc/g' quard_star_tools.pro | |
sed -i 's/upx-ucl/cp $$DESTDIR\/$$TARGET $$DESTDIR\/quard_star_tools_temp; upx-ucl/g' quard_star_tools.pro | |
lrelease quard_star_tools.pro | |
qmake -makefile | |
make | |
cd ./tools/ci_build_deb | |
./build.sh | |
cd - | |
mkdir gui_tools | |
mv ./release/output ./gui_tools/quard_star_tools | |
tar -czf quard_star_tools.tar.gz gui_tools/ run_quard_star_tools.sh | |
- name: Upload build asserts | |
uses: actions/[email protected] | |
with: | |
name: quard_star_tools | |
path: | | |
./quard_star_tools/quard_star_tools.tar.gz | |
retention-days: 1 | |
quard_star_tools_w64_build: | |
runs-on: windows-2022 | |
steps: | |
- name: sparseCheckout | |
run: | | |
git clone --filter=blob:none --no-checkout --depth 1 --single-branch -b "$env:GITHUB_REF".Split('/')[2] --sparse "https://$env:GITHUB_ACTOR:$env:[email protected]/$env:GITHUB_REPOSITORY.git" . | |
git config core.protectNTFS false | |
git sparse-checkout init --cone | |
git sparse-checkout add quard_star_tools | |
git checkout | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v3 | |
with: | |
arch: win64_mingw | |
version: '6.5.3' | |
modules: 'qt5compat qtwebsockets' | |
aqtversion: ==3.1.7 | |
- name: Build all | |
run: | | |
cd quard_star_tools | |
git describe --always --long --abbrev=10 --exclude '*' | ./tools/awk/awk.exe '{print \"\\\"\"$0\"\\\"\"}' > git_tag.inc | |
./tools/sed/sed.exe -i "s/git_tag.inc/git_tag.ci.inc/g" quard_star_tools.pro | |
lrelease quard_star_tools.pro | |
qmake -makefile | |
mingw32-make | |
windeployqt.exe ./release/out/quard_star_tools.exe | |
Rename-Item ./release/out quard_star_tools_w64 | |
Rename-Item ./release gui_tools | |
- name: Upload build asserts | |
uses: actions/[email protected] | |
with: | |
name: quard_star_tools_w64 | |
path: | | |
./quard_star_tools/gui_tools/quard_star_tools_w64 | |
./quard_star_tools/run_quard_star_tools.bat | |
retention-days: 1 | |
quard_star_tools_macos_build: | |
runs-on: macos-12 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v3 | |
with: | |
version: '6.5.3' | |
modules: 'qt5compat qtwebsockets' | |
aqtversion: ==3.1.7 | |
- name: Install prerequisites | |
run: | | |
ruby - e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2 > /dev/null | |
brew install --build-from-source upx | |
- name: Build all | |
shell: bash -l {0} | |
run: | | |
cd quard_star_tools | |
git describe --always --long --abbrev=10 --exclude '*' | awk '{print "\""$0"\""}' > git_tag.inc | |
sed -i'.original' -e 's/git_tag.inc/git_tag.ci.inc/g' quard_star_tools.pro | |
lrelease quard_star_tools.pro | |
qmake -makefile | |
make | |
cd ./release/out | |
macdeployqt quard_star_tools.app -dmg -verbose=2 | |
cd - | |
mkdir ./gui_tools | |
mkdir ./gui_tools/quard_star_tools_macos | |
mv ./release/out/quard_star_tools.dmg ./gui_tools/quard_star_tools_macos/quard_star_tools.dmg | |
mv ../.github/workflows/res/installer_background.png ./gui_tools/quard_star_tools_macos/installer_background.png | |
tar -czf quard_star_tools.tar.gz gui_tools/ | |
- name: Upload build asserts | |
uses: actions/[email protected] | |
with: | |
name: quard_star_tools_macos | |
path: | | |
./quard_star_tools/quard_star_tools.tar.gz | |
retention-days: 1 |