gha sucks #160
This file contains hidden or 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: | |
| - main | |
| pull_request: | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt install -y --no-install-recommends clang-format | |
| - name: Lint | |
| run: ./scripts/lint.sh | |
| build: | |
| runs-on: ubuntu-24.04 | |
| needs: lint | |
| env: | |
| NODE_VERSION: 18 | |
| JAVA_VERSION: "17" | |
| SDK_VERSION_MAJOR: 5.0.5 | |
| SDK_VERSION_MINOR: 310 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| arch: [arm64-v8a, x86_64] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| submodules: recursive | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: "temurin" | |
| java-version: ${{ env.JAVA_VERSION }} | |
| - name: Install OpenHarmony SDK | |
| uses: fcitx-contrib/ohpm-cli-tools@master | |
| with: | |
| major: ${{ env.SDK_VERSION_MAJOR }} | |
| minor: ${{ env.SDK_VERSION_MINOR }} | |
| - name: Run codelinter | |
| if: ${{ matrix.arch == 'x86_64' }} | |
| run: codelinter | |
| - name: Setup OpenHarmony SDK | |
| run: | | |
| # Setup npm registry | |
| npm config set registry https://repo.huaweicloud.com/repository/npm/ | |
| npm config set "@ohos:registry" https://repo.harmonyos.com/npm/ | |
| # Setup ohpm | |
| ohpm -v | |
| ohpm config set registry https://ohpm.openharmony.cn/ohpm/ | |
| ohpm config set strict_ssl false | |
| - name: Install dependencies | |
| run: | | |
| sudo apt install -y --no-install-recommends gettext | |
| ./scripts/install-deps.sh ${{ matrix.arch }} | |
| - name: Build HAP | |
| run: | | |
| git apply --directory=entry/src/main/cpp/fcitx5 patches/fcitx5.patch | |
| git apply --directory=entry/src/main/cpp/libime patches/libime.patch | |
| # Install dependencies | |
| ohpm install --all | |
| # Build product | |
| hvigorw -v | |
| hvigorw assembleHap --mode module -p product=default -p buildABI=${{ matrix.arch }} -p buildMode=release --parallel --no-daemon | |
| mv entry/build/default/outputs/default/entry-default-unsigned.hap fcitx5-harmony-${{ matrix.arch }}.hap | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: fcitx5-harmony-${{ matrix.arch }}.hap | |
| path: fcitx5-harmony-${{ matrix.arch }}.hap | |
| - name: Setup tmate session | |
| if: ${{ failure() }} | |
| uses: mxschmitt/action-tmate@v3 | |
| compare: | |
| if: ${{ github.ref != 'refs/heads/main' }} | |
| needs: build | |
| uses: ./.github/workflows/compare.yml | |
| release: | |
| needs: build | |
| if: ${{ github.ref == 'refs/heads/main' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| merge-multiple: true | |
| - name: Release | |
| uses: 'marvinpinto/action-automatic-releases@latest' | |
| with: | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| automatic_release_tag: latest | |
| prerelease: true | |
| title: "Nightly Build" | |
| files: | | |
| *.hap |