Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add build on Github Actions #1

Merged
merged 4 commits into from
Mar 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
153 changes: 153 additions & 0 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
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: 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
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
4 changes: 4 additions & 0 deletions gradle/verification-metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
<trusted-key id="4797B4F5DCC46CEA61059071A1AE06236CA2BA62" group="^com[.]diffplug($|([.].*))" regex="true"/>
<trusted-key id="5F6C2148AD4911FE308110E5F0D0AE433308B042" group="io.gitlab.arturbosch.detekt"/>
<trusted-key id="6F538074CCEBF35F28AF9B066A0975F8B1127B83" group="org.jetbrains.kotlin"/>
<trusted-key id="7B79ADD11F8A779FE90FD3D0893A028475557671">
<trusting group="com.gradle" name="gradle-enterprise-gradle-plugin"/>
<trusting group="org.gradle" name="github-dependency-graph-gradle-plugin"/>
</trusted-key>
<trusted-key id="837B2CBB1D966C80643A2D6527F164F945828C4C" group="^com[.]willowtreeapps($|([.].*))" regex="true"/>
<trusted-key id="8756C4F765C9AC3CB6B85D62379CE192D401AB61" group="com.diffplug.durian"/>
<trusted-key id="A5BD02B93E7A40482EB1D66A5F69AD087600B22C" group="org.ow2.asm"/>
Expand Down
Loading