CI: Fixed syntax of Ubuntu script #2
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: Ubuntu CI | |
on: | |
push: | |
branches: | |
- master | |
- stable | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
name: "${{ matrix.config.name }} | ${{ matrix.config.build_type }}" | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
config: | |
- { | |
name: "Ubuntu 18.04 x86_64", | |
os: ubuntu-latest, | |
container: "ubuntu:18.04", | |
generator: "Ninja", | |
extra_path: "/home/runner/Qt/5.15.2_static/bin", | |
build_type: "Release", | |
upload_directory: "www/ubuntu-18-04/", | |
qt_download: "https://wohlsoft.ru/docs/Software/QtBuilds/qt-5.15.2-static-ubuntu-18-04-x64-gcc8.tar.bz2", | |
qt_install_dir: "/home/runner/Qt", | |
qt_ver: "5.15.2_static", | |
qt_dir: "/home/runner/Qt/5.15.2_static/bin", | |
qt_lib_dir: "/home/runner/Qt/5.15.2_static/lib", | |
lftp_download: "https://wohlsoft.ru/docs/Software/lftp_4.9.1-1_amd64-ubuntu1604.deb", | |
lftp_install_pacakge: "lftp_4.9.1-1_amd64-ubuntu1604.deb", | |
deps_cmdline: "echo 'Ubuntu 18' \ | |
&& apt-get update --fix-missing -qq \ | |
&& apt-get install -y software-properties-common \ | |
&& add-apt-repository -y \"ppa:git-core/ppa\" \ | |
&& add-apt-repository -y \"ppa:ubuntu-sdk-team/ppa\" \ | |
&& add-apt-repository -y \"ppa:ubuntu-toolchain-r/test\" \ | |
&& apt-get update --fix-missing -qq \ | |
&& apt-get install -f -qq \ | |
&& apt-get install -qq sudo git p7zip-full ninja-build wget lftp \ | |
\"^libxcb.*\" libx11-dev libx11-xcb-dev libgtk-3-dev libgegl-dev libxcursor-dev \ | |
libxrender-dev libxrandr-dev libxext-dev libxi-dev libxss-dev libxt-dev libxv-dev \ | |
libxxf86vm-dev libxinerama-dev libxkbcommon-dev libfontconfig1-dev libasound2-dev \ | |
libpulse-dev libdbus-1-dev udev mtdev-tools webp libudev-dev libglm-dev libwayland-dev \ | |
libegl1-mesa-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libgles2-mesa \ | |
libgles2-mesa-dev libmirclient-dev libproxy-dev \ | |
gcc-8 g++-8 libc6 libstdc++6 \ | |
&& update-alternatives --remove-all gcc \ | |
&& update-alternatives --remove-all g++ \ | |
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 80 \ | |
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 80 \ | |
&& wget -q https://github.com/Kitware/CMake/releases/download/v3.15.4/cmake-3.15.4-Linux-x86_64.sh \ | |
&& chmod uog+x cmake-3.15.4-Linux-x86_64.sh \ | |
&& ./cmake-3.15.4-Linux-x86_64.sh --skip-license --prefix=/usr \ | |
&& git config --global --add safe.directory '*'" | |
} | |
steps: | |
- name: Check for the upload support | |
id: upload-check | |
shell: bash | |
run: | | |
if [[ "${{ secrets.builds_login }}" != '' && \ | |
"${{ secrets.builds_password }}" != '' && \ | |
"${{ secrets.builds_host }}" != '' ]]; then | |
echo "available=true" >> $GITHUB_OUTPUT; | |
else | |
echo "available=false" >> $GITHUB_OUTPUT; | |
fi | |
- name: Install Dependencies | |
shell: bash | |
run: | | |
if [[ ! -z "${{ matrix.config.deps_cmdline }}" ]]; then | |
eval ${{ matrix.config.deps_cmdline }} | |
fi | |
g++ --version | |
cmake --version | |
mkdir build-temp | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 3 | |
submodules: recursive | |
- uses: Wohlstand/[email protected] | |
- name: Check if a pull request | |
id: event-check | |
shell: bash | |
run: | | |
if [[ "${BRANCH_NAME}" == *"merge"* ]]; then | |
echo "--- This build is a pull-request ---" | |
echo "is_pull_request=true" >> $GITHUB_OUTPUT; | |
else | |
echo "--- This build is a normal branch build ---" | |
echo "is_pull_request=false" >> $GITHUB_OUTPUT; | |
fi | |
- name: Set up time zone to UTC+3 | |
shell: bash | |
run: | | |
echo 'Europe/Moscow' | sudo tee /etc/timezone | |
sudo dpkg-reconfigure --frontend noninteractive tzdata | |
sudo ntpdate ntp.ubuntu.com | |
echo $(TZ=Europe/Moscow date) | |
- name: Download Qt | |
if: matrix.config.qt_download | |
uses: carlosperate/download-file-action@v2 | |
with: | |
file-url: "${{ matrix.config.qt_download }}" | |
file-name: qt.tar.bz2 | |
- name: Extract Qt | |
if: matrix.config.qt_install_dir | |
shell: bash | |
run: | | |
sudo mkdir -p "${{ matrix.config.qt_install_dir }}" | |
sudo chown -R $USER:$USER "${{ matrix.config.qt_install_dir }}" | |
tar -xf qt.tar.bz2 -C "${{ matrix.config.qt_install_dir }}" | |
rm -f qt.tar.bz2 | |
- name: Download LFTP | |
if: matrix.config.lftp_download | |
uses: carlosperate/download-file-action@v2 | |
with: | |
file-url: "${{ matrix.config.lftp_download }}" | |
file-name: lftp.7z | |
- name: Install LFTP | |
if: matrix.config.lftp_download | |
shell: bash | |
run: | | |
sudo dpkg -i "./${{ matrix.config.lftp_install_pacakge }}" | |
rm -f "${{ matrix.config.lftp_install_pacakge }}" | |
- name: Configure | |
shell: bash | |
run: | | |
if [[ ! -z "${{ matrix.config.extra_path }}" ]]; then | |
export QT_VER="${{ matrix.config.qt_ver }}" | |
export QT_PATH="${{ matrix.config.qt_dir }}" | |
export QT_LIB_PATH="${{ matrix.config.qt_lib_dir }}" | |
echo "# ==============Qt paths================" > _paths.sh; | |
echo "QT_PATH=\"/home/runner/${QT_VER}/bin/\"" >> _paths.sh; | |
echo "QT_LIB_PATH=\"//home/runner/${QT_VER}/lib/\"" >> _paths.sh; | |
echo "QMake=\"qmake\"" >> _paths.sh; | |
echo "LRelease=\"lrelease\"" >> _paths.sh; | |
echo "" >> _paths.sh; | |
chmod u+x _paths.sh; | |
echo "============== _paths.sh =================" | |
cat _paths.sh | |
echo "==========================================" | |
export PATH=${{ matrix.config.extra_path }}:${PATH} | |
echo "PATH environment: ${PATH}" | |
fi | |
echo "=====================================" | |
qmake --version | |
echo "=====================================" | |
gcc --version | |
echo "=====================================" | |
git --version | |
echo "=====================================" | |
cmake --version | |
echo "=====================================" | |
- name: Build | |
shell: bash | |
run: | | |
if [[ "${BRANCH_NAME}" == *"merge"* ]]; then | |
BRANCH_NAME_RES="pull-request" | |
echo "-- Pull-request detected!" | |
else | |
BRANCH_NAME_RES=${BRANCH_NAME} | |
fi | |
export PATH=/home/runner/Qt/$QtStaticVersion/bin:$PATH | |
TZ=Europe/Moscow date +"%Y-%m-%d %H:%M:%S" > build-temp/build_date_${BRANCH_NAME_RES}_linux.txt | |
./build.sh no-pause ninja deploy static-qt portable | |
- name: Deploy to builds.wohlsoft.ru | |
if: success() && github.event_name != 'pull_request' && steps.event-check.outputs.is_pull_request == 'false' && steps.upload-check.outputs.available == 'true' | |
shell: bash | |
run: | | |
if [[ ! -z "${{ matrix.config.extra_path }}" ]]; then | |
export PATH=${{ matrix.config.extra_path }}:${PATH} | |
fi | |
if [[ "${BRANCH_NAME}" == *"merge"* ]]; then | |
BRANCH_NAME_RES="pull-request" | |
echo "-- Pull-request detected!" | |
else | |
BRANCH_NAME_RES=${BRANCH_NAME} | |
fi | |
UPLOAD_LIST="set ssl:verify-certificate no;" | |
for q in ./bin-cmake-release/*.tar.bz2; do | |
UPLOAD_LIST="${UPLOAD_LIST} put -O ${{ matrix.config.upload_directory }} $q;" | |
done | |
UPLOAD_LIST="${UPLOAD_LIST} put -O ./www/_versions build-temp/build_date_${BRANCH_NAME_RES}_linux.txt;" | |
UPLOAD_LIST="${UPLOAD_LIST} put -O ./www/_versions bin-cmake-release/versions/editor_${BRANCH_NAME_RES}.txt;" | |
UPLOAD_LIST="${UPLOAD_LIST} put -O ./www/_versions bin-cmake-release/versions/editor_stable_${BRANCH_NAME_RES}.txt;" | |
UPLOAD_LIST="${UPLOAD_LIST} put -O ./www/_versions bin-cmake-release/versions/engine_${BRANCH_NAME_RES}.txt;" | |
UPLOAD_LIST="${UPLOAD_LIST} put -O ./www/_versions bin-cmake-release/versions/engine_stable_${BRANCH_NAME_RES}.txt;" | |
lftp -e "${UPLOAD_LIST} exit" -u ${{ secrets.builds_login }},${{ secrets.builds_password }} ${{ secrets.builds_host }} | |
- name: List Build Directory | |
if: always() | |
shell: bash | |
run: | | |
git status | |
ls -lR build |