Compare commits

..

8 Commits

Author SHA1 Message Date
Fabio Niephaus
557ffcf459 Bump version to 1.2.5. 2024-10-29 15:50:32 +01:00
Fabio Niephaus
f7c3ab9a9a Upgrade to macos-13.
Context: https://github.com/actions/runner-images/issues/10721
2024-10-29 15:50:32 +01:00
Fabio Niephaus
dee12811d5 Update tests to use GraalVM for JDK 22 and 23-ea. 2024-10-29 15:50:32 +01:00
Fabio Niephaus
9dd2b41757 Upgrade musl and follow recommendation.
Closes #113
2024-10-29 15:50:32 +01:00
Fabio Niephaus
3aaf71e276 Fix and improve README.md.
Thanks to @Marcono1234 for the suggestions.
2024-10-17 22:19:35 +02:00
Fabio Niephaus
17d757cc41 Add 'Supported distributions' section.
Related to #107.
2024-10-17 22:19:35 +02:00
Fabio Niephaus
24013ae277 Upgrade job to 17.0.13. 2024-10-17 22:19:35 +02:00
Fabio Niephaus
caa712a441 Recommend actions/upload-artifact@v4. [ci skip]
Fixes #111.

https://github.blog/changelog/2024-02-13-deprecation-notice-v1-and-v2-of-the-artifact-actions/
2024-10-17 22:19:35 +02:00
8 changed files with 145 additions and 95 deletions

View File

@@ -25,12 +25,12 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
java-version: ['22', '21', '17', '20', 'dev'] java-version: ['23', '21', '17', '20', 'dev']
distribution: ['graalvm', 'graalvm-community'] distribution: ['graalvm', 'graalvm-community']
os: [ os: [
ubuntu-latest, ubuntu-latest,
macos-latest, # macOS on Apple silicon macos-latest, # macOS on Apple silicon
macos-12, # macOS on Intel macos-13, # macOS on Intel
windows-latest windows-latest
] ]
set-gds-token: [false] set-gds-token: [false]
@@ -39,7 +39,7 @@ jobs:
- java-version: 'latest-ea' - java-version: 'latest-ea'
distribution: 'graalvm' distribution: 'graalvm'
os: ubuntu-latest os: ubuntu-latest
- java-version: '23-ea' - java-version: '24-ea'
distribution: 'graalvm' distribution: 'graalvm'
os: ubuntu-latest os: ubuntu-latest
- java-version: '21' - java-version: '21'
@@ -59,7 +59,7 @@ jobs:
distribution: 'graalvm' distribution: 'graalvm'
os: ubuntu-latest os: ubuntu-latest
set-gds-token: true set-gds-token: true
- java-version: '17.0.12' # Upgrade to '17.0.13' after Oct 2024 - java-version: '17.0.13'
distribution: 'graalvm' distribution: 'graalvm'
os: ubuntu-latest os: ubuntu-latest
set-gds-token: true set-gds-token: true
@@ -119,7 +119,7 @@ jobs:
- version: '22.3.1' - version: '22.3.1'
java-version: '11' # for JDK 11 notification java-version: '11' # for JDK 11 notification
components: 'native-image' components: 'native-image'
os: macos-12 os: macos-13
- version: '22.3.1' - version: '22.3.1'
java-version: '17' java-version: '17'
components: 'native-image' components: 'native-image'

127
README.md
View File

@@ -29,8 +29,8 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: graalvm/setup-graalvm@v1 - uses: graalvm/setup-graalvm@v1
with: with:
java-version: '21' # See 'Options' section below for all supported versions java-version: '21' # See 'Options' for more details
distribution: 'graalvm' # See 'Options' section below for all available distributions distribution: 'graalvm' # See 'Supported distributions' for available options
github-token: ${{ secrets.GITHUB_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Example step - name: Example step
run: | run: |
@@ -74,7 +74,7 @@ jobs:
./helloworld ./helloworld
- name: Upload binary - name: Upload binary
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v4
with: with:
name: helloworld-${{ matrix.os }} name: helloworld-${{ matrix.os }}
path: helloworld* path: helloworld*
@@ -104,41 +104,41 @@ jobs:
1. Obtain a token for the GraalVM Download Service. For this, replace `your@email.com` with your email address and run the following `curl` command: 1. Obtain a token for the GraalVM Download Service. For this, replace `your@email.com` with your email address and run the following `curl` command:
```bash ```bash
curl -sS -X POST "https://gds.oracle.com/api/20220101/licenseAcceptance" \ curl -sS -X POST "https://gds.oracle.com/api/20220101/licenseAcceptance" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d "{ \"email\": \"your@email.com\", \"licenseId\": \"D53FA58D12817B3CE0530F15000A74CA\", \"type\": \"GENERATE_TOKEN_AND_ACCEPT_LICENSE\"}" -d "{ \"email\": \"your@email.com\", \"licenseId\": \"D53FA58D12817B3CE0530F15000A74CA\", \"type\": \"GENERATE_TOKEN_AND_ACCEPT_LICENSE\"}"
``` ```
The response should look like this: The response should look like this:
```json ```json
{"token":"<your-token>","status":"UNVERIFIED"} {"token":"<your-token>","status":"UNVERIFIED"}
``` ```
2. Store the value of `<your-token>` as a [GitHub Action secret][gha-secrets]. For the following template, we use the name `GDS_TOKEN`. 2. Store the value of `<your-token>` as a [GitHub Action secret][gha-secrets]. For the following template, we use the name `GDS_TOKEN`.
3. Check your emails and accept the license to activate the token. 3. Check your emails and accept the license to activate the token.
4. Use `java-version: '17'` (or a specific version such as `17.0.13`) and provide the `GDS_TOKEN` as shown in the following template: 4. Use `java-version: '17'` (or a specific version such as `17.0.13`) and provide the `GDS_TOKEN` as shown in the following template:
```yml ```yml
name: Build with Oracle GraalVM for JDK 17 via GDS name: Build with Oracle GraalVM for JDK 17 via GDS
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: graalvm/setup-graalvm@v1 - uses: graalvm/setup-graalvm@v1
with: with:
distribution: 'graalvm' distribution: 'graalvm'
java-version: '17' java-version: '17'
gds-token: ${{ secrets.GDS_TOKEN }} gds-token: ${{ secrets.GDS_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Example step - name: Example step
run: | run: |
java --version java --version
native-image --version native-image --version
``` ```
</details> </details>
@@ -150,38 +150,52 @@ jobs:
1. Download the version of [GraalVM Enterprise Edition (EE)][graalvm-ee] you want to run on GitHub Actions. 1. Download the version of [GraalVM Enterprise Edition (EE)][graalvm-ee] you want to run on GitHub Actions.
2. Use the [GraalVM Updater][gu] to install the GraalVM components you need on GitHub Actions and accept the corresponding licenses. 2. Use the [GraalVM Updater][gu] to install the GraalVM components you need on GitHub Actions and accept the corresponding licenses.
3. Run `$GRAALVM_HOME/bin/gu --show-ee-token` to display your token for the GraalVM Download Service. 3. Run `$GRAALVM_HOME/bin/gu --show-ee-token` to display your token for the GraalVM Download Service.
4. Store this token as a [GitHub Action secret][gha-secrets]. In the following template, we use the name `GDS_TOKEN`. 4. Store this token as a [GitHub Action secret][gha-secrets]. In the following template, we use the name `GDS_TOKEN`:
```yml ```yml
name: GraalVM Enterprise Edition build name: GraalVM Enterprise Edition build
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: graalvm/setup-graalvm@v1 - uses: graalvm/setup-graalvm@v1
with: with:
version: '22.3.0' version: '22.3.0'
gds-token: ${{ secrets.GDS_TOKEN }} gds-token: ${{ secrets.GDS_TOKEN }}
java-version: '17' java-version: '17'
components: 'native-image' components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Example step - name: Example step
run: | run: |
java --version java --version
native-image --version native-image --version
``` ```
</details> </details>
## Supported distributions
Currently, the following distributions are supported:
| Keyword | Distribution | Official site | License |
|-|-|-|-|
| `graalvm` | Oracle GraalVM | [Link](https://www.graalvm.org/) | [Link](https://www.oracle.com/downloads/licenses/graal-free-license.html) |
| `graalvm-community` | GraalVM Community Edition | [Link](https://www.graalvm.org/) | [Link](https://github.com/oracle/graal/blob/master/LICENSE) |
| `mandrel` | Mandrel | [Link](https://github.com/graalvm/mandrel) | [Link](https://github.com/graalvm/mandrel/blob/default/LICENSE) |
| `liberica` | Liberica NIK | [Link](https://bell-sw.com/liberica-native-image-kit/) | [Link](https://bell-sw.com/liberica_nik_eula/) |
## Options ## Options
This actions can be configured with the following options:
| Name | Default | Description | | Name | Default | Description |
|-----------------|:--------:|-------------| |-----------------|:--------:|-------------|
| `java-version`<br>*(required)* | n/a | Java version <ul><li>major versions: `'21'`, `'17'`, `'11'`, `'8'`</li><li>specific versions: `'21.0.3'`, `'17.0.11'`</li><li>early access (EA) builds: `'23-ea'` *(requires `distribution: 'graalvm'`)*</li><li>latest EA build: `'latest-ea'` *(requires `distribution: 'graalvm'`)*</li><li>dev builds: `'dev'`</li></ul> | | `java-version`<br>*(required)* | n/a | Java version <ul><li>major versions: `'23'`, `'21'`, `'17'`, `'11'`, `'8'`</li><li>specific versions: `'21.0.3'`, `'17.0.11'`</li><li>early access (EA) builds: `'24-ea'` *(requires `distribution: 'graalvm'`)*</li><li>latest EA build: `'latest-ea'` *(requires `distribution: 'graalvm'`)*</li><li>dev builds: `'dev'`</li></ul> |
| `distribution` | `'graalvm'` | GraalVM distribution <ul><li>Oracle GraalVM: `'graalvm'`</li><li>GraalVM Community Edition: `'graalvm-community'`</li><li>Mandrel: `'mandrel'`</li><li>Liberica: `'liberica'`</li></ul> | | `distribution` | `'graalvm'` | GraalVM distribution (see [supported distributions](#supported-distributions)) |
| `java-package` | `'jdk'` | The package type (`'jdk'` or `'jdk+fx'`). Currently applies to Liberica only. | | `java-package` | `'jdk'` | The package type (`'jdk'` or `'jdk+fx'`). Currently applies to Liberica only. |
| `github-token` | `'${{ github.token }}'` | Token for communication with the GitHub API. Please set this to `${{ secrets.GITHUB_TOKEN }}` (see [templates](#templates)) to allow the action to authenticate with the GitHub API, which helps reduce rate-limiting issues. | | `github-token` | `'${{ github.token }}'` | Token for communication with the GitHub API. Please set this to `${{ secrets.GITHUB_TOKEN }}` (see [templates](#templates)) to allow the action to authenticate with the GitHub API, which helps 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. Overrides any previous action or command that sets `$JAVA_HOME`. | | `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`. |
@@ -193,7 +207,8 @@ jobs:
| `native-image-pr-reports-update-existing` *) | `'false'` | Instead of posting another comment, update an existing PR comment with the latest Native Image build report. Requires `native-image-pr-reports` to be `true`. | | `native-image-pr-reports-update-existing` *) | `'false'` | Instead of posting another comment, update an existing PR comment with the latest Native Image build report. Requires `native-image-pr-reports` to be `true`. |
| `components` | `''` | Comma-separated list of GraalVM components (e.g., `native-image` or `ruby,nodejs`) that will be installed by the [GraalVM Updater][gu]. | | `components` | `''` | Comma-separated list of GraalVM components (e.g., `native-image` or `ruby,nodejs`) that will be installed by the [GraalVM Updater][gu]. |
| `version` | `''` | `X.Y.Z` (e.g., `22.3.0`) for a specific [GraalVM release][releases] up to `22.3.2`<br>`mandrel-X.Y.Z.W` or `X.Y.Z.W-Final` (e.g., `mandrel-21.3.0.0-Final` or `21.3.0.0-Final`) for a specific [Mandrel release][mandrel-releases],<br>`mandrel-latest` or `latest` for the latest Mandrel stable release. | | `version` | `''` | `X.Y.Z` (e.g., `22.3.0`) for a specific [GraalVM release][releases] up to `22.3.2`<br>`mandrel-X.Y.Z.W` or `X.Y.Z.W-Final` (e.g., `mandrel-21.3.0.0-Final` or `21.3.0.0-Final`) for a specific [Mandrel release][mandrel-releases],<br>`mandrel-latest` or `latest` for the latest Mandrel stable release. |
| `gds-token` | `''` | Download token for the GraalVM Download Service. at <> Store this token as a [GitHub Action secret][gha-secrets]. For thie followingtemplate, we use the name `GDS_TOKEN`.. If a non-empty token is provided, the action will set up GraalVM Enterprise Edition (see [GraalVM EE template](#template-for-graalvm-enterprise-edition)). | | `gds-token` | `''` Download token for the GraalVM Download Service. If a non-empty token is provided, the action will set up Oracle GraalVM (see [Oracle GraalVM via GDS template](#template-for-oracle-graalvm-via-graalvm-download-service)) or GraalVM Enterprise Edition (see [GraalVM EE template](#template-for-graalvm-enterprise-edition)) via GDS. |
**) Make sure that Native Image is used only once per build job. Otherwise, the report is only generated for the last Native Image build.* **) Make sure that Native Image is used only once per build job. Otherwise, the report is only generated for the last Native Image build.*
@@ -231,7 +246,7 @@ can be replaced with:
# ... # ...
- uses: graalvm/setup-graalvm@v1 - uses: graalvm/setup-graalvm@v1
with: with:
java-version: '17.0.7' # for a specific JDK 17; or '17' for the latest JDK 17 java-version: '17.0.12' # for a specific JDK 17; or '17' for the latest JDK 17
distribution: 'graalvm' # New 'distribution' option distribution: 'graalvm' # New 'distribution' option
# ... # ...
``` ```

2
dist/cleanup/index.js generated vendored
View File

@@ -90415,7 +90415,7 @@ else {
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ERROR_HINT = exports.ERROR_REQUEST = exports.EVENT_NAME_PULL_REQUEST = exports.ENV_GITHUB_EVENT_NAME = exports.GDS_GRAALVM_PRODUCT_ID = exports.GDS_BASE = exports.MANDREL_NAMESPACE = exports.GRAALVM_RELEASES_REPO = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.GRAALVM_ARCH = exports.JDK_HOME_SUFFIX = exports.JDK_PLATFORM = exports.JDK_ARCH = exports.VERSION_LATEST = exports.VERSION_DEV = exports.DISTRIBUTION_LIBERICA = exports.DISTRIBUTION_MANDREL = exports.DISTRIBUTION_GRAALVM_COMMUNITY = exports.DISTRIBUTION_GRAALVM = exports.EXECUTABLE_SUFFIX = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = exports.INPUT_NI_MUSL = exports.INPUT_CHECK_FOR_UPDATES = exports.INPUT_CACHE = exports.INPUT_SET_JAVA_HOME = exports.INPUT_GITHUB_TOKEN = exports.INPUT_COMPONENTS = exports.INPUT_DISTRIBUTION = exports.INPUT_JAVA_PACKAGE = exports.INPUT_JAVA_VERSION = exports.INPUT_GDS_TOKEN = exports.INPUT_VERSION = exports.ACTION_VERSION = void 0; exports.ERROR_HINT = exports.ERROR_REQUEST = exports.EVENT_NAME_PULL_REQUEST = exports.ENV_GITHUB_EVENT_NAME = exports.GDS_GRAALVM_PRODUCT_ID = exports.GDS_BASE = exports.MANDREL_NAMESPACE = exports.GRAALVM_RELEASES_REPO = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.GRAALVM_ARCH = exports.JDK_HOME_SUFFIX = exports.JDK_PLATFORM = exports.JDK_ARCH = exports.VERSION_LATEST = exports.VERSION_DEV = exports.DISTRIBUTION_LIBERICA = exports.DISTRIBUTION_MANDREL = exports.DISTRIBUTION_GRAALVM_COMMUNITY = exports.DISTRIBUTION_GRAALVM = exports.EXECUTABLE_SUFFIX = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = exports.INPUT_NI_MUSL = exports.INPUT_CHECK_FOR_UPDATES = exports.INPUT_CACHE = exports.INPUT_SET_JAVA_HOME = exports.INPUT_GITHUB_TOKEN = exports.INPUT_COMPONENTS = exports.INPUT_DISTRIBUTION = exports.INPUT_JAVA_PACKAGE = exports.INPUT_JAVA_VERSION = exports.INPUT_GDS_TOKEN = exports.INPUT_VERSION = exports.ACTION_VERSION = void 0;
exports.ACTION_VERSION = '1.2.4'; exports.ACTION_VERSION = '1.2.5';
exports.INPUT_VERSION = 'version'; exports.INPUT_VERSION = 'version';
exports.INPUT_GDS_TOKEN = 'gds-token'; exports.INPUT_GDS_TOKEN = 'gds-token';
exports.INPUT_JAVA_VERSION = 'java-version'; exports.INPUT_JAVA_VERSION = 'java-version';

41
dist/main/index.js generated vendored
View File

@@ -90981,7 +90981,7 @@ function wrappy (fn, cb) {
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ERROR_HINT = exports.ERROR_REQUEST = exports.EVENT_NAME_PULL_REQUEST = exports.ENV_GITHUB_EVENT_NAME = exports.GDS_GRAALVM_PRODUCT_ID = exports.GDS_BASE = exports.MANDREL_NAMESPACE = exports.GRAALVM_RELEASES_REPO = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.GRAALVM_ARCH = exports.JDK_HOME_SUFFIX = exports.JDK_PLATFORM = exports.JDK_ARCH = exports.VERSION_LATEST = exports.VERSION_DEV = exports.DISTRIBUTION_LIBERICA = exports.DISTRIBUTION_MANDREL = exports.DISTRIBUTION_GRAALVM_COMMUNITY = exports.DISTRIBUTION_GRAALVM = exports.EXECUTABLE_SUFFIX = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = exports.INPUT_NI_MUSL = exports.INPUT_CHECK_FOR_UPDATES = exports.INPUT_CACHE = exports.INPUT_SET_JAVA_HOME = exports.INPUT_GITHUB_TOKEN = exports.INPUT_COMPONENTS = exports.INPUT_DISTRIBUTION = exports.INPUT_JAVA_PACKAGE = exports.INPUT_JAVA_VERSION = exports.INPUT_GDS_TOKEN = exports.INPUT_VERSION = exports.ACTION_VERSION = void 0; exports.ERROR_HINT = exports.ERROR_REQUEST = exports.EVENT_NAME_PULL_REQUEST = exports.ENV_GITHUB_EVENT_NAME = exports.GDS_GRAALVM_PRODUCT_ID = exports.GDS_BASE = exports.MANDREL_NAMESPACE = exports.GRAALVM_RELEASES_REPO = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.GRAALVM_ARCH = exports.JDK_HOME_SUFFIX = exports.JDK_PLATFORM = exports.JDK_ARCH = exports.VERSION_LATEST = exports.VERSION_DEV = exports.DISTRIBUTION_LIBERICA = exports.DISTRIBUTION_MANDREL = exports.DISTRIBUTION_GRAALVM_COMMUNITY = exports.DISTRIBUTION_GRAALVM = exports.EXECUTABLE_SUFFIX = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = exports.INPUT_NI_MUSL = exports.INPUT_CHECK_FOR_UPDATES = exports.INPUT_CACHE = exports.INPUT_SET_JAVA_HOME = exports.INPUT_GITHUB_TOKEN = exports.INPUT_COMPONENTS = exports.INPUT_DISTRIBUTION = exports.INPUT_JAVA_PACKAGE = exports.INPUT_JAVA_VERSION = exports.INPUT_GDS_TOKEN = exports.INPUT_VERSION = exports.ACTION_VERSION = void 0;
exports.ACTION_VERSION = '1.2.4'; exports.ACTION_VERSION = '1.2.5';
exports.INPUT_VERSION = 'version'; exports.INPUT_VERSION = 'version';
exports.INPUT_GDS_TOKEN = 'gds-token'; exports.INPUT_GDS_TOKEN = 'gds-token';
exports.INPUT_JAVA_VERSION = 'java-version'; exports.INPUT_JAVA_VERSION = 'java-version';
@@ -91466,8 +91466,12 @@ const core = __importStar(__nccwpck_require__(2186));
const tc = __importStar(__nccwpck_require__(7784)); const tc = __importStar(__nccwpck_require__(7784));
const utils_1 = __nccwpck_require__(1314); const utils_1 = __nccwpck_require__(1314);
const path_1 = __nccwpck_require__(1017); const path_1 = __nccwpck_require__(1017);
const MUSL_NAME = 'x86_64-linux-musl-native'; const os_1 = __nccwpck_require__(2037);
const MUSL_VERSION = '10.2.1'; const fs_1 = __nccwpck_require__(7147);
const MUSL_NAME = 'musl-gcc';
const MUSL_VERSION = '1.2.4';
const ZLIB_VERSION = '1.2.13';
// Build instructions: https://github.com/oracle/graal/blob/6dab549194b85252f88bda4ee825762d8b02c687/docs/reference-manual/native-image/guides/build-static-and-mostly-static-executable.md?plain=1#L38-L67
function setUpNativeImageMusl() { function setUpNativeImageMusl() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
if (!c.IS_LINUX) { if (!c.IS_LINUX) {
@@ -91476,26 +91480,35 @@ function setUpNativeImageMusl() {
} }
let toolPath = tc.find(MUSL_NAME, MUSL_VERSION); let toolPath = tc.find(MUSL_NAME, MUSL_VERSION);
if (toolPath) { if (toolPath) {
core.info(`Found ${MUSL_NAME} ${MUSL_VERSION} in tool-cache @ ${toolPath}`); core.info(`Found musl ${MUSL_VERSION} in tool-cache @ ${toolPath}`);
} }
else { else {
core.startGroup(`Setting up musl for GraalVM Native Image...`); core.startGroup(`Building musl with zlib for GraalVM Native Image...`);
const muslDownloadPath = yield tc.downloadTool(`https://github.com/graalvm/setup-graalvm/releases/download/x86_64-linux-musl-${MUSL_VERSION}/${MUSL_NAME}.tgz`); // Build musl
const muslHome = (0, path_1.join)((0, os_1.homedir)(), 'musl-toolchain');
const muslDownloadPath = yield tc.downloadTool(`https://musl.libc.org/releases/musl-${MUSL_VERSION}.tar.gz`);
const muslExtractPath = yield tc.extractTar(muslDownloadPath); const muslExtractPath = yield tc.extractTar(muslDownloadPath);
const muslPath = (0, path_1.join)(muslExtractPath, MUSL_NAME); const muslPath = (0, path_1.join)(muslExtractPath, `musl-${MUSL_VERSION}`);
const zlibCommit = 'ec3df00224d4b396e2ac6586ab5d25f673caa4c2'; const muslBuildOptions = { cwd: muslPath };
const zlibDownloadPath = yield tc.downloadTool(`https://github.com/madler/zlib/archive/${zlibCommit}.tar.gz`); yield (0, utils_1.exec)('./configure', [`--prefix=${muslHome}`, '--static'], muslBuildOptions);
yield (0, utils_1.exec)('make', [], muslBuildOptions);
yield (0, utils_1.exec)('make', ['install'], muslBuildOptions);
const muslGCC = (0, path_1.join)(muslHome, 'bin', MUSL_NAME);
yield fs_1.promises.symlink(muslGCC, (0, path_1.join)(muslHome, 'bin', 'x86_64-linux-musl-gcc'), 'file');
// Build zlib
const zlibDownloadPath = yield tc.downloadTool(`https://zlib.net/fossils/zlib-${ZLIB_VERSION}.tar.gz`);
const zlibExtractPath = yield tc.extractTar(zlibDownloadPath); const zlibExtractPath = yield tc.extractTar(zlibDownloadPath);
const zlibPath = (0, path_1.join)(zlibExtractPath, `zlib-${zlibCommit}`); const zlibPath = (0, path_1.join)(zlibExtractPath, `zlib-${ZLIB_VERSION}`);
const zlibBuildOptions = { const zlibBuildOptions = {
cwd: zlibPath, cwd: zlibPath,
env: Object.assign(Object.assign({}, process.env), { CC: (0, path_1.join)(muslPath, 'bin', 'gcc') }) env: Object.assign(Object.assign({}, process.env), { CC: muslGCC })
}; };
yield (0, utils_1.exec)('./configure', [`--prefix=${muslPath}`, '--static'], zlibBuildOptions); yield (0, utils_1.exec)('./configure', [`--prefix=${muslHome}`, '--static'], zlibBuildOptions);
yield (0, utils_1.exec)('make', [], zlibBuildOptions); yield (0, utils_1.exec)('make', [], zlibBuildOptions);
yield (0, utils_1.exec)('make', ['install'], { cwd: zlibPath }); yield (0, utils_1.exec)('make', ['install'], { cwd: zlibPath });
core.info(`Adding ${MUSL_NAME} ${MUSL_VERSION} to tool-cache ...`); // Store in cache
toolPath = yield tc.cacheDir(muslPath, MUSL_NAME, MUSL_VERSION); core.info(`Adding musl ${MUSL_VERSION} with zlib ${ZLIB_VERSION} to tool-cache ...`);
toolPath = yield tc.cacheDir(muslHome, MUSL_NAME, MUSL_VERSION);
core.endGroup(); core.endGroup();
} }
core.addPath((0, path_1.join)(toolPath, 'bin')); core.addPath((0, path_1.join)(toolPath, 'bin'));

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "setup-graalvm", "name": "setup-graalvm",
"version": "1.2.4", "version": "1.2.5",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "setup-graalvm", "name": "setup-graalvm",
"version": "1.2.4", "version": "1.2.5",
"license": "UPL", "license": "UPL",
"dependencies": { "dependencies": {
"@actions/cache": "^3.2.4", "@actions/cache": "^3.2.4",

View File

@@ -1,6 +1,6 @@
{ {
"name": "setup-graalvm", "name": "setup-graalvm",
"version": "1.2.4", "version": "1.2.5",
"private": true, "private": true,
"description": "GitHub Action for GraalVM", "description": "GitHub Action for GraalVM",
"main": "lib/main.js", "main": "lib/main.js",

View File

@@ -1,6 +1,6 @@
import * as otypes from '@octokit/types' import * as otypes from '@octokit/types'
export const ACTION_VERSION = '1.2.4' export const ACTION_VERSION = '1.2.5'
export const INPUT_VERSION = 'version' export const INPUT_VERSION = 'version'
export const INPUT_GDS_TOKEN = 'gds-token' export const INPUT_GDS_TOKEN = 'gds-token'

View File

@@ -3,9 +3,14 @@ import * as core from '@actions/core'
import * as tc from '@actions/tool-cache' import * as tc from '@actions/tool-cache'
import {exec} from '../utils' import {exec} from '../utils'
import {join} from 'path' import {join} from 'path'
import {homedir} from 'os'
import {promises as fs} from 'fs'
const MUSL_NAME = 'x86_64-linux-musl-native' const MUSL_NAME = 'musl-gcc'
const MUSL_VERSION = '10.2.1' const MUSL_VERSION = '1.2.4'
const ZLIB_VERSION = '1.2.13'
// Build instructions: https://github.com/oracle/graal/blob/6dab549194b85252f88bda4ee825762d8b02c687/docs/reference-manual/native-image/guides/build-static-and-mostly-static-executable.md?plain=1#L38-L67
export async function setUpNativeImageMusl(): Promise<void> { export async function setUpNativeImageMusl(): Promise<void> {
if (!c.IS_LINUX) { if (!c.IS_LINUX) {
@@ -14,38 +19,55 @@ export async function setUpNativeImageMusl(): Promise<void> {
} }
let toolPath = tc.find(MUSL_NAME, MUSL_VERSION) let toolPath = tc.find(MUSL_NAME, MUSL_VERSION)
if (toolPath) { if (toolPath) {
core.info(`Found ${MUSL_NAME} ${MUSL_VERSION} in tool-cache @ ${toolPath}`) core.info(`Found musl ${MUSL_VERSION} in tool-cache @ ${toolPath}`)
} else { } else {
core.startGroup(`Setting up musl for GraalVM Native Image...`) core.startGroup(`Building musl with zlib for GraalVM Native Image...`)
// Build musl
const muslHome = join(homedir(), 'musl-toolchain')
const muslDownloadPath = await tc.downloadTool( const muslDownloadPath = await tc.downloadTool(
`https://github.com/graalvm/setup-graalvm/releases/download/x86_64-linux-musl-${MUSL_VERSION}/${MUSL_NAME}.tgz` `https://musl.libc.org/releases/musl-${MUSL_VERSION}.tar.gz`
) )
const muslExtractPath = await tc.extractTar(muslDownloadPath) const muslExtractPath = await tc.extractTar(muslDownloadPath)
const muslPath = join(muslExtractPath, MUSL_NAME) const muslPath = join(muslExtractPath, `musl-${MUSL_VERSION}`)
const muslBuildOptions = {cwd: muslPath}
const zlibCommit = 'ec3df00224d4b396e2ac6586ab5d25f673caa4c2' await exec(
'./configure',
[`--prefix=${muslHome}`, '--static'],
muslBuildOptions
)
await exec('make', [], muslBuildOptions)
await exec('make', ['install'], muslBuildOptions)
const muslGCC = join(muslHome, 'bin', MUSL_NAME)
await fs.symlink(
muslGCC,
join(muslHome, 'bin', 'x86_64-linux-musl-gcc'),
'file'
)
// Build zlib
const zlibDownloadPath = await tc.downloadTool( const zlibDownloadPath = await tc.downloadTool(
`https://github.com/madler/zlib/archive/${zlibCommit}.tar.gz` `https://zlib.net/fossils/zlib-${ZLIB_VERSION}.tar.gz`
) )
const zlibExtractPath = await tc.extractTar(zlibDownloadPath) const zlibExtractPath = await tc.extractTar(zlibDownloadPath)
const zlibPath = join(zlibExtractPath, `zlib-${zlibCommit}`) const zlibPath = join(zlibExtractPath, `zlib-${ZLIB_VERSION}`)
const zlibBuildOptions = { const zlibBuildOptions = {
cwd: zlibPath, cwd: zlibPath,
env: { env: {
...process.env, ...process.env,
CC: join(muslPath, 'bin', 'gcc') CC: muslGCC
} }
} }
await exec( await exec(
'./configure', './configure',
[`--prefix=${muslPath}`, '--static'], [`--prefix=${muslHome}`, '--static'],
zlibBuildOptions zlibBuildOptions
) )
await exec('make', [], zlibBuildOptions) await exec('make', [], zlibBuildOptions)
await exec('make', ['install'], {cwd: zlibPath}) await exec('make', ['install'], {cwd: zlibPath})
// Store in cache
core.info(`Adding ${MUSL_NAME} ${MUSL_VERSION} to tool-cache ...`) core.info(
toolPath = await tc.cacheDir(muslPath, MUSL_NAME, MUSL_VERSION) `Adding musl ${MUSL_VERSION} with zlib ${ZLIB_VERSION} to tool-cache ...`
)
toolPath = await tc.cacheDir(muslHome, MUSL_NAME, MUSL_VERSION)
core.endGroup() core.endGroup()
} }
core.addPath(join(toolPath, 'bin')) core.addPath(join(toolPath, 'bin'))