Skip to content

Commit

Permalink
Add native access system for getting IMPL_LOOKUP, and prefer if prese…
Browse files Browse the repository at this point in the history
…nt to Unsafe due to deprecation (#21)
  • Loading branch information
lukebemish authored Jul 16, 2024
1 parent fa1fb89 commit be7bc29
Show file tree
Hide file tree
Showing 56 changed files with 1,359 additions and 612 deletions.
170 changes: 158 additions & 12 deletions .github/workflows/build_pr.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,149 @@
{
"jobs": {
"natives-test": {
"needs": [
"build"
],
"runs-on": "${{ matrix.runner }}",
"strategy": {
"fail-fast": false,
"matrix": {
"os": [
"linux",
"windows",
"macos"
],
"arch": [
"x86_64",
"aarch64",
"arm"
],
"exclude": [
{
"os": "macos",
"arch": "i386"
},
{
"os": "macos",
"arch": "arm"
},
{
"os": "windows",
"arch": "arm"
},
{
"os": "windows",
"arch": "aarch64"
},
{
"os": "macos",
"arch": "x86_64"
},
{
"os": "linux",
"arch": "arm"
}
],
"include": [
{
"os": "macos",
"runner": "macos-latest",
"java_home": "$JAVA_HOME_17_arm64"
},
{
"os": "windows",
"runner": "windows-latest",
"java_home": "$JAVA_HOME_17_X64"
},
{
"os": "linux",
"runner": "ubuntu-latest",
"java_home": "$JAVA_HOME_17_X64"
},
{
"os": "linux",
"arch": "aarch64",
"qemu": "arm64",
"docker_arch": "arm64",
"docker": "arm64v8/eclipse-temurin:17"
},
{
"os": "linux",
"arch": "arm",
"qemu": "arm/v7",
"docker_arch": "arm/v7",
"docker": "arm32v7/eclipse-temurin:17"
}
]
}
},
"steps": [
{
"with": {
"name": "natives-test-environment"
},
"name": "Download Artifact",
"uses": "actions/download-artifact@v4",
"id": "download"
},
{
"name": "Setup QEMU",
"run": "sudo apt-get -qq install -y qemu qemu-user-static\ndocker run --rm --privileged multiarch/qemu-user-static --reset -p yes --credential yes",
"if": "${{ matrix.qemu }}"
},
{
"name": "Run with Docker",
"run": "docker run --workdir \"${GITHUB_WORKSPACE}\" -v \"${GITHUB_WORKSPACE}:${GITHUB_WORKSPACE}:z\" --rm --platform linux/${{ matrix.docker_arch }} -t ${{ matrix.docker }} /bin/bash -c 'mkdir ../working; cp -r ./ ../working/; cd ../working; java @args-${{ matrix.os }}.txt; return=$?; cp -r ./ ${GITHUB_WORKSPACE}/; cd ${GITHUB_WORKSPACE}; exit $return'",
"if": "${{ matrix.docker }}"
},
{
"shell": "bash",
"name": "Run",
"run": "${{ matrix.java_home }}/bin/java @args-${{ matrix.os }}.txt",
"if": "${{ !matrix.qemu }}"
},
{
"with": {
"name": "junit-test-results-native-${{ matrix.os }}-${{ matrix.arch }}",
"path": "results/TEST-*.xml"
},
"name": "Upload Results",
"uses": "actions/upload-artifact@v4",
"if": "(success() || failure()) && steps.download.outcome == 'success'"
}
]
},
"aggregate-test-results": {
"needs": [
"natives-test",
"build"
],
"runs-on": "ubuntu-latest",
"steps": [
{
"with": {
"pattern": "junit-test-results-*"
},
"name": "Download Artifact",
"uses": "actions/download-artifact@v4",
"id": "download"
},
{
"with": {
"name": "junit-test-results",
"path": "**/TEST-*.xml"
},
"name": "Upload Results",
"uses": "actions/upload-artifact@v4"
}
],
"if": "always()"
},
"build": {
"runs-on": "ubuntu-22.04",
"permissions": {
"packages": "read"
},
"steps": [
{
"name": "Setup Java",
Expand Down Expand Up @@ -38,17 +180,28 @@
},
{
"name": "Assemble",
"run": "./gradlew assemble",
"run": "./gradlew assemble :opensesame-natives:setupTestEnvironment",
"id": "assemble",
"env": {
"GITHUB_TOKEN": "${{ secrets.GITHUB_TOKEN }}",
"PR_NUMBER": "${{ github.event.pull_request.number }}"
}
},
{
"with": {
"name": "natives-test-environment",
"path": "natives/build/testEnvironment/*",
"retention-days": "1"
},
"name": "Upload natives-test-environment",
"uses": "actions/upload-artifact@v4"
},
{
"name": "Test",
"run": "./gradlew check --continue",
"id": "test",
"env": {
"GITHUB_TOKEN": "${{ secrets.GITHUB_TOKEN }}",
"PR_NUMBER": "${{ github.event.pull_request.number }}"
}
},
Expand All @@ -57,27 +210,19 @@
"run": "./gradlew check --continue",
"id": "test_plugin",
"env": {
"GITHUB_TOKEN": "${{ secrets.GITHUB_TOKEN }}",
"PR_NUMBER": "${{ github.event.pull_request.number }}"
},
"working-directory": "./testplugin",
"if": "(success() || failure()) && steps.assemble.outcome == 'success'"
},
{
"with": {
"name": "junit-test-results",
"name": "junit-test-results-gradle",
"path": "**/build/test-results/*/TEST-*.xml",
"retention-days": "1"
},
"name": "Upload junit-test-results",
"uses": "actions/upload-artifact@v4",
"if": "(success() || failure()) && steps.assemble.outcome == 'success'"
},
{
"with": {
"name": "jacoco-coverage",
"path": "build/reports/jacoco/testCodeCoverageReport"
},
"name": "Upload jacoco-coverage",
"name": "Upload junit-test-results-gradle",
"uses": "actions/upload-artifact@v4",
"if": "(success() || failure()) && steps.assemble.outcome == 'success'"
},
Expand All @@ -86,6 +231,7 @@
"run": "./gradlew publish",
"id": "publish",
"env": {
"GITHUB_TOKEN": "${{ secrets.GITHUB_TOKEN }}",
"PR_NUMBER": "${{ github.event.pull_request.number }}"
}
},
Expand Down
43 changes: 29 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
},
"runs-on": "ubuntu-22.04",
"permissions": {
"contents": "write"
"contents": "write",
"packages": "read"
},
"steps": [
{
Expand Down Expand Up @@ -46,35 +47,41 @@
{
"name": "Tag Release",
"run": "./gradlew tagRelease",
"id": "tag_release"
"id": "tag_release",
"env": {
"GITHUB_TOKEN": "${{ secrets.GITHUB_TOKEN }}"
}
},
{
"name": "Build",
"run": "./gradlew build",
"id": "build"
"id": "build",
"env": {
"GITHUB_TOKEN": "${{ secrets.GITHUB_TOKEN }}"
}
},
{
"run": "git push && git push --tags"
},
{
"with": {
"gradle-build-module": ":\n:opensesame-compile\n:opensesame-core\n:opensesame-fabric\n:opensesame-groovy\n:opensesame-javac\n:opensesame-mixin\n:opensesame-plugin-core\n:opensesame-plugin-loom",
"gradle-build-configuration": "compileClasspath",
"sub-module-mode": "INDIVIDUAL_DEEP",
"include-build-environment": true
},
"name": "Submit Dependencies",
"uses": "mikepenz/[email protected]"
},
{
"name": "Record Version",
"run": "./gradlew recordVersion",
"id": "record_version"
"id": "record_version",
"env": {
"GITHUB_TOKEN": "${{ secrets.GITHUB_TOKEN }}"
}
},
{
"name": "Capture Recorded Version",
"run": "echo version=$(cat build/recordVersion.txt) >> \"$GITHUB_OUTPUT\"",
"id": "record_version_capture_version"
},
{
"name": "Submit Dependencies",
"uses": "gradle/actions/dependency-submission@v3",
"env": {
"GITHUB_TOKEN": "${{ secrets.GITHUB_TOKEN }}"
}
}
]
},
Expand All @@ -83,6 +90,9 @@
"build"
],
"runs-on": "ubuntu-22.04",
"permissions": {
"packages": "read"
},
"steps": [
{
"name": "Setup Java",
Expand Down Expand Up @@ -123,6 +133,7 @@
"run": "./gradlew publishCentral closeAndReleaseSonatypeStagingRepository",
"id": "publish",
"env": {
"GITHUB_TOKEN": "${{ secrets.GITHUB_TOKEN }}",
"BUILD_CACHE_PASSWORD": "${{ secrets.BUILD_CACHE_PASSWORD }}",
"BUILD_CACHE_USER": "${{ secrets.BUILD_CACHE_USER }}",
"BUILD_CACHE_URL": "${{ secrets.BUILD_CACHE_URL }}",
Expand All @@ -139,6 +150,9 @@
"build"
],
"runs-on": "ubuntu-22.04",
"permissions": {
"packages": "read"
},
"steps": [
{
"name": "Setup Java",
Expand Down Expand Up @@ -179,6 +193,7 @@
"run": "./gradlew publishPlugins",
"id": "publish_plugins",
"env": {
"GITHUB_TOKEN": "${{ secrets.GITHUB_TOKEN }}",
"BUILD_CACHE_PASSWORD": "${{ secrets.BUILD_CACHE_PASSWORD }}",
"BUILD_CACHE_USER": "${{ secrets.BUILD_CACHE_USER }}",
"BUILD_CACHE_URL": "${{ secrets.BUILD_CACHE_URL }}",
Expand Down
20 changes: 17 additions & 3 deletions .github/workflows/report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"path": "**/test-results/testOn17/**/TEST-*.xml",
"reporter": "java-junit",
"fail-on-empty": "true",
"list-tests": "failed"
"list-tests": "failed",
"list-suites": "failed"
},
"name": "JUnit Test Report - Java 17",
"uses": "dorny/test-reporter@v1"
Expand All @@ -42,15 +43,28 @@
"path": "**/test-results/testOn21/**/TEST-*.xml",
"reporter": "java-junit",
"fail-on-empty": "true",
"list-tests": "failed"
"list-tests": "failed",
"list-suites": "failed"
},
"name": "JUnit Test Report - Java 21",
"uses": "dorny/test-reporter@v1"
},
{
"with": {
"name": "Test Results - Java 22",
"path": "**/test-results/testOn22/**/TEST-*.xml",
"reporter": "java-junit",
"fail-on-empty": "true",
"list-tests": "failed",
"list-suites": "failed"
},
"name": "JUnit Test Report - Java 22",
"uses": "dorny/test-reporter@v1"
},
{
"with": {
"name": "Test Results - Misc",
"path": "**/test-results/test/**/TEST-*.xml",
"path": "**/test-results/test/**/TEST-*.xml\njunit-test-results-native-*/**/TEST-*.xml",
"reporter": "java-junit",
"fail-on-empty": "true",
"list-tests": "failed"
Expand Down
Loading

0 comments on commit be7bc29

Please sign in to comment.