in-app update #378
Workflow file for this run
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: ci | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
lint: | |
runs-on: macos-14 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true # needs fcitx5/.clang-format | |
- name: Install dependencies | |
run: brew install clang-format swift-format | |
- name: Lint | |
run: | | |
find macosfrontend macosnotifications webpanel src -name '*.cpp' -o -name '*.h' | xargs clang-format -Werror --dry-run -style=file:fcitx5/.clang-format | |
swift-format lint --configuration .swift-format.json -rs macosfrontend macosnotifications src assets | |
for file in $(git ls-files | grep '\.swift$'); do | |
if grep 'NSLog(' $file; then | |
echo "Please use Logging module instead of NSLog" | |
exit 1 | |
fi | |
if grep 'ScrollView.*\.horizontal' $file; then | |
echo "Please don't use horizontal scroll" | |
exit 1 | |
fi | |
done | |
build: | |
needs: lint | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-14, macos-13] | |
include: | |
- { os: macos-14, arch: arm64 } | |
- { os: macos-13, arch: x86_64 } | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- name: Install dependencies | |
run: | | |
brew install \ | |
nlohmann-json \ | |
xkeyboardconfig \ | |
iso-codes \ | |
extra-cmake-modules \ | |
ninja | |
./install-deps.sh ${{ matrix.arch }} | |
npm i -g pnpm | |
pnpm --prefix=fcitx5-webview i | |
- name: Build | |
run: | | |
cmake -B build -G Ninja \ | |
-DCMAKE_Swift_COMPILER=`which swiftc` \ | |
-DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} \ | |
-DCMAKE_BUILD_TYPE=Release | |
cmake --build build | |
sudo cmake --install build | |
tar cjvf Fcitx5-${{ matrix.arch }}.tar.bz2 -C "/Library/Input Methods" Fcitx5.app | |
- name: Test | |
run: | | |
cd build | |
ctest --output-on-failure | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Fcitx5-${{ matrix.arch }}.tar.bz2 | |
path: | | |
Fcitx5-${{ matrix.arch }}.tar.bz2 | |
- name: Check validity | |
run: ./check-validity.sh | |
- name: Setup tmate session | |
if: ${{ failure() }} | |
uses: mxschmitt/action-tmate@v3 | |
release: | |
needs: build | |
if: ${{ github.ref == 'refs/heads/master' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
- name: Create Nightly release | |
uses: 'marvinpinto/action-automatic-releases@latest' | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
automatic_release_tag: latest | |
prerelease: true | |
title: "Nightly Build" | |
files: | | |
Fcitx5-x86_64.tar.bz2 | |
Fcitx5-arm64.tar.bz2 |