Add coroutines-based API with StateFlow extensions #83
Workflow file for this run
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
| # https://github.com/Kotlin/multiplatform-library-template/blob/main/.github/workflows/gradle.yml | |
| # https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle | |
| name: CI | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| workflow_call: | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: macos-latest | |
| cov: on | |
| cmd: "./gradlew :kmp-socketio:jvmTest --info" | |
| - os: macos-latest | |
| cmd: "./gradlew :kmp-socketio:macosX64Test --info && ./kmp-socketio/src/webTest/start_server.sh && ./gradlew :kmp-socketio:jsBrowserTest --info && ./gradlew :kmp-socketio:wasmJsBrowserTest --info && ./kmp-socketio/src/webTest/stop_server.sh" | |
| - os: ubuntu-latest | |
| cmd: "./gradlew :kmp-socketio:linuxX64Test --info" | |
| - os: windows-latest | |
| cmd: "./gradlew :kmp-socketio:mingwX64Test --info" | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| pull-requests: write | |
| contents: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: "recursive" | |
| - uses: actions/setup-java@v4 | |
| with: | |
| java-version: "17" | |
| distribution: "temurin" | |
| cache: "gradle" | |
| - uses: gradle/actions/setup-gradle@v3 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 14 | |
| architecture: 'x64' | |
| - name: Setup Test Env | |
| run: | | |
| cd kmp-socketio/src/jvmTest/resources/ | |
| npm install | |
| - name: Run tests | |
| run: ${{ matrix.cmd }} | |
| - name: Gen coverage | |
| if: ${{ matrix.cov == 'on' }} | |
| run: | | |
| ./gradlew koverXmlReport | |
| - name: Add coverage to PR | |
| if: ${{ matrix.cov == 'on' }} | |
| id: jacoco | |
| uses: madrapps/jacoco-report@v1.7.1 | |
| with: | |
| paths: ${{ github.workspace }}/kmp-socketio/build/reports/kover/report.xml | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| min-coverage-overall: 80 | |
| min-coverage-changed-files: 80 | |
| pass-emoji: ":white_check_mark:" | |
| fail-emoji: ":negative_squared_cross_mark:" | |
| - name: Overall coverage check | |
| if: ${{ matrix.cov == 'on' && (steps.jacoco.outputs.coverage-overall < 80 || steps.jacoco.outputs.coverage-changed-files < 80) }} | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| core.setFailed("Coverage check failed! overall ${{ steps.jacoco.outputs.coverage-overall }}, diff ${{ steps.jacoco.outputs.coverage-changed-files }}.") | |
| - name: Create coverage summary json | |
| if: ${{ matrix.cov == 'on' }} | |
| uses: jsdaniell/create-json@v1.2.3 | |
| with: | |
| dir: kmp-socketio/build/reports/kover/ | |
| name: "coverage.json" | |
| json: '{"total":{"instructions":{"pct":${{ steps.jacoco.outputs.coverage-overall }} }}}' | |
| - name: Create Coverage Badges | |
| if: ${{ matrix.cov == 'on' }} | |
| uses: jaywcjlove/coverage-badges-cli@main | |
| with: | |
| source: ${{ github.workspace }}/kmp-socketio/build/reports/kover/coverage.json | |
| output: dist/badges.svg | |
| jsonPath: total.instructions.pct | |
| - name: Deploy | |
| uses: peaceiris/actions-gh-pages@v4 | |
| if: ${{ matrix.cov == 'on' && github.ref == 'refs/heads/main' }} | |
| with: | |
| commit_message: ${{ github.event.head_commit.message }} | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./dist |