Release #502
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: Release | |
on: | |
schedule: | |
- cron: '0 2 * * *' # run at 2 AM UTC | |
workflow_dispatch: | |
inputs: | |
tag_name: | |
description: 'Tag name for release' | |
required: false | |
default: nightly | |
push: | |
tags: | |
- v[0-9]+.[0-9]+.[0-9]+ | |
env: | |
cache-version: v9 | |
jobs: | |
check-new-commit: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- run: > | |
test \( "${{github.event_name}}" == "schedule" | |
-a 0 -lt $(git log --oneline --since "yesterday" -- . ":!.github" ":!.gitignore" ":!.golangci.yml" | wc -l) \) | |
-o \( "${{github.event_name}}" != "schedule" \) | |
linux: | |
needs: [check-new-commit] | |
strategy: | |
matrix: | |
go-version: [1.18.x] | |
platform: [ubuntu-20.04] | |
qtversion: [5.15.6] | |
runs-on: ${{ matrix.platform }} | |
env: | |
GOPATH: ${{ github.workspace }} | |
QT_DIR: ${{ github.workspace }}/Qt | |
QT_VERSION: ${{ matrix.qtversion }} | |
QT_API: 5.13.0 | |
QT_DEBUG: false | |
GO111MODULE: off | |
GOPROXY: https://goproxy.io | |
QT_STATIC: true | |
QT_QMAKE_DIR: ${{ github.workspace }}/Qt/${{ matrix.qtversion }}/gcc_64/bin | |
steps: | |
- name: Linux prerequisites | |
run: | | |
sudo apt update | |
sudo apt-get -y install build-essential libglu1-mesa-dev libpulse-dev libglib2.0-dev cmake | |
sudo apt-get --no-install-recommends -qq -y install fontconfig libasound2 libegl1-mesa libnss3 libpci3 libxcomposite1 libxcursor1 libxi6 libxrandr2 libxtst6 | |
sudo apt-get --no-install-recommends -qq -y install libdbus-1-dev libssl-dev libzstd-dev | |
#sudo apt-get --no-install-recommends -qq -y install libfontconfig1-dev libfreetype6-dev libx11-dev libx11-xcb-dev libxext-dev libxfixes-dev libxi-dev libxrender-dev libxcb1-dev libxcb-glx0-dev libxcb-keysyms1-dev libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync0-dev libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0-dev libxcb-xinerama0-dev libxkbcommon-dev libxkbcommon-x11-dev | |
sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev | |
sudo apt-get install libwayland-dev libwayland-egl++ wayland-scanner++ | |
- name: Install Go | |
uses: actions/setup-go@v1 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- uses: actions/cache@v2 | |
id: cache-qt-linux | |
with: | |
path: ${{ github.workspace }}/Qt/${{ matrix.qtversion }}/gcc_64 | |
key: ${{ matrix.qtversion }}-qt-linux-${{ env.cache-version }} | |
- name: Build Qt and deploy | |
if: ${{ steps.cache-qt-linux.outputs.cache-hit != 'true' }} | |
run: | | |
curl -L -o qt-everywhere-opensource-src-${{ matrix.qtversion }}.tar.xz https://download.qt.io/official_releases/qt/5.15/${{ matrix.qtversion }}/single/qt-everywhere-opensource-src-${{ matrix.qtversion }}.tar.xz | |
tar Jxf qt-everywhere-opensource-src-${{ matrix.qtversion }}.tar.xz | |
rm qt-everywhere-opensource-src-${{ matrix.qtversion }}.tar.xz | |
mv qt-everywhere-src-${{ matrix.qtversion }} qt5 | |
ls -l ${{ github.workspace }}/qt5 | |
cd ${{ github.workspace }}/qt5 && ./configure -prefix ${{ github.workspace }}/Qt/${{ matrix.qtversion }}/gcc_64 -no-icu -confirm-license -opensource -static -qt-zlib -qt-libpng -qt-libjpeg -xcb -xcb-xlib -bundled-xcb-xinput -sysconfdir /etc/xdg -dbus-runtime -openssl-runtime -opengl -optimize-size -skip qtwebengine -skip qtfeedback -skip qtpim -feature-wayland-client -nomake tests -nomake examples && make -j $(grep -c ^processor /proc/cpuinfo) && make install -j $(grep -c ^processor /proc/cpuinfo) | |
- name: Build fcitx5 | |
env: | |
FILE: ${{ github.workspace }}/fcitx-qt5/qt5/platforminputcontext/CMakeLists.txt | |
CMAKE_PREFIX_PATH: ${{ github.workspace }}/Qt/${{ matrix.qtversion }}/gcc_64/lib/cmake | |
Qt5_DIR: ${{ github.workspace }}/Qt/${{ matrix.qtversion }}/gcc_64/lib/cmake/Qt5 | |
run: | | |
ls -l $CMAKE_PREFIX_PATH | |
ls -l $Qt5_DIR | |
ls -l $QT_QMAKE_DIR | |
git clone -q --depth 1 https://github.com/fcitx/fcitx-qt5.git | |
echo -e "ADD_DEFINITIONS(-DQT_STATICPLUGIN)\n$(cat $FILE)" > $FILE | |
echo -e "find_package(Qt5 REQUIRED COMPONENTS Core Gui DBus)\n$(cat $FILE)" > $FILE | |
echo -e "$(head -n -5 $FILE)" > $FILE | |
sed -i -e 's/ MODULE / STATIC /g' $FILE | |
cat $FILE | |
cd fcitx-qt5/qt5/platforminputcontext && cmake . && make -j $(grep -c ^processor /proc/cpuinfo) | |
- name: Copy libfcitxplatforminputcontextplugin.a | |
run: | | |
cp -p ${{ github.workspace }}/fcitx-qt5/qt5/platforminputcontext/libfcitxplatforminputcontextplugin.a ${{ github.workspace }}/Qt/${{ matrix.qtversion }}/gcc_64/plugins/platforminputcontexts/ | |
- name: Get Qt binding for Go | |
run: | | |
go get -v github.com/therecipe/qt/cmd/... | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
path: ./src/github.com/${{ github.repository }} | |
- name: Free disk space | |
run: | | |
sudo swapoff -a | |
sudo rm -f /swapfile | |
sudo apt clean | |
- uses: actions/cache@v2 | |
id: cache-qt-bindings-linux | |
with: | |
path: ${{ github.workspace }}/src/github.com/therecipe | |
key: ${{ matrix.qtversion }}-qtbindings-linux-${{ env.cache-version }} | |
- name: Generate Qt bindings | |
env: | |
Qt5_DIR: ${{ github.workspace }}/Qt/${{ matrix.qtversion }}/gcc_64/lib/cmake/Qt5 | |
if: ${{ steps.cache-qt-bindings-linux.outputs.cache-hit != 'true' }} | |
run: $(go env GOPATH)/bin/qtsetup -test=false | |
- name: Get dependencies | |
run: | | |
go get -v -t -d github.com/${{ github.repository }}/... | |
cd ${{ github.workspace }}/src/github.com/${{ github.repository }}/cmd/goneovim | |
$(go env GOPATH)/bin/qtmoc | |
- name: Retrieve version | |
id: version-linux | |
run: | | |
cd ${{ github.workspace }}/src/github.com/${{ github.repository }} | |
echo "::set-output name=GONEOVIM_VERSION::$(git describe --tags)" | |
- name: Build | |
run: | | |
cd ${{ github.workspace }}/src/github.com/${{ github.repository }}/cmd/goneovim | |
$(go env GOPATH)/bin/qtdeploy -ldflags "-X github.com/akiyosi/goneovim/editor.Version=${{ steps.version-linux.outputs.GONEOVIM_VERSION }}" build desktop | |
cp -pR ../../runtime ./deploy/linux/ | |
- if: github.event_name == 'workflow_dispatch' | |
run: echo "ARCHIVE_NAME=goneovim-linux" >> $GITHUB_ENV | |
- if: github.event_name == 'schedule' | |
run: echo "ARCHIVE_NAME=goneovim-linux" >> $GITHUB_ENV | |
- if: github.event_name == 'push' | |
run: echo "ARCHIVE_NAME=goneovim-${{ steps.version-linux.outputs.GONEOVIM_VERSION }}-linux" >> $GITHUB_ENV | |
- name: Archive | |
run: | | |
cd ${{ github.workspace }}/src/github.com/${{ github.repository }}/cmd/goneovim/deploy | |
mv linux "$ARCHIVE_NAME" | |
tar -jcvf "$ARCHIVE_NAME".tar.bz2 "$ARCHIVE_NAME" | |
- name: Upload | |
uses: actions/upload-artifact@v1 | |
with: | |
name: goneovim-linux | |
path: ${{ github.workspace }}/src/github.com/${{ github.repository }}/cmd/goneovim/deploy/${{ env.ARCHIVE_NAME }}.tar.bz2 | |
windows: | |
needs: [check-new-commit] | |
strategy: | |
matrix: | |
go-version: [1.18.x] | |
platform: [windows-latest] | |
qtversion: [5.14.1] | |
runs-on: ${{ matrix.platform }} | |
env: | |
GOPATH: C:\ | |
GOROOT: C:\go-root | |
QT_VERSION: ${{ matrix.qtversion }} | |
# QT_DIR: ${{ github.workspace }}\Qt | |
QT_API: 5.13.0 | |
QT_MSYS2: true | |
QT_MSYS2_DIR: D:\a\_temp\msys64\ | |
QT_MSYS2_STATIC: true | |
QT_MSVC: false | |
QT_DEBUG: false | |
# QT_DEBUG_CONSOLE: true | |
GO111MODULE: off | |
CGO_CFLAGS_ALLOW: ".*" | |
CGO_CXXFLAGS_ALLOW: ".*" | |
CGO_LDFLAGS_ALLOW: ".*" | |
# CGO_ENABLED: 1 | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
steps: | |
- name: Install Go | |
continue-on-error: true | |
run: | | |
curl -sL --retry 10 --retry-delay 60 -O https://dl.google.com/go/go1.18.5.windows-amd64.zip | |
expand-archive -path go1.18.5.windows-amd64.zip -destinationpath . | |
Move-Item -Path go -Destination C:\go-root | |
- name: Setup MSYS2 and install Qt5 | |
uses: msys2/setup-msys2@v2 | |
with: | |
update: true | |
msystem: mingw64 | |
install: mingw-w64-x86_64-toolchain | |
- shell: msys2 {0} | |
run: | | |
pacman --noconfirm -S sed git unzip zip mingw-w64-x86_64-qt-creator mingw-w64-x86_64-qt5-static | |
pacman -Scc | |
pacman -Sc | |
- name: Patch qt5 | |
shell: msys2 {0} | |
run: | | |
curl -sL --retry 10 --retry-delay 60 -O https://github.com/akiyosi/github-actions-playground/releases/download/qt5-patched-qtbug-71737/qt-5.15.5_patched-qtbug71737.zip | |
unzip qt-5.15.5_patched-qtbug71737.zip | |
cp -fpR qt5/* /mingw64/qt5-static/ | |
rm -fr qt5 | |
rm qt-5.15.5_patched-qtbug71737.zip | |
- name: Get Qt binding for Go | |
run: | | |
C:\go-root\bin\go.exe get -v -tags=no_env github.com/therecipe/qt/cmd/... | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
path: .\src\github.com\akiyosi\goneovim | |
- name: Copy checkout repogitory | |
shell: msys2 {0} | |
run: | | |
mkdir -p /c/src/github.com/akiyosi | |
cp -pR /d/a/goneovim/goneovim/src/github.com/akiyosi/goneovim /c/src/github.com/akiyosi/goneovim | |
- name: Retrieve version | |
id: version-windows | |
run: | | |
cd C:\src\github.com\akiyosi\goneovim | |
echo "::set-output name=GONEOVIM_VERSION::$(git describe --tags)" | |
- name: test version | |
run: | | |
echo ${{ steps.version-windows.outputs.GONEOVIM_VERSION }} | |
- uses: actions/cache@v2 | |
id: cache-qt-bindings-windows | |
with: | |
path: | | |
C:\src\github.com\therecipe\qt\* | |
!C:\src\github.com\therecipe\qt\.git | |
key: ${{ matrix.qtversion }}-qtbindings-windows-${{ env.cache-version }} | |
- name: Generate Qt bindings | |
if: ${{ steps.cache-qt-bindings-windows.outputs.cache-hit != 'true' }} | |
shell: msys2 {0} | |
run: | | |
export PATH=$PATH:/c/bin:/c/go-root/bin:/d/a/_temp/msys64/usr/bin | |
cp /c/bin/* /d/a/_temp/msys64/usr/bin | |
cp /c/go-root/bin/go /d/a/_temp/msys64/usr/bin | |
/c/bin/qtsetup -test=false | |
- name: Get dependencies | |
continue-on-error: true | |
run: | | |
go get -v -d github.com/${{ github.repository }}/... | |
- name: Generate moc | |
shell: msys2 {0} | |
run: | | |
export PATH=$PATH:/c/bin:/c/go-root/bin:/d/a/_temp/msys64/usr/bin | |
cd /c/src/github.com/akiyosi/goneovim/ | |
cd ./cmd/goneovim | |
/c/bin/qtmoc | |
- name: Build for windows | |
shell: msys2 {0} | |
run: | | |
export PATH=$PATH:/c/bin:/c/go-root/bin:/d/a/_temp/msys64/usr/bin | |
cd /c/src/github.com/akiyosi/goneovim/cmd/goneovim | |
/c/bin/qtdeploy -ldflags "-X github.com/akiyosi/goneovim/editor.Version=${{ steps.version-windows.outputs.GONEOVIM_VERSION }}" build desktop | |
cp -pR ../../runtime ./deploy/windows/ | |
- if: github.event_name == 'workflow_dispatch' | |
run: echo "ARCHIVE_NAME=goneovim-windows" >> $env:GITHUB_ENV | |
- if: github.event_name == 'schedule' | |
run: echo "ARCHIVE_NAME=goneovim-windows" >> $env:GITHUB_ENV | |
- if: github.event_name == 'push' | |
run: echo "ARCHIVE_NAME=goneovim-${{ steps.version-windows.outputs.GONEOVIM_VERSION }}-windows" >> $env:GITHUB_ENV | |
- name: Archive | |
shell: msys2 {0} | |
run: | | |
cd /c/src/github.com/akiyosi/goneovim/cmd/goneovim/deploy | |
mv windows ${{ env.ARCHIVE_NAME }} | |
zip -r ${{ env.ARCHIVE_NAME }}.zip ${{ env.ARCHIVE_NAME }} | |
- name: Upload | |
uses: actions/upload-artifact@v1 | |
with: | |
name: goneovim-windows | |
path: C:/src/github.com/akiyosi/goneovim/cmd/goneovim/deploy/${{ env.ARCHIVE_NAME }}.zip | |
macos: | |
needs: [check-new-commit] | |
strategy: | |
matrix: | |
go-version: [1.18.x] | |
platform: [macos-11] | |
qtversion: [5.15.2] | |
runs-on: ${{ matrix.platform }} | |
env: | |
GOPATH: ${{ github.workspace }} | |
QT_DIR: ${{ github.workspace }}/Qt | |
QT_VERSION: ${{ matrix.qtversion }} | |
QT_API: 5.13.0 | |
QT_DEBUG: false | |
GO111MODULE: off | |
GOPROXY: https://goproxy.io | |
QMAKE_APPLE_DEVICE_ARCHS: arm64 | |
# SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v1 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Install Qt for macOS | |
uses: jurplel/install-qt-action@v3 | |
with: | |
version: ${{ matrix.qtversion }} | |
host: mac | |
target: desktop | |
dir: ${{ github.workspace }} | |
modules: 'qtcharts qtdatavis3d qtpurchasing qtvirtualkeyboard qtwebengine qtnetworkauth qtwebglplugin qtscript' | |
setup-python: 'false' | |
- name: Get Qt binding for Go | |
run: | | |
go get -v github.com/therecipe/qt/cmd/... | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
path: ./src/github.com/${{ github.repository }} | |
- name: Retrieve version | |
id: version-macos-11 | |
run: | | |
cd ${{ github.workspace }}/src/github.com/${{ github.repository }} | |
echo "::set-output name=GONEOVIM_VERSION::$(git describe --tags)" | |
echo "::set-output name=GONEOVIM_VERSION_HASH::$(git rev-parse HEAD)" | |
- name: test version | |
run: | | |
echo ${{ steps.version-macos-11.outputs.GONEOVIM_VERSION }} | |
# - uses: actions/cache@v2 | |
# id: cache-qt-bindings-macos-11 | |
# with: | |
# path: ${{ github.workspace }}/src/github.com/therecipe | |
# key: ${{ matrix.qtversion }}-qtbindings-macos-11-${{ env.cache-version }} | |
#if: ${{ steps.cache-qt-bindings-macos-11.outputs.cache-hit != 'true' }} | |
- name: Generate Qt bindings | |
continue-on-error: true | |
run: $(go env GOPATH)/bin/qtsetup -test=false | |
- name: Get dependencies | |
run: | | |
go get -v -t -d github.com/${{ github.repository }}/... | |
cd ${{ github.workspace }}/src/github.com/${{ github.repository }}/cmd/goneovim | |
$(go env GOPATH)/bin/qtmoc | |
- name: Build | |
run: | | |
cd ${{ github.workspace }}/src/github.com/${{ github.repository }}/cmd/goneovim | |
$(go env GOPATH)/bin/qtdeploy -ldflags "-X github.com/akiyosi/goneovim/editor.Version=${{ steps.version-macos-11.outputs.GONEOVIM_VERSION }}" build desktop | |
cp -pR ../../runtime ./deploy/darwin/goneovim.app/Contents/Resources/ | |
cd ${{ github.workspace }}/src/github.com/${{ github.repository }}/ | |
/usr/libexec/PlistBuddy -c "Add :CFBundleVersion string ${{ steps.version-macos-11.outputs.GONEOVIM_VERSION_HASH }}" "./cmd/goneovim/deploy/darwin/goneovim.app/Contents/Info.plist" | |
/usr/libexec/PlistBuddy -c "Add :CFBundleShortVersionString string ${{ steps.version-macos-11.outputs.GONEOVIM_VERSION }}" "./cmd/goneovim/deploy/darwin/goneovim.app/Contents/Info.plist" | |
cd ${{ github.workspace }}/src/github.com/${{ github.repository }}/cmd/goneovim/deploy/darwin/goneovim.app/Contents/Frameworks/ | |
rm -fr QtQuick.framework | |
rm -fr QtVirtualKeyboard.framework | |
- if: github.event_name == 'workflow_dispatch' | |
run: echo "ARCHIVE_NAME=goneovim-macos" >> $GITHUB_ENV | |
- if: github.event_name == 'schedule' | |
run: echo "ARCHIVE_NAME=goneovim-macos" >> $GITHUB_ENV | |
- if: github.event_name == 'push' | |
run: echo "ARCHIVE_NAME=goneovim-${{ steps.version-macos-11.outputs.GONEOVIM_VERSION }}-macos" >> $GITHUB_ENV | |
- name: Archive | |
run: | | |
cd ${{ github.workspace }}/src/github.com/${{ github.repository }}/cmd/goneovim/deploy | |
mv darwin "$ARCHIVE_NAME" | |
tar -jcvf "$ARCHIVE_NAME".tar.bz2 "$ARCHIVE_NAME" | |
- name: Upload | |
uses: actions/upload-artifact@v1 | |
with: | |
name: goneovim-macos | |
path: ${{ github.workspace }}/src/github.com/${{ github.repository }}/cmd/goneovim/deploy/${{ env.ARCHIVE_NAME }}.tar.bz2 | |
publish: | |
needs: [linux, windows, macos] | |
runs-on: ubuntu-20.04 | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/download-artifact@v2 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y gettext-base | |
- if: github.event_name == 'workflow_dispatch' | |
run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV | |
- if: github.event_name == 'schedule' | |
run: echo 'TAG_NAME=nightly' >> $GITHUB_ENV | |
- if: github.event_name == 'push' | |
run: | | |
TAG_NAME=${{ github.ref }} | |
echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV | |
- if: env.TAG_NAME == 'nightly' | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
(echo 'SUBJECT=Goneovim Nightly build'; | |
echo 'PRERELEASE=--prerelease') >> $GITHUB_ENV | |
gh release delete nightly --yes || true | |
git push origin :nightly || true | |
- if: env.TAG_NAME != 'nightly' | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
(echo "SUBJECT=Goneovim $TAG_NAME"; | |
echo 'PRERELEASE=') >> $GITHUB_ENV | |
- name: Publish | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release create $TAG_NAME $PRERELEASE --title "$SUBJECT" --target $GITHUB_SHA /home/runner/work/goneovim/goneovim/goneovim-macos/* /home/runner/work/goneovim/goneovim/goneovim-linux/* /home/runner/work/goneovim/goneovim/goneovim-windows/* | |