Skip to content

Commit

Permalink
kotlin and powershell
Browse files Browse the repository at this point in the history
  • Loading branch information
milesstoetzner authored Dec 27, 2023
1 parent 5e5e3bc commit bc309ab
Show file tree
Hide file tree
Showing 16 changed files with 691 additions and 81 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/zenodo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
python-version: 3.10.13

- name: (PREPARE) Install Python dependencies
run: pip install -r cmds/zenodo/requirements.txt
run: pip install -r zenodo/requirements.txt

###################################################
#
Expand Down
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,9 @@ opentosca-vintner-*.tgz
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
!.yarn/versions

# choco
*.nupkg
choco/tools/vintner.exe
choco/tools/vintner.exe.asc
12 changes: 12 additions & 0 deletions docs/cmds/interface/template.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@ tags:
requests.post(SERVER_ADDRESS + "/<%- commands.join('/') -%>")
<% } -%>
```
=== "Kotlin"
```kotlin linenums="1"
import khttp.post
<% if (options.filter(o => o.mandatory).length !== 0) { -%>
post(SERVER_ADDRESS + "/<%- commands.join('/') -%>", json=mapOf(
<%- options.filter(o => o.mandatory).map(o => `\t\t"${o.option}" to ${o.option.toUpperCase()}`).join(',\n') %>
))
<% } else { -%>
post(SERVER_ADDRESS + "/<%- commands.join('/') -%>")
<% } -%>
```
<% } -%>
<% if (options.length !== 0) { %>
| Option | Mandatory | Type | Description |
Expand Down
62 changes: 5 additions & 57 deletions docs/docs/contributing/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ Our branching workflow follows [GitHub Flow](https://docs.github.com/de/get-star

Branches should be names as follows

- `fix-short-title` for bug fixes
- `docs-short-title` for documentations
- `feature-short-title` for features
- `fix-short-title` for bug fixes
- `refactor-short-title` for refactoring
- `imrpove-short-title` for improvements
- `chore-short-title` for chores
- `docs-short-title` for documentations
- `project-short-title` for thesis, EnPro, StuPro ...

## Squash and Merge
Expand Down Expand Up @@ -80,7 +80,8 @@ To run the tests, use
yarn test
```

On pushes to the `main` branch these tests are executed.
On pushes to the `main` branch or on pull requests, the `tests` workflow is triggered.
This workflow runs the tests.

## Lint

Expand Down Expand Up @@ -143,56 +144,3 @@ yarn patch-package ${package-name}

If you need to patch the `package.json`, then append the option `--exclude 'nothing'` as stated in [#311](https://github.com/ds300/patch-package/issues/311){target=_blank}.

## Build

To locally build the project, run the following command.
This will transpile Javascript inside the `/build` directory.

```shell linenums="1"
yarn build
```

## Package

{{ linux_only_notice() }}

To locally package the project, run the following command.
This will package the previously transpiled Javascript using [`pkg`](https://github.com/vercel/pkg){target=_blank} and
generate binaries inside the `/dist` directory.

```shell linenums="1"
yarn package
```

The issue considering the failed bytecode generation of MiniSat is known and can be ignored in our case.

## Release

On pushes to the `main` branch, the `release` workflow is triggered.
This workflow runs several tests, builds and packages the project and creates a new release.
Thereby, an existing release and `latest` tag is deleted.
There is only one release at total.
During the workflow the string `__VERSION__` inside a Javascript file is replace with the current commit hash.
The current version can be checked using `vintner --version`.

## Night

The `night` workflow is scheduled for every tuesday at 420.
This workflow ensures that the latest release is correctly signed and can be executed.

## NPM

There is also a npm package [`opentosca-vintner`](https://www.npmjs.com/package/opentosca-vintner){target=_blank}.
New versions are published manually.
To publish a new version, first update the version number in `package.json` and then run

````shell linenums="1"
yarn release:npm
````

## Zenodo

There is also a Zenodo record with a unique DOI for OpenTOSCA Vintner: [https://doi.org/10.5281/zenodo.10155277](https://doi.org/10.5281/zenodo.10155277){target=_blank}
To publish a new version, run the Zenodo workflow on GitHub.
This workflow will create a draft of a new version based on the latest GitHub release.
The version must be manually published on Zenodo.
10 changes: 2 additions & 8 deletions docs/docs/contributing/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,8 @@ The documentation is powered by [Material for MkDocs](https://squidfunk.github.i
Corresponding files are located in the `docs` directory.
Custom macros are implemented in `docs/macros.py` using [mkdocs-macros](https://mkdocs-macros-plugin.readthedocs.io){target=_blank}.

We expect that Python and [pandoc](https://pandoc.org){target=_blank} is already installed.
To install [pandoc](https://pandoc.org){target=_blank} on Ubuntu you might run

```shell linenums="1"
sudo apt-get install pandoc
```

With the following command you can install `mkdocs-material` along with its requirements globally on your system.
First, install all dependencies, such as Python, [pandoc](https://pandoc.org){target=_blank}, mkdocs, PlantUML, etc. globally on your system.
Reload your session after the installation.

```shell linenums="1"
yarn docs:install
Expand Down
71 changes: 71 additions & 0 deletions docs/docs/contributing/release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
tags:
- Contributing
---

# Release

This document contains information about releases.

## Build

To locally build the project, run the following command.
This will transpile Javascript inside the `/build` directory.
During the build, the string `__VERSION__` inside a Javascript file is replace with the current commit hash.
The current version can be checked using `vintner --version`.

```shell linenums="1"
yarn build
```

## Package

{{ linux_only_notice() }}

To locally package the project, run the following command.
This will package the previously transpiled Javascript using [`pkg`](https://github.com/vercel/pkg){target=_blank} and
generate binaries inside the `/dist` directory.

```shell linenums="1"
yarn package
```

The issue considering the failed bytecode generation of MiniSat is known and can be ignored in our case.

## GitHub

On pushes to the `main` branch, the `release` workflow is triggered.
This workflow runs several tests, builds and packages the project and creates a new [GitHub release](https://github.com/OpenTOSCA/opentosca-vintner/releases/tag/latest){target=_blank}.
Thereby, an existing GitHub release and `latest` tag is deleted.
There is only one release at total.

However, there is also the `build` workflow.
This workflow basically has the same steps as the `release` workflow but does create his own GitHub release and does not deploy the docs.

## Night

The `night` workflow is scheduled for every tuesday at 420.
This workflow ensures that the latest release is correctly signed and can be executed.

## NPM

There is also a npm package [`opentosca-vintner`](https://www.npmjs.com/package/opentosca-vintner){target=_blank}.
New versions are published manually.
To publish a new version, first update the version number in `package.json` and then run

````shell linenums="1"
yarn release:npm
````

## Docker

There are also Docker containers: [https://github.com/OpenTOSCA/opentosca-vintner/pkgs/container/opentosca-vintner](https://github.com/OpenTOSCA/opentosca-vintner/pkgs/container/opentosca-vintner){target=_blank}.
They are automatically build and pushed during the Release workflow.


## Zenodo

There is also a Zenodo record with a unique DOI for OpenTOSCA Vintner: [https://doi.org/10.5281/zenodo.10155277](https://doi.org/10.5281/zenodo.10155277){target=_blank}.
To publish a new version, run the Zenodo workflow on GitHub.
This workflow will create a draft of a new version based on the latest GitHub release.
The version must be manually published on Zenodo.
13 changes: 13 additions & 0 deletions docs/docs/contributing/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,16 @@ Prettier should be configured as given in the figure below with the following pa
![IntelliJ Prettier Settings](intellij-prettier.png){class=figure}
<figcaption>Figure 2: IntelliJ Prettier Settings</figcaption>
</figure>


## Excluded Directories

The following directories should be excluded from search by the IDE.

- `.nyc_output`
- `build`
- `build-docs`
- `coverage`
- `yarn`
- `dist`
- `node_modules`
29 changes: 29 additions & 0 deletions docs/docs/install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Bin directory
$userBin = "$env:USERPROFILE\bin"

# Check if vintner is already installed
if (Get-Command -Name "vintner" -ErrorAction SilentlyContinue) {
Write-Host "vintner is already installed"
exit 1
}

# Add bin directory to path
if (-not (Test-Path -Path $userBin)) {
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\bin"

$userPath = [System.Environment]::GetEnvironmentVariable("PATH", [System.EnvironmentVariableTarget]::User)
$newPath = "$userPath$userBin;"
[System.Environment]::SetEnvironmentVariable("PATH", $newPath, [System.EnvironmentVariableTarget]::User)
}

# Version
$version = if ($env:VERSION) { $env:VERSION } else { "latest" }

# Install vintner
Invoke-WebRequest -URI "https://github.com/opentosca/opentosca-vintner/releases/download/$version/vintner-win-x64.exe.xz" -OutFile vintner-win-x64.exe.xz
tar -xf vintner-win-x64.exe.xz
Remove-Item vintner-win-x64.exe.xz
Move-Item vintner-win-x64.exe "$userBin\vintner.exe"

# Init setup
vintner setup init
2 changes: 1 addition & 1 deletion docs/docs/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -e

if which vintner &>/dev/null; then
echo "vintner is already installed"
exit 0
exit 1
fi

if [ "$EUID" -ne 0 ]; then
Expand Down
61 changes: 51 additions & 10 deletions docs/docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,20 +148,36 @@ docker exec -it vintner /bin/bash

## Script

`vintner` can be installed using our installation script.
The script currently supports only Linux x64 and arm64.
`vintner` can be installed using our installation scripts.
For the remaining supported platforms and architectures, see the manual installation.

```shell linenums="1"
curl -fsSL https://vintner.opentosca.org/install.sh | sudo bash -
vintner setup init
```
=== "Linux x64/ arm64"
```shell linenums="1"
curl -fsSL https://vintner.opentosca.org/install.sh | sudo bash -
```

To install a specific version, run

```shell linenums="1"
curl -fsSL https://vintner.opentosca.org/install.sh | sudo VERSION=${VERSION} bash -
```

To install a specific version, run
=== "Windows x64"
```powershell linenums="1"
Invoke-WebRequest -Uri "https://vintner.opentosca.org/install.ps1" -OutFile install.ps1
powershell -ExecutionPolicy Bypass -File .\install.ps1
Remove-Item install.ps1
```

To install a specific version, run

```powershell linenums="1"
Invoke-WebRequest -Uri "https://vintner.opentosca.org/install.ps1" -OutFile install.ps1
$env:VERSION = "DESIRED_VERSION"
powershell -ExecutionPolicy Bypass -File .\install.ps1
Remove-Item install.ps1
```

```shell linenums="1"
curl -fsSL https://vintner.opentosca.org/install.sh | sudo VERSION=${VERSION} bash -
```

## Manual

Expand Down Expand Up @@ -201,6 +217,31 @@ See [below](#signature) for verifying the signature of the binary.
vintner setup init
```

=== "Windows x64"
First, create the directory `"$env:USERPROFILE\bin"` and add it to your PATH.
We recommend to do this manually.

```powershell linenums="1"
$userBin = "$env:USERPROFILE\bin"
if (-not (Test-Path -Path $userBin)) {
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\bin"
$userPath = [System.Environment]::GetEnvironmentVariable("PATH", [System.EnvironmentVariableTarget]::User)
$newPath = "$userPath$userBin;"
[System.Environment]::SetEnvironmentVariable("PATH", $newPath, [System.EnvironmentVariableTarget]::User)
}
```

Next, install vintner.

```powershell linenums="1"
$userBin = "$env:USERPROFILE\bin"
Invoke-WebRequest -URI https://github.com/opentosca/opentosca-vintner/releases/download/latest/vintner-win-x64.exe.xz -OutFile vintner-win-x64.exe.xz
tar -xf vintner-win-x64.exe.xz
Remove-Item vintner-win-x64.exe.xz
Move-Item vintner-win-x64.exe $userBin\vintner.exe
vintner setup init
```

The following binaries are available:

| Platform | Architecture | Binary | Archive | Signature |
Expand Down
Loading

0 comments on commit bc309ab

Please sign in to comment.