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

Windows Executables #80

Merged
merged 31 commits into from
Sep 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
cb2ad4e
fix build on github
sebhoss Sep 15, 2020
4e3ba77
fix #79 create windows exe during verify pipeline
sebhoss Sep 15, 2020
853ed11
use cmd shell for windows
sebhoss Sep 15, 2020
b8fdcd9
use action to extract signing key for windows
sebhoss Sep 15, 2020
2c91778
remove workspace prefix for windows
sebhoss Sep 15, 2020
965aa20
skip pit for windows
sebhoss Sep 15, 2020
40e8ba6
fix tests for windows
sebhoss Sep 15, 2020
cf3452c
ignore some tests on windows
sebhoss Sep 15, 2020
46a472a
fix compilation issue
sebhoss Sep 15, 2020
497a642
only include certain files to make windows builds on gh happy
sebhoss Sep 15, 2020
fcb8e6a
remove end of line config b/c it fails on windows
sebhoss Sep 15, 2020
e0bef0c
set PATH for windows
sebhoss Sep 15, 2020
b211e94
call vcvars64.bat to configure path
sebhoss Sep 15, 2020
3da16f2
use cmd shell
sebhoss Sep 15, 2020
5e796ad
move key to correct location for windows
sebhoss Sep 16, 2020
56941f6
use %VAR% syntax for cmd shell
sebhoss Sep 16, 2020
571c22b
dont specify signing key location
sebhoss Sep 16, 2020
01dd0f9
use pre-installed vs2019
sebhoss Sep 17, 2020
ee0abe3
try with powershell
sebhoss Sep 17, 2020
47d1f08
use vcvars64.bat
sebhoss Sep 17, 2020
1d5e8b5
use powershell for maven
sebhoss Sep 17, 2020
76461f8
add quotes for powershell
sebhoss Sep 17, 2020
1bb586b
install vctools
sebhoss Sep 17, 2020
61649f9
use vcvarsall
sebhoss Sep 17, 2020
e5897ef
combine mvn & vcvarsall
sebhoss Sep 17, 2020
2212bdb
include ilo.exe for windows
sebhoss Sep 17, 2020
bd95d9b
only fetch first commit most of the time
sebhoss Sep 17, 2020
8bca248
release windows artifacts as well
sebhoss Sep 17, 2020
d497399
fix #46 add instructions for PowerShell
sebhoss Sep 17, 2020
f7766c6
run pit on windows as well
sebhoss Sep 17, 2020
0a98c5d
ignore pit on windows..
sebhoss Sep 17, 2020
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
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ root = true
# global rules for all fies
[*]
charset = utf-8
end_of_line = lf
indent_style = space
trim_trailing_whitespace = true

Expand Down
91 changes: 86 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ jobs:
name: Clone Git Repository
if: needs.prepare.outputs.commit_count > 0
uses: actions/checkout@v2
with:
fetch-depth: 0
- id: graal
name: GraalVM Setup
if: needs.prepare.outputs.commit_count > 0
Expand Down Expand Up @@ -183,8 +181,6 @@ jobs:
name: Clone Git Repository
if: needs.prepare.outputs.commit_count > 0
uses: actions/checkout@v2
with:
fetch-depth: 0
- id: graal
name: GraalVM Setup
if: needs.prepare.outputs.commit_count > 0
Expand Down Expand Up @@ -248,9 +244,94 @@ jobs:
asset_path: ./target/ilo-${{ needs.prepare.outputs.release_version }}-mac.zip.asc
asset_name: ilo-${{ needs.prepare.outputs.release_version }}-mac.zip.asc
asset_content_type: text/plain
windows:
name: Windows packages
needs: prepare
runs-on: windows-latest
steps:
- id: checkout
name: Clone Git Repository
if: needs.prepare.outputs.commit_count > 0
uses: actions/checkout@v2
- id: graal-download
name: GraalVM Download
if: needs.prepare.outputs.commit_count > 0
run: Invoke-RestMethod -Uri https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${{ env.GRAAL }}/graalvm-ce-${{ env.JAVA }}-windows-amd64-${{ env.GRAAL }}.zip -OutFile 'graal.zip'
- id: graal-expand
name: Install GraalVM
if: needs.prepare.outputs.commit_count > 0
run: Expand-Archive -path 'graal.zip' -destinationpath '.'
- id: native-image
name: Install native-image
if: needs.prepare.outputs.commit_count > 0
run: graalvm-ce-${{ env.JAVA }}-${{ env.GRAAL }}\bin\gu.cmd install native-image
- id: cache
name: Cache Maven Repository
if: needs.prepare.outputs.commit_count > 0
uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- id: gpg
name: GPG Key
if: needs.prepare.outputs.commit_count > 0
uses: timheuer/base64-to-file@v1.0.3
with:
fileName: signing.key.asc
encodedString: ${{ secrets.GPG_KEY }}
- id: copy-key
name: Copy GPG key to correct location
if: needs.prepare.outputs.commit_count > 0
run: Copy-Item -Path "${{ steps.gpg.outputs.filePath }}" -Destination "$env:GITHUB_WORKSPACE\signing.key.asc"
- id: verify
name: Verify Project
if: needs.prepare.outputs.commit_count > 0
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
mvn --batch-mode --settings .\build\settings.xml verify -Dskip.graal=false -Dpit.skip=true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_KEY_PASSPHRASE: ${{ secrets.GPG_KEY_PASSPHRASE }}
JAVA_HOME: ./graalvm-ce-${{ env.JAVA }}-${{ env.GRAAL }}
- id: upload-windows-artifact
name: Upload Windows Artifact
if: needs.prepare.outputs.commit_count > 0
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.prepare.outputs.release_url }}
asset_path: ./target/ilo-${{ needs.prepare.outputs.release_version }}-windows.zip
asset_name: ilo-${{ needs.prepare.outputs.release_version }}-windows.zip
asset_content_type: application/zip
- id: upload-windows-checksum
name: Upload Windows Checksum
if: needs.prepare.outputs.commit_count > 0
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.prepare.outputs.release_url }}
asset_path: ./target/ilo-${{ needs.prepare.outputs.release_version }}-windows.zip.sha512
asset_name: ilo-${{ needs.prepare.outputs.release_version }}-windows.zip.sha512
asset_content_type: text/plain
- id: upload-windows-signature
name: Upload Windows Signature
if: needs.prepare.outputs.commit_count > 0
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.prepare.outputs.release_url }}
asset_path: ./target/ilo-${{ needs.prepare.outputs.release_version }}-windows.zip.asc
asset_name: ilo-${{ needs.prepare.outputs.release_version }}-windows.zip.asc
asset_content_type: text/plain
announce:
name: Release Announcement
needs: [prepare, linux, mac]
needs: [prepare, linux, mac, windows]
runs-on: ubuntu-latest
steps:
- id: email
Expand Down
54 changes: 49 additions & 5 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ jobs:
- id: checkout
name: Clone Git Repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- id: graal
name: GraalVM Setup
uses: rinx/setup-graalvm-ce@v0.0.4
Expand Down Expand Up @@ -60,8 +58,6 @@ jobs:
- id: checkout
name: Clone Git Repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- id: graal
name: GraalVM Setup
uses: DeLaGuardo/setup-graalvm@2.0
Expand Down Expand Up @@ -91,4 +87,52 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: mac
path: ./target/ilo-*-mac*
path: ./target/ilo-*-mac*
windows:
name: Windows packages
runs-on: windows-latest
steps:
- id: checkout
name: Clone Git Repository
uses: actions/checkout@v2
- id: graal-download
name: GraalVM Download
run: Invoke-RestMethod -Uri https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${{ env.GRAAL }}/graalvm-ce-${{ env.JAVA }}-windows-amd64-${{ env.GRAAL }}.zip -OutFile 'graal.zip'
- id: graal-expand
name: Install GraalVM
run: Expand-Archive -path 'graal.zip' -destinationpath '.'
- id: native-image
name: Install native-image
run: graalvm-ce-${{ env.JAVA }}-${{ env.GRAAL }}\bin\gu.cmd install native-image
- id: cache
name: Cache Maven Repository
uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- id: gpg
name: GPG Key
uses: timheuer/base64-to-file@v1.0.3
with:
fileName: signing.key.asc
encodedString: ${{ secrets.GPG_KEY }}
- id: copy-key
name: Copy GPG key to correct location
run: Copy-Item -Path "${{ steps.gpg.outputs.filePath }}" -Destination "$env:GITHUB_WORKSPACE\signing.key.asc"
- id: verify
name: Verify Project
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
mvn --batch-mode --settings .\build\settings.xml verify -Dskip.graal=false -Dpit.skip=true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_KEY_PASSPHRASE: ${{ secrets.GPG_KEY_PASSPHRASE }}
JAVA_HOME: ./graalvm-ce-${{ env.JAVA }}-${{ env.GRAAL }}
- name: Upload Windows Artifact
uses: actions/upload-artifact@v2
with:
name: windows
path: ./target/ilo-*-windows*
4 changes: 2 additions & 2 deletions docs/content/usage/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The [Linux](https://www.kernel.org/) distribution of `ilo` is a native executabl
[Fedora](https://getfedora.org/) users can install `ilo` from a [COPR](https://copr.fedorainfracloud.org/coprs/sebhoss/ilo/) repository like this:

```shell script
$ sudo dnf copr enable sebhoss/ilo
$ sudo dnf copr enable sebhoss/ilo
$ sudo dnf install ilo
```

Expand All @@ -52,7 +52,7 @@ The [MacOS](https://www.apple.com/macos/) distribution of `ilo` is a native exec

## Windows

The [Windows](https://www.microsoft.com/en-us/windows) distribution of `ilo` requires at least [Java 11](https://www.oracle.com/javadownload) to be installed.
The [Windows](https://www.microsoft.com/en-us/windows) distribution of `ilo` is a native executable and does not require any additional software to be installed.

**THIS IS UNTESTED** - [help us](https://github.com/metio/ilo/issues/46) to get this working.

Expand Down
15 changes: 8 additions & 7 deletions docs/layouts/shortcodes/windowsinstall.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
~ in the LICENSE file.
-->

<div class="highlight"><pre class="chroma"><code class="language-shell" data-lang="shell">$ MD %USERPROFILE%\bin
$ control sysdm.cpl <span class="c1"># manually add '%USERPROFILE%\bin' to the PATH of your user account</span>
$ cd /path/to/ilo/installation/folder
$ curl --location https://github.com/metio/ilo/releases/download/{{ getenv "ILO_RELEASE" }}/ilo-{{ getenv "ILO_RELEASE" }}-java11.zip --output ilo.zip
$ unzip ilo.zip
$ chmod +x ilo-{{ getenv "ILO_RELEASE" }}/ilo
$ ln --symbolic --relative ilo-{{ getenv "ILO_RELEASE" }}/ilo %USERPROFILE%\bin\ilo.bat
<div class="highlight"><pre class="chroma"><code class="language-shell" data-lang="shell"><span class="c1"># PowerShell</span>
$ New-Item -Path $env:USERPROFILE -Name "bin" -ItemType "directory" <span class="c1"># create directory if it does not exit</span>
$ control sysdm.cpl <span class="c1"># manually add '$env:USERPROFILE\bin' to the PATH of your user account</span>
$ echo $env:PATH <span class="c1"># ensure that the 'bin' directory is in your PATH</span>
$ Set-Location -Path C:\path\to\ilo\installation\folder
$ Invoke-RestMethod -Uri https://github.com/metio/ilo/releases/download/{{ getenv "ILO_RELEASE" }}/ilo-{{ getenv "ILO_RELEASE" }}-windows.zip -OutFile "ilo.zip"
$ Expand-Archive -Path "ilo.zip" -DestinationPath "."
$ Copy-Item -Path "ilo-{{ getenv "ILO_RELEASE" }}\ilo.exe" -Destination "$env:USERPROFILE\bin\ilo.exe"
</code></pre>
</div>
8 changes: 8 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -357,8 +357,16 @@
</executions>
<configuration>
<excludes>
<!-- lots of false-positives? TODO: investigate and fix -->
<exclude>docs/**/*</exclude>
<!-- exclude for GitHub Actions -->
<exclude>signing.key.asc</exclude>
</excludes>
<includes>
<include>pom.xml</include>
<include>maven-version-rules.xml</include>
<include>src/**/*</include>
</includes>
</configuration>
</plugin>
</plugins>
Expand Down
2 changes: 1 addition & 1 deletion src/main/assembly/windows.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<directory>${project.build.directory}</directory>
<outputDirectory/>
<includes>
<include>ilo</include>
<include>ilo.exe</include>
</includes>
</fileSet>
<fileSet>
Expand Down
31 changes: 0 additions & 31 deletions src/test/java/wtf/metio/ilo/cli/ExecutablesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ void shouldDetectToolInPath() {
}

@Test
@EnabledOnOs({OS.LINUX, OS.MAC, OS.WINDOWS})
@DisplayName("Should detect missing tool in PATH")
void shouldHandleMissingTool() {
// given
Expand Down Expand Up @@ -67,7 +66,6 @@ void shouldBeAbleToExecuteLs() {
}

@Test
@EnabledOnOs({OS.LINUX, OS.MAC, OS.WINDOWS})
void shouldNotBeAbleToExecuteMissing() {
// given
final var tool = Paths.get("asdfasdfasadaggfksdjfgsdfglsdfglsfg");
Expand All @@ -92,20 +90,6 @@ void shouldNotBeAbleToExecuteTextFile() {
assertFalse(canExecute);
}

@Test
@EnabledOnOs(OS.WINDOWS)
@DisplayName("Should detect tool in PATH (Windows)")
void shouldDetectToolInPathWindows() {
// given
final var tool = "cmd";

// when
final var path = Executables.of(tool);

// then
assertTrue(path.isPresent());
}

@Test
@EnabledOnOs({OS.LINUX, OS.MAC})
@DisplayName("waits until tool exits")
Expand Down Expand Up @@ -149,21 +133,6 @@ void shouldWriteDebugMessageToSystemOut() throws Exception {
assertEquals("ilo executes: ls\n", text);
}

@Test
@EnabledOnOs(OS.WINDOWS)
@DisplayName("writes debug message to system.out on Windows")
void shouldWriteDebugMessageToSystemOutWindows() throws Exception {
// given
final var tool = "cmd";

// when
final var text = SystemLambda.tapSystemOutNormalized(
() -> Executables.runAndWaitForExit(List.of(tool), true));

// then
assertEquals("ilo executes: cmd\n", text);
}

@Test
@DisplayName("ignores empty lists")
void shouldNoExecuteEmptyList() {
Expand Down