Skip to content

Commit

Permalink
Upgrade release workflow (Riey#278)
Browse files Browse the repository at this point in the history
* Update scripts

* Allow option for skip engine build

* Only copy engine when it built

* Update release workflow
  • Loading branch information
Riey authored Feb 19, 2021
1 parent 76a8db5 commit 7583eec
Show file tree
Hide file tree
Showing 13 changed files with 280 additions and 110 deletions.
284 changes: 208 additions & 76 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,117 +3,249 @@ name: Release
on:
push:
tags:
- 'v*'
- "v*"

env:
DOCKER_BUILDKIT: 1

jobs:
# Disable until https://github.com/actions/virtual-environments/issues/2658 fixed
# build-arch:
# runs-on: ubuntu-20.04

# steps:
# - uses: actions/checkout@v2
# - name: Run docker
# run: |
# docker build --file build-docker/arch/Dockerfile --tag riey/kime-build:arch .
# docker run --name kime-arch riey/kime-build:arch
# mkdir /tmp/out
# docker cp kime-arch:/opt/kime-out/kime.tar.xz /tmp/out/

# - name: Upload tar.xz
# uses: actions/upload-artifact@v2
# with:
# name: arch
# path: /tmp/out/kime.tar.xz

# ubuntu build is run on native
build-ubuntu:
create-release:
runs-on: ubuntu-20.04

outputs:
url: ${{ steps.create_release.outputs.upload_url }}

steps:
- name: Create draft release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: false

build-engine:
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2
# Remove apt repos that are known to break from time to time
# See https://github.com/actions/virtual-environments/issues/323
- name: Build engine
run: |
cargo build --release -p kime-engine-capi -p kime-check
strip -s ./target/release/libkime_engine.so
strip -s ./target/release/kime-check
- name: Upload engine
uses: actions/upload-artifact@v2
with:
name: engine
path: ./target/release/libkime_engine.so
- name: Upload check
uses: actions/upload-artifact@v2
with:
name: check
path: ./target/release/kime-check

build-other:
needs:
- build-engine
- create-release

runs-on: ubuntu-18.04

steps:
- name: Remove broken apt repos [Ubuntu]
run: |
for apt_file in `grep -lr microsoft /etc/apt/sources.list.d/`; do sudo rm $apt_file; done
- name: Build deb
- uses: actions/checkout@v2
- name: Install deps
run: |
sudo apt-get update
sudo apt-get install -y build-essential git gcc libclang-10-dev llvm cmake extra-cmake-modules cargo pkg-config
sudo apt-get install -y build-essential git gcc libclang-10-dev llvm cargo pkg-config
sudo apt-get install -y libpango1.0-dev libcairo2-dev libgtk2.0-dev libgtk-3-dev libglib2.0 libxcb1 libappindicator3-dev
sudo apt-get install -y qt5-default qtbase5-dev qtbase5-private-dev libqt5gui5
mkdir -pv /opt/kime-out
ci/build_deb.sh
wget https://github.com/Kitware/CMake/releases/download/v3.19.5/cmake-3.19.5-Linux-x86_64.sh && sudo sh cmake-3.19.5-Linux-x86_64.sh --skip-license --prefix=/usr
- name: Download engine
uses: actions/download-artifact@v2
with:
name: engine
path: .

- name: Download check
uses: actions/download-artifact@v2
with:
name: check
path: .

- name: Install engine
run: sudo mv ./libkime_engine.so /usr/lib

- name: Upload artifacts
- name: Build
run: |
KIME_SKIP_ENGINE=1 scripts/build.sh -ar
cp /usr/lib/libkime_engine.so ./build/out
mv ./kime-check ./build/out
scripts/release-zst.sh .
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ubuntu
path: /opt/kime-out/*
name: other
path: ./build/out/*

- name: Upload zst
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.url }}
asset_path: ./kime.tar.zst
asset_name: kime-${{ github.ref }}.tar.zst
asset_content_type: application/zstd

upload:
build-qt:
needs:
# Disable until https://github.com/actions/virtual-environments/issues/2658 fixed
# - build-arch
- build-ubuntu
- build-engine
- create-release

runs-on: ubuntu-18.04

strategy:
matrix:
qt5:
- 5.9.5
- 5.11.3
- 5.12.8
- 5.14.2
- 5.15.2

runs-on: ubuntu-20.04

steps:
- name: Checkout workdir
run: mkdir /tmp/work && cd /tmp/work
# Disable until https://github.com/actions/virtual-environments/issues/2658 fixed
# - name: Download arch artifact
# uses: actions/download-artifact@v2
# with:
# name: arch
# path: arch
- name: Download ubuntu artifact
- name: Download engine
uses: actions/download-artifact@v2
with:
name: ubuntu
path: ubuntu
- name: Create draft release
id: create_release
uses: actions/create-release@v1
name: engine
path: .

- name: Install engine
run: sudo cp ./libkime_engine.so /usr/lib

- name: Cache Qt-${{ matrix.qt5 }}
id: cache-qt
uses: actions/cache@v2
with:
path: /opt/Qt
key: ${{ runner.os }}-QtCache-${{ matrix.qt5 }}

- name: Install Qt-${{ matrix.qt5 }}
uses: jurplel/install-qt-action@v2
with:
dir: /opt
version: ${{ matrix.qt5 }}
cached: ${{ steps.cache-qt.outputs.cache-hit }}
aqtversion: ==1.1.1
py7zrversion: ==0.13.0

- uses: actions/checkout@v2

- name: Build Qt-${{ matrix.qt5 }}
run: |
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_QT5=ON ../src
make -j$(nproc --all)
strip -s ./lib/libkime-qt5.so
- name: Upload Qt-${{ matrix.qt5 }} artifact
uses: actions/upload-artifact@v2
with:
name: qt-${{matrix.qt5}}
path: build/lib/libkime-qt5.so

- name: Upload Qt-${{ matrix.qt5 }} file
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: false
upload_url: ${{ needs.create-release.outputs.url }}
asset_path: build/lib/libkime-qt5.so
asset_name: libkime-qt5-${{ matrix.qt5 }}.so
asset_content_type: application/x-sharedlib

package-arch:
needs:
- build-other
- build-qt
- create-release

runs-on: ubuntu-20.04

strategy:
fail-fast: false
matrix:
include:
- qt5: 5.9.5
pkg: deb
name: ubuntu-18.04
- qt5: 5.12.8
pkg: deb
name: ubuntu-20.04
- qt5: 5.14.2
pkg: deb
name: ubuntu-20.10
- qt5: 5.11.3
pkg: deb
name: debian-buster
- qt5: 5.15.2
pkg: zst
name: latest

steps:
- uses: actions/checkout@v2

# Disable until https://github.com/actions/virtual-environments/issues/2658 fixed
# - name: Upload archive
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }}
# asset_path: ./kime.tar.xz
# asset_name: kime-arch-${{ github.ref }}.tar.xz
# asset_content_type: application/x-xz

- name: Upload archive
- name: Create out folder
run: mkdir -pv ./build/out

- name: Download qt artifact
uses: actions/download-artifact@v2
with:
name: qt-${{ matrix.qt5 }}
path: ./build/out

- name: Download other artifact
uses: actions/download-artifact@v2
with:
name: other
path: ./build/out

- name: Create deb
if: ${{ matrix.pkg == 'deb' }}
run: scripts/release-deb.sh .

- name: Upload deb
if: ${{ matrix.pkg == 'deb' }}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./ubuntu/kime.tar.xz
asset_name: kime-ubuntu-${{ github.ref }}.tar.xz
upload_url: ${{ needs.create-release.outputs.url }}
asset_path: ./kime_amd64.deb
asset_name: kime_${{ matrix.name }}_${{ github.ref }}_amd64.deb
asset_content_type: application/x-xz

- name: Upload deb package
- name: Create xz
if: ${{ matrix.pkg == 'zst' }}
run: scripts/release-zst.sh .

- name: Upload xz
if: ${{ matrix.pkg == 'zst' }}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./ubuntu/kime_amd64.deb
asset_name: kime_${{ github.ref }}_amd64.deb
asset_content_type: application/x-xz
upload_url: ${{ needs.create-release.outputs.url }}
asset_path: ./kime.tar.zst
asset_name: kime_${{ matrix.name }}_${{ github.ref }}.tar.zst
asset_content_type: application/zstd
9 changes: 5 additions & 4 deletions build-docker/arch/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ RUN pacman -S --noconfirm --needed libappindicator-gtk3
RUN pacman -S --noconfirm --needed git
RUN mkdir -pv /opt/kime-out

COPY ci ./ci
COPY docs ./docs
COPY scripts ./scripts
COPY res ./res
COPY src ./src
COPY .git ./.git

Expand All @@ -23,4 +19,9 @@ COPY LICENSE .

RUN cargo fetch

COPY res ./res
COPY ci ./ci
COPY docs ./docs
COPY scripts ./scripts

ENTRYPOINT [ "ci/build_xz.sh" ]
9 changes: 5 additions & 4 deletions build-docker/debian-buster/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ RUN apt-get install -y libpango1.0-dev libcairo2-dev libgtk2.0-dev libgtk-3-dev
RUN apt-get install -y qt5-default qtbase5-dev qtbase5-private-dev libqt5gui5
RUN mkdir -pv /opt/kime-out

COPY ci ./ci
COPY docs ./docs
COPY scripts ./scripts
COPY res ./res
COPY src ./src
COPY .git ./.git

Expand All @@ -23,4 +19,9 @@ COPY LICENSE .

RUN cargo fetch

COPY res ./res
COPY ci ./ci
COPY docs ./docs
COPY scripts ./scripts

ENTRYPOINT [ "ci/build_deb.sh" ]
9 changes: 5 additions & 4 deletions build-docker/ubuntu-18.04/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ RUN apt-get install -y wget
RUN mkdir /tmp/cmake && cd /tmp/cmake && wget https://github.com/Kitware/CMake/releases/download/v3.19.5/cmake-3.19.5-Linux-x86_64.sh && sh cmake-3.19.5-Linux-x86_64.sh --skip-license --prefix=/usr
RUN mkdir -pv /opt/kime-out

COPY ci ./ci
COPY docs ./docs
COPY scripts ./scripts
COPY res ./res
COPY src ./src
COPY .git ./.git

Expand All @@ -25,4 +21,9 @@ COPY LICENSE .

RUN cargo fetch

COPY res ./res
COPY ci ./ci
COPY docs ./docs
COPY scripts ./scripts

ENTRYPOINT [ "ci/build_deb.sh" ]
Loading

0 comments on commit 7583eec

Please sign in to comment.