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

Introduce GraalVM Native Image build reports. #20

Merged
merged 10 commits into from
Nov 8, 2022
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
17 changes: 16 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ jobs:
test-native-image-msvc:
name: native-image on windows-latest
runs-on: windows-latest
permissions:
contents: read
pull-requests: write # for `native-image-pr-reports` option
steps:
- uses: actions/checkout@v3
- name: Run setup-graalvm action
Expand All @@ -149,6 +152,8 @@ jobs:
version: 'latest'
java-version: '17'
components: 'native-image'
native-image-job-reports: 'true'
native-image-pr-reports: 'true'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build HelloWorld executable with GraalVM Native Image on Windows
run: |
Expand All @@ -159,6 +164,9 @@ jobs:
test-native-image-musl:
name: native-image-musl on ubuntu-latest
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write # for `native-image-pr-reports` option
steps:
- uses: actions/checkout@v3
- name: Run setup-graalvm action
Expand All @@ -168,6 +176,8 @@ jobs:
java-version: '19'
components: 'native-image'
native-image-musl: 'true'
native-image-job-reports: 'true'
native-image-pr-reports: 'true'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build static HelloWorld executable with GraalVM Native Image and musl
run: |
Expand All @@ -178,6 +188,9 @@ jobs:
test-extensive:
name: extensive tests on ubuntu-latest
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write # for `native-image-pr-reports` option
steps:
- uses: actions/checkout@v3
- name: Run setup-graalvm action
Expand All @@ -187,6 +200,8 @@ jobs:
java-version: '17'
components: 'espresso,llvm-toolchain,native-image,nodejs,python,R,ruby,wasm'
set-java-home: 'false'
native-image-job-reports: 'true'
native-image-pr-reports: 'true'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Check environment
run: |
Expand All @@ -212,7 +227,7 @@ jobs:
run: |
echo 'public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } }' > HelloWorld.java
javac HelloWorld.java
native-image HelloWorld
native-image -g HelloWorld
./helloworld
- name: Build Ruby-FFI with TruffleRuby
run: |
Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ jobs:
java-version: '11'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: 'true'

- name: Build and run HelloWorld.java
run: |
Expand Down Expand Up @@ -118,10 +119,14 @@ jobs:
| `java-version`<br>*(required)* | n/a | `'11'` or `'17'` for a specific Java version.<br>(`'8'` and `'16'` are supported for GraalVM 21.2 and earlier.) |
| `components` | `''` | Comma-spearated list of GraalVM components (e.g., `native-image` or `ruby,nodejs`) that will be installed by the [GraalVM Updater][gu]. |
| `github-token` | `''` | Token for communication with the GitHub API. Please set to `${{ secrets.GITHUB_TOKEN }}` (see [templates](#templates)) to allow the action to authenticate with the GitHub API, which helps to reduce rate limiting issues. |
| `set-java-home` | `'true'` | If set to `'true'`, instructs the action to set `$JAVA_HOME` to the path of the GraalVM installation. |
| `cache` | `''` | Name of the build platform to cache dependencies. It can be `'maven'`, `'gradle'`, or `'sbt'` and works the same way it does in [actions/setup-java][setup-java-caching]. |
| `set-java-home` | `'true'` | If set to `'true'`, instructs the action to set `$JAVA_HOME` to the path of the GraalVM installation. Overrides any previous action or command that sets `$JAVA_HOME`. |
| `cache` | `''` | Name of the build platform to cache dependencies. It can be `'maven'`, `'gradle'`, or `'sbt'` and works the same way as described in [actions/setup-java][setup-java-caching]. |
| `check-for-updates` | `'true'` | [Annotate jobs][gha-annotations] with update notifications, for example, when a new GraalVM release is available. |
| `native-image-musl` | `'false'` | If set to `'true'`, sets up [musl] for building [static images][native-image-static] with GraalVM Native Image *(Linux only)*. [Example usage][native-image-musl-build] (be sure to replace `uses: ./` with `uses: graalvm/setup-graalvm@v1`). |
| `native-image-job-reports` *) | `'false'` | If set to `'true'`, post a job summary containing a Native Image build report. |
| `native-image-musl` | `'false'` | If set to `'true'`, sets up [musl] to build [static binaries][native-image-static] with GraalVM Native Image *(Linux only)*. [Example usage][native-image-musl-build] (be sure to replace `uses: ./` with `uses: graalvm/setup-graalvm@v1`). |
| `native-image-pr-reports` *) | `'false'` | If set to `'true'`, post a comment containing a Native Image build report on pull requests. Requires `write` permissions for the [`pull-requests` scope][gha-permissions]. |

**) Make sure that Native Image is used only once per build job. Otherwise, the report is only generated for the last Native Image build.*


## Contributing
Expand All @@ -134,6 +139,7 @@ Only pull requests from committers that can be verified as having signed the OCA
[dev-build]: https://github.com/graalvm/graalvm-ce-dev-builds/releases/latest
[dev-builds]: https://github.com/graalvm/graalvm-ce-dev-builds
[gha-annotations]: https://github.com/actions/toolkit/tree/main/packages/core#annotations
[gha-permissions]: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
[gha-secrets]: https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository
[gha-self-hosted-runners]: https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners
[gu]: https://www.graalvm.org/reference-manual/graalvm-updater/
Expand Down
2 changes: 1 addition & 1 deletion __tests__/cache.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import {mkdtempSync} from 'fs'
import {tmpdir} from 'os'
import {join} from 'path'
import {restore, save} from '../src/cache'
import {restore, save} from '../src/features/cache'
import * as fs from 'fs'
import * as os from 'os'
import * as core from '@actions/core'
Expand Down
8 changes: 8 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ inputs:
required: false
description: 'Set up musl for static image building with GraalVM Native Image.'
default: 'false'
native-image-job-reports:
required: false
description: 'Post a job summary containing a Native Image build report.'
default: 'false'
native-image-pr-reports:
required: false
description: 'Post a comment containing a Native Image build report on pull requests.'
default: 'false'
runs:
using: 'node16'
main: 'dist/main/index.js'
Expand Down
Loading