8000 Add GitHub build by lptr · Pull Request #338 · gradle/native-platform · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add GitHub build #338

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

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from
Draft
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
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{yaml,yml}]
indent_size = 2

[gradle/verification-metadata.xml]
indent_size = 3
116 changes: 116 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: "Build"

on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]

jobs:
build:
strategy:
matrix:
os:
- macos-12
- macos-13
- macos-14
- ubuntu-20.04
- ubuntu-22.04
- ubuntu-24.04
- windows-2019
- windows-2022
continue-on-error: true

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'

- uses: TheMrMilchmann/setup-msvc-dev@v3
if: runner.os == 'Windows'
with:
arch: x64
export-path-to-vs: VSINSTALLDIR
export-path-to-vcvarsall: VCVARSALLDIR

- name: Set up MSVC
if: runner.os == 'Windows'
run: |
"${env:VSINSTALLDIR}\VC\Auxiliary\Build\vcvars64.bat"
shell: pwsh

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
build-scan-publish: false
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
build-scan-terms-of-use-agree: "yes"

- name: Build
run: ./gradlew :file-events:check --continue

- name: Check for JVM crash logs (Unix)
if: failure() && runner.os != 'Windows'
run: |
mkdir -p crash_logs
find . -name 'hs_err_pid*.log' -exec mv {} crash_logs/ \;
if [ -n "$(ls -A crash_logs)" ]; then
echo "JVM crash logs found."
else
echo "No JVM crash logs found."
fi

- name: Check for JVM crash logs (Windows)
if: failure() && runner.os == 'Windows'
run: |
New-Item -ItemType Directory -Force -Path crash_logs
Get-ChildItem -Recurse -Filter 'hs_err_pid*.log' | Move-Item -Destination crash_logs
if (Test-Path -Path crash_logs\*) {
Write-Host "JVM crash logs found."
} else {
Write-Host "No JVM crash logs found."
}
shell: pwsh

- name: Upload JVM crash logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: jvm-crash-logs-${{ matrix.os }}
path: crash_logs/
if-no-files-found: ignore

- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.os }}
path: file-events/build/reports/tests/test

- name: Upload test results (JNI)
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.os }}-jni
path: file-events/build/reports/tests/testJni

# We need this to fail the PR in case any of the jobs in the matrix have failed
check-failure:
needs: build
runs-on: ubuntu-latest
steps:
- name: Check for job failures
run: |
if grep -q '::error' ${{ github.workflow }}-*; then
echo "One or more jobs failed"
exit 1
else
echo "All jobs passed"
fi
continue-on-error: false
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand All @@ -52,7 +52,7 @@ jobs:
- name: Autobuild (Java)
uses: github/codeql-action/autobuild@v1
if: ${{ matrix.language == 'java' }}

- name: Autobuild (cpp)
run: ./gradlew assemble
if: ${{ matrix.language == 'cpp' }}
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/java/gradlebuild/JniPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ void createPlatforms(PlatformContainer platformContainer) {
}

@Mutate void createToolChains(NativeToolChainRegistry toolChainRegistry) {
toolChainRegistry.create("visualCpp", VisualCpp.class);
toolChainRegistry.create("gcc", Gcc.class, toolChain -> {
// The core Gradle toolchain for gcc only targets x86 and x86_64 out of the box.
// https://github.com/gradle/gradle/blob/36614ee523e5906ddfa1fed9a5dc00a5addac1b0/subprojects/platform-native/src/main/java/org/gradle/nativeplatform/toolchain/internal/gcc/AbstractGccCompatibleToolChain.java
Expand All @@ -272,7 +273,6 @@ void createPlatforms(PlatformContainer platformContainer) {
toolChain.target("osx_aarch64");
}
});
toolChainRegistry.create("visualCpp", VisualCpp.class);
}

@Mutate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,9 +426,9 @@ class BasicFileEventFunctionsTest extends AbstractFileEventFunctionsTest {
expectLogMessage(SEVERE, Pattern.compile("Caught exception: Couldn't add watch.*: ${Pattern.quote(missingDirectory.absolutePath)}"))
}

// Apparently on macOS we can watch files
// Apparently on macOS and Windows we can watch files
// TODO Should we fail for this?
@IgnoreIf({ Platform.current().macOs })
@IgnoreIf({ Platform.current().macOs || Platform.current().windows })
def "fails when watching file"() {
given:
def file = new File(rootDir, "file.txt")
Expand Down Expand Up @@ -784,7 +784,7 @@ class BasicFileEventFunctionsTest extends AbstractFileEventFunctionsTest {
waitForChangeEventLatency()

// Restart watching freshly recreated directory on platforms that auto-unregister on deletion
if (!Platform.current().macOs) {
if (Platform.current().linux) {
watcher.startWatching([watchedDir])
}
// Ignore events received during setup
Expand Down
Loading
Loading
0