CI/CD: Init building workflow

This commit is contained in:
2024-11-11 16:42:44 +03:00
committed by Max Logaev
parent 8c9a971e2c
commit 739facfeca
2 changed files with 411 additions and 0 deletions

317
.gitea/workflows/build.yaml Normal file
View File

@@ -0,0 +1,317 @@
name: 'Build system'
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
jobs:
codestyle:
name: "Check codestyle"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup dependencies
run: |
sudo apt update && sudo apt install perl -y
- name: Check codestyle
run: |
wget https://gist.githubusercontent.com/VerySweetBread/d207dd2c7efbd3cdd18dc8322b194816/raw/bf21c89d7eb1df71e253dc72bcde86ea854df19f/checker.pl
find kernel/trunk -iname '*.asm' -or -iname '*.inc' -exec bash -c "echo {}; cat {} | perl checker.pl" \;
build-en-system:
name: 'Build en_US system'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup dependencies
run: |
sudo apt update && sudo apt install p7zip-full nasm make gcc sudo mtools mkisofs parted gdisk gcc-multilib git ccache libfuse3-dev build-essential flex bison gperf libncurses5-dev libncursesw5-dev gawk libmpfr-dev libgpm-dev zlib1g-dev yasm graphviz -y
- name: Restore toolchain
id: cache-toolchain
uses: actions/cache/restore@v4
with:
path: /home/autobuild
key: kolibri-toolchain
- name: Install toolchain
if: steps.cache-toolchain.outputs.cache-hit != 'true'
run: |
# wget "http://board.kolibrios.org/download/file.php?id=9919&sid=bc8412934004a60f831b1b92eae0ad34" -O install_kgcc
chmod +x ${{ gitea.workspace }}/.gitea/workflows/install_kgcc
${{ gitea.workspace }}/.gitea/workflows/install_kgcc
echo 'exec ${{ gitea.workspace }}/programs/cmm/c--/c--.elf $*' > /home/autobuild/tools/win32/bin/c--
chmod +x ${{ gitea.workspace }}/programs/cmm/c--/c--.elf
chmod +x /home/autobuild/tools/win32/bin/c--
cp ${{ gitea.workspace }}/programs/develop/ktcc/trunk/bin/kos32-tcc /home/autobuild/tools/win32/bin/kos32-tcc
chmod +x /home/autobuild/tools/win32/bin/kos32-tcc
- name: Compile objconv
if: steps.cache-toolchain.outputs.cache-hit != 'true'
run: |
source ~/.bashrc
cd ${{ gitea.workspace }}/programs/develop/objconv/
g++ -o objconv -O2 *.cpp
chmod +x objconv
mv objconv /home/autobuild/tools/win32/bin/.
- name: Compile kerpack
if: steps.cache-toolchain.outputs.cache-hit != 'true'
run: |
export PATH=/home/autobuild/tools/win32/bin:$PATH
source ~/.bashrc
cd ${{ gitea.workspace }}/programs/other/kpack/kerpack_linux/
make
chmod +x kerpack
mv kerpack /home/autobuild/tools/win32/bin/.
- name: Compile kpack
if: steps.cache-toolchain.outputs.cache-hit != 'true'
run: |
export PATH=/home/autobuild/tools/win32/bin:$PATH
source ~/.bashrc
cd ${{ gitea.workspace }}/programs/other/kpack/linux/
bash build.sh
chmod +x kpack
mv kpack /home/autobuild/tools/win32/bin/.
- name: Compile clink
if: steps.cache-toolchain.outputs.cache-hit != 'true'
run: |
cd ${{ gitea.workspace }}/programs/develop/clink
gcc main.c -o clink
chmod a+x clink
mv clink /home/autobuild/tools/win32/bin/.
- name: Build tup
if: steps.cache-toolchain.outputs.cache-hit != 'true'
run: |
git clone https://github.com/gittup/tup /home/autobuild/tup
cd /home/autobuild/tup
sh bootstrap-nofuse.sh
./tup -v
pwd
cd ${{ gitea.workspace }}
- run: |
rm /home/autobuild
mv /root/autobuild /home/autobuild
ls -l /home/autobuild
ls -l ${{ gitea.workspace }}
if: steps.cache-toolchain.outputs.cache-hit != 'true'
- name: Save toolchain
if: steps.cache-toolchain.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: /home/autobuild
key: kolibri-toolchain
- name: Configure tup
run: |
source ~/.bashrc
export ROOT=${{ gitea.workspace }}
cd $ROOT
echo "CONFIG_LANG=en_US" > tup.config
echo "CONFIG_BUILD_TYPE=en_US" >> tup.config
echo "CONFIG_KPACK_CMD=&& kpack --nologo %o" >> tup.config
echo "CONFIG_KERPACK_CMD=&& kerpack %o" >> tup.config
echo "CONFIG_PESTRIP_CMD=&& EXENAME=%o fasm $ROOT/data/common/pestrip.asm %o" >> tup.config
echo "CONFIG_NO_CMM=full" >> tup.config
echo "CONFIG_NO_GCC=full" >> tup.config
echo "CONFIG_NO_JWASM=full" >> tup.config
echo "CONFIG_NO_MSVC=full" >> tup.config
echo "CONFIG_INSERT_REVISION_ID=1" >> tup.config
rm $ROOT/programs/develop/libraries/kos_mbedtls/library/Tupfile.lua
rm $ROOT/programs/develop/libraries/kos_mbedtls/programs/ssl/Tupfile.lua
cat tup.config
/home/autobuild/tup/tup init
/home/autobuild/tup/tup generate build.sh
- name: Build
run: |
export PATH=/home/autobuild/tools/win32/bin:$PATH
sh build.sh
- name: Get describe
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Upload floppy image
uses: actions/upload-artifact@v3
with:
name: kolibrios-eng-${{ steps.vars.outputs.sha_short }}.img
path: data/kolibri.img
- name: Upload CD image
uses: actions/upload-artifact@v3
with:
name: kolibrios-eng-${{ steps.vars.outputs.sha_short }}.iso
path: data/kolibri.iso
- name: Upload raw image
uses: actions/upload-artifact@v3
with:
name: kolibrios-eng-${{ steps.vars.outputs.sha_short }}.raw
path: data/kolibri.raw
build-ru-system:
name: 'Build ru_RU system'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup dependencies
run: |
sudo apt update && sudo apt install p7zip-full nasm make gcc sudo mtools mkisofs parted gdisk gcc-multilib git ccache libfuse3-dev build-essential flex bison gperf libncurses5-dev libncursesw5-dev gawk libmpfr-dev libgpm-dev zlib1g-dev yasm graphviz -y
- name: Restore toolchain
id: cache-toolchain
uses: actions/cache/restore@v4
with:
path: /home/autobuild
key: kolibri-toolchain
- name: Install toolchain
if: steps.cache-toolchain.outputs.cache-hit != 'true'
run: |
# wget "http://board.kolibrios.org/download/file.php?id=9919&sid=bc8412934004a60f831b1b92eae0ad34" -O install_kgcc
chmod +x ${{ gitea.workspace }}/.gitea/workflows/install_kgcc
${{ gitea.workspace }}/.gitea/workflows/install_kgcc
echo 'exec ${{ gitea.workspace }}/programs/cmm/c--/c--.elf $*' > /home/autobuild/tools/win32/bin/c--
chmod +x ${{ gitea.workspace }}/programs/cmm/c--/c--.elf
chmod +x /home/autobuild/tools/win32/bin/c--
cp ${{ gitea.workspace }}/programs/develop/ktcc/trunk/bin/kos32-tcc /home/autobuild/tools/win32/bin/kos32-tcc
chmod +x /home/autobuild/tools/win32/bin/kos32-tcc
- name: Compile objconv
if: steps.cache-toolchain.outputs.cache-hit != 'true'
run: |
source ~/.bashrc
cd ${{ gitea.workspace }}/programs/develop/objconv/
g++ -o objconv -O2 *.cpp
chmod +x objconv
mv objconv /home/autobuild/tools/win32/bin/.
- name: Compile kerpack
if: steps.cache-toolchain.outputs.cache-hit != 'true'
run: |
export PATH=/home/autobuild/tools/win32/bin:$PATH
source ~/.bashrc
cd ${{ gitea.workspace }}/programs/other/kpack/kerpack_linux/
make
chmod +x kerpack
mv kerpack /home/autobuild/tools/win32/bin/.
- name: Compile kpack
if: steps.cache-toolchain.outputs.cache-hit != 'true'
run: |
export PATH=/home/autobuild/tools/win32/bin:$PATH
source ~/.bashrc
cd ${{ gitea.workspace }}/programs/other/kpack/linux/
bash build.sh
chmod +x kpack
mv kpack /home/autobuild/tools/win32/bin/.
- name: Compile clink
if: steps.cache-toolchain.outputs.cache-hit != 'true'
run: |
cd ${{ gitea.workspace }}/programs/develop/clink
gcc main.c -o clink
chmod a+x clink
mv clink /home/autobuild/tools/win32/bin/.
- name: Build tup
if: steps.cache-toolchain.outputs.cache-hit != 'true'
run: |
git clone https://github.com/gittup/tup /home/autobuild/tup
cd /home/autobuild/tup
sh bootstrap-nofuse.sh
./tup -v
pwd
cd ${{ gitea.workspace }}
- run: |
rm /home/autobuild
mv /root/autobuild /home/autobuild
ls -l /home/autobuild
ls -l ${{ gitea.workspace }}
if: steps.cache-toolchain.outputs.cache-hit != 'true'
- name: Save toolchain
if: steps.cache-toolchain.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: /home/autobuild
key: kolibri-toolchain
- name: Configure tup
run: |
source ~/.bashrc
export ROOT=${{ gitea.workspace }}
cd $ROOT
echo "CONFIG_LANG=ru_RU" > tup.config
echo "CONFIG_BUILD_TYPE=ru_RU" >> tup.config
echo "CONFIG_KPACK_CMD=&& kpack --nologo %o" >> tup.config
echo "CONFIG_KERPACK_CMD=&& kerpack %o" >> tup.config
echo "CONFIG_PESTRIP_CMD=&& EXENAME=%o fasm $ROOT/data/common/pestrip.asm %o" >> tup.config
echo "CONFIG_NO_CMM=full" >> tup.config
echo "CONFIG_NO_GCC=full" >> tup.config
echo "CONFIG_NO_JWASM=full" >> tup.config
echo "CONFIG_NO_MSVC=full" >> tup.config
echo "CONFIG_INSERT_REVISION_ID=1" >> tup.config
rm $ROOT/programs/develop/libraries/kos_mbedtls/library/Tupfile.lua
rm $ROOT/programs/develop/libraries/kos_mbedtls/programs/ssl/Tupfile.lua
cat tup.config
/home/autobuild/tup/tup init
/home/autobuild/tup/tup generate build.sh
- name: Build
run: |
export PATH=/home/autobuild/tools/win32/bin:$PATH
sh build.sh
- name: Get describe
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Upload floppy image
uses: actions/upload-artifact@v3
with:
name: kolibrios-rus-${{ steps.vars.outputs.sha_short }}.img
path: data/kolibri.img
- name: Upload CD image
uses: actions/upload-artifact@v3
with:
name: kolibrios-rus-${{ steps.vars.outputs.sha_short }}.iso
path: data/kolibri.iso
- name: Upload raw image
uses: actions/upload-artifact@v3
with:
name: kolibrios-rus-${{ steps.vars.outputs.sha_short }}.raw
path: data/kolibri.raw

View File

@@ -0,0 +1,94 @@
#!/bin/bash
# Written by turbocat2001 (Maxim Logaev)
# Installation steps described by maxcodehack (Maxim Kuzmitsky)
set -e
print_msg(){
echo -e "\e[34m$1\e[0m"
}
print_ok(){
echo -e "\e[32m$1\e[0m"
}
print_err(){
echo -e "\e[31m$1\e[0m"
exit
}
check_utils(){
printf "%s: " $1
if command -v $1 &> /dev/null
then
print_ok "ok\r"
else
print_err "no\r"
fi
}
print_msg "Checking utilities..."
check_utils wget
check_utils 7z
print_msg "Create the /home/autobuild folder..."
sudo rm -rf ~/autobuild /home/autobuild
mkdir -p ~/autobuild/tools
sudo ln -sf ~/autobuild /home/autobuild
print_ok "Successfully!"
print_msg "Download the kos32-gcc toolchain..."
wget http://ftp.kolibrios.org/users/Serge/new/Toolchain/x86_64-linux-kos32-5.4.0.7z -O ~/autobuild/tools/kos32-toolchain.7z
print_ok "Successfully!"
print_msg "Extracting files ..."
cd ~/autobuild/tools/
7z x -y kos32-toolchain.7z
rm -rf kos32-toolchain.7z
print_ok "Successfully!"
print_msg "Downloading libraries..."
cd ~/autobuild/tools/win32/mingw32
wget http://ftp.kolibrios.org/users/Serge/new/Toolchain/sdk-28-10-16.7z
7z x -y sdk-28-10-16.7z
rm -rf sdk-28-10-16.7z
print_ok "Successfully!"
print_msg "Updating libraries..."
cd ~/autobuild/tools/win32/mingw32/lib
wget http://builds.kolibrios.org/en_US/data/contrib/sdk/lib/libdll.a -O libdll.a
wget http://builds.kolibrios.org/en_US/data/contrib/sdk/lib/libfreetype.a -O libfreetype.a
wget http://builds.kolibrios.org/en_US/data/contrib/sdk/lib/libc.dll.a -O libc.dll.a
wget http://builds.kolibrios.org/en_US/data/contrib/sdk/lib/libSDLn.a -O libSDLn.a
wget http://builds.kolibrios.org/en_US/data/contrib/sdk/lib/libz.dll.a -O libz.dll.a
print_ok "Successfully!"
print_msg "Downloading libisl..."
cd /tmp
sudo wget http://board.kolibrios.org/download/file.php?id=8301libisl.so.10.2.2.7z -O /tmp/libisl.so.10.2.2.7z
sudo 7z x -y libisl.so.10.2.2.7z
if ! [ -d /usr/lib/x86_64-linux-gnu/ ]; then
sudo mkdir -p /usr/lib/x86_64-linux-gnu/
fi
sudo mv /tmp/libisl.so.10.2.2 /usr/lib/x86_64-linux-gnu/libisl.so.10.2.2
sudo ln -sf /usr/lib/x86_64-linux-gnu/libisl.so.10.2.2 /usr/lib/x86_64-linux-gnu/libisl.so.10
sudo ln -sf /usr/lib/x86_64-linux-gnu/libisl.so.10.2.2 /usr/lib/libisl.so.10
sudo chmod go-w /usr/lib/x86_64-linux-gnu/libisl.so.10
sudo chmod go-w /usr/lib/x86_64-linux-gnu/libisl.so.10.2.2
print_ok "Successfully!"
print_msg "Fixing libmpfr..."
sudo ln -sf /usr/lib/x86_64-linux-gnu/libmpfr.so.6 /usr/lib/x86_64-linux-gnu/libmpfr.so.4
sudo ln -sf /usr/lib/libmpfr.so.6 /usr/lib/libmpfr.so.4
print_ok "Successfully!"
if ! grep -q 'export PATH=$PATH:/home/autobuild/tools/win32/bin' ~/.bashrc; then
export PATH=$PATH:/home/autobuild/tools/win32/bin
print_msg "Adding '/home/autobuild/tools/win32/bin' to '~/.bashrc'"
echo 'export PATH=$PATH:/home/autobuild/tools/win32/bin' >> ~/.bashrc
fi
print_ok "Installation was successful!"