From 2233ff8907568e2c74beae08a0026f6ef0c82b06 Mon Sep 17 00:00:00 2001 From: Alexey Illarionov Date: Sat, 9 Mar 2024 17:43:55 +0300 Subject: [PATCH 1/4] Add build on Github Actions --- .github/workflows/Build.yml | 150 ++++++++++++++++++++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 .github/workflows/Build.yml diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml new file mode 100644 index 00000000..259dce70 --- /dev/null +++ b/.github/workflows/Build.yml @@ -0,0 +1,150 @@ +name: build + +on: + pull_request: + paths-ignore: + - '**/*.md' + push: + branches: + - 'main' + paths-ignore: + - '**/*.md' + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + +env: + CI: true + TERM: dumb + GRADLE_OPTS: >- + -Dorg.gradle.jvmargs="-Xmx3G -XX:MaxMetaspaceSize=1G -XX:SoftRefLRUPolicyMSPerMB=10 -XX:+UseParallelGC" + -Dorg.gradle.dependency.verification.console=verbose + KOTLIN_DAEMON_JVMARGS: >- + -Xmx1G -XX:MaxMetaspaceSize=320M -XX:SoftRefLRUPolicyMSPerMB=10 -XX:+UseParallelGC -XX:NewRatio=1 + ORG_GRADLE_PROJECT_verboseTest: true + +permissions: + checks: write + pull-requests: write + +jobs: + assemble: + name: Assemble, run tests + runs-on: ubuntu-latest + timeout-minutes: 60 + if: ${{ !contains(github.event.head_commit.message, '[ci skip]') }} + + steps: + - name: Checkout sources + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Insstall WABT + run: apt install wabt + + - name: Install EMSDK + uses: mymindstorm/setup-emsdk@v14 + with: + version: 3.1.55 + actions-cache-folder: 'emsdk-cache' + + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '21' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + with: + cache-encryption-key: ${{ secrets.GradleEncryptionKey }} + dependency-graph: generate + + - name: Assemble debug build, run tests + run: > + ./gradlew -Pkotlin.daemon.jvmargs="${{ env.KOTLIN_DAEMON_JVMARGS }}" + build --stacktrace --scan + + - name: Publish test results + uses: EnricoMi/publish-unit-test-result-action@v2 + if: ${{ !cancelled() && (github.actor != 'dependabot[bot]') }} + with: + comment_mode: off + junit_files: '**/build/test-results/**/*.xml' + check_name: "Test results" + + - name: Bundle the test reports + if: failure() + run: > + find . \( + -name .idea -o -path '*build/intermediates' -o -path '*build/.transforms' -o -path '*build/generated' + \) -prune -o + -type d -name 'reports' -print0 + | xargs -0 tar -c -I 'zstd -19 -T0' -f test-reports.tar.zst + + - name: Upload test reports + uses: actions/upload-artifact@v4 + if: failure() + with: + name: test-reports + path: test-reports.tar.zst + + static-analysis: + name: Style check + runs-on: ubuntu-latest + permissions: + security-events: write + timeout-minutes: 60 + if: >- + !contains(github.event.head_commit.message, '[ci skip]') + && github.actor != 'dependabot[bot]' + + steps: + - name: Checkout sources + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '21' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + with: + cache-encryption-key: ${{ secrets.GradleEncryptionKey }} + dependency-graph: generate + + - name: Run static code analyzers + run: > + ./gradlew -Pkotlin.daemon.jvmargs="${{ env.KOTLIN_DAEMON_JVMARGS }}" + styleCheck --continue + + - name: Uploads Detekt .sarif files to GitHub + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: ./build/reports/detekt/report.sarif + category: detekt + + - name: Uploads Diktat .sarif files to GitHub + uses: github/codeql-action/upload-sarif@v3 + with: + sarif_file: ./build/reports/diktat/diktat.sarif + category: diktat + + - name: Bundle the build report + if: ${{ !cancelled() }} + run: > + tar -c -I 'zstd -19 -T0' -f lint-outputs.tar.zst build/reports + + - name: Upload lint outputs + if: ${{ !cancelled() }} + uses: actions/upload-artifact@v4 + with: + name: lint-outputs + path: lint-outputs.tar.zst From 73293a9a469fe1c7c67b491b0f88280f2f285169 Mon Sep 17 00:00:00 2001 From: Alexey Illarionov Date: Sat, 9 Mar 2024 18:00:03 +0300 Subject: [PATCH 2/4] sudo apt --- .github/workflows/Build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 259dce70..31c570c8 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -43,7 +43,7 @@ jobs: fetch-depth: 0 - name: Insstall WABT - run: apt install wabt + run: sudo apt-get install wabt - name: Install EMSDK uses: mymindstorm/setup-emsdk@v14 From 5af7b4c892c9ddfbc0984b1dc1cb996f9e781835 Mon Sep 17 00:00:00 2001 From: Alexey Illarionov Date: Sat, 9 Mar 2024 18:03:50 +0300 Subject: [PATCH 3/4] add gradle-enterprise-gradle-plugin key --- gradle/verification-metadata.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index b3fb6140..c216ae3d 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -23,6 +23,10 @@ + + + + From e9b1f47e056dd15f4ba67af02687ed860dcc480b Mon Sep 17 00:00:00 2001 From: Alexey Illarionov Date: Sat, 9 Mar 2024 18:18:07 +0300 Subject: [PATCH 4/4] wip --- .github/workflows/Build.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index 31c570c8..2c8fc13a 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -42,8 +42,11 @@ jobs: with: fetch-depth: 0 - - name: Insstall WABT - run: sudo apt-get install wabt + - name: Install WABT + run: | + curl -fsSL https://github.com/WebAssembly/wabt/releases/download/1.0.34/wabt-1.0.34-ubuntu.tar.gz | \ + tar -C $HOME -xzf - + echo "$HOME/wabt-1.0.34/bin" >> $GITHUB_PATH - name: Install EMSDK uses: mymindstorm/setup-emsdk@v14