diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 86d6b89..e8f68dd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,20 +1,23 @@ # Builds SqlJam. Database servers are not available here: the ci environment runs the integration tests of H2, # SQLite and DuckDB only, the others are skipped. # -# check pull requests and master: one Linux build with all tests, the check of merging -# platforms master, tags and manual runs: Windows, macOS and Linux build, start the runnable jar and take -# screenshots, packages for download (src/packaging/package.sh); it does not hold up pull requests -# release tags v*: a GitHub release with the packages of every platform +# check pull requests: one Linux build with all tests, the check of merging +# platforms tags v* and manual runs (Actions > build > Run workflow): Windows, macOS and Linux build, start the +# runnable jar and take screenshots, packages for download (src/packaging/package.sh) +# release tags v*: a GitHub release with the packages of every platform and their SHA-256 checksums +# Merging into master builds nothing, the pull request is checked already. name: build on: push: - branches: [master] tags: ['v*'] - paths-ignore: ['docs/**', '**/*.md', 'change_logs/**'] pull_request: paths-ignore: ['docs/**', '**/*.md', 'change_logs/**'] workflow_dispatch: + inputs: + version: + description: Version of the packages, e.g. 1.0.0 to try the msi installer (the version of pom.xml if empty) + required: false # A newer commit of the same branch or pull request cancels the running build concurrency: @@ -23,6 +26,7 @@ concurrency: jobs: check: + if: github.event_name == 'pull_request' runs-on: ubuntu-latest timeout-minutes: 30 steps: @@ -102,11 +106,25 @@ jobs: grep -q ":: SqlJam ::" run.log if grep -E "Exception|ERROR" run.log; then exit 1; fi - # Packages of a tag are named by it (v1.0.0-rc1: SqlJam-1.0.0-rc1-...), others by the version of pom.xml + # jpackage builds the msi installer with the WiX Toolset 3, the binaries are used without installing them + - name: Install the WiX Toolset for the msi installer + if: runner.os == 'Windows' + shell: pwsh + run: | + $wix = Join-Path $env:RUNNER_TEMP "wix" + Invoke-WebRequest -Uri "https://github.com/wixtoolset/wix3/releases/download/wix3141rtm/wix314-binaries.zip" ` + -OutFile "$wix.zip" + Expand-Archive -Path "$wix.zip" -DestinationPath $wix + $wix | Out-File -FilePath $env:GITHUB_PATH -Append -Encoding utf8 + + # Packages of a tag are named by it (v1.0.0-rc1: SqlJam-1.0.0-rc1-...), of a manual run by its version input, + # others by the version of pom.xml. Pre-releases have no msi installer. - name: Package for download shell: bash + env: + INPUT_VERSION: ${{ github.event.inputs.version }} run: | - VERSION="" + VERSION="$INPUT_VERSION" case "$GITHUB_REF" in refs/tags/v*) VERSION="${GITHUB_REF_NAME#v}" ;; esac sh src/packaging/package.sh ${{ matrix.platform }} $VERSION @@ -131,6 +149,16 @@ jobs: with: path: artifacts + # The packages of every platform in one directory with their SHA-256 checksums, verified by downloaders with + # sha256sum -c SHA256SUMS.txt --ignore-missing (shasum -a 256 -c on macOS) + - name: Collect the packages and their checksums + run: | + mkdir release + find artifacts -type f \( -name 'SqlJam-*' -o -name 'sqljam_*.deb' \) -exec cp {} release/ \; + cd release + sha256sum * > SHA256SUMS.txt + cat SHA256SUMS.txt + - name: Create the release with the packages env: GH_TOKEN: ${{ github.token }} @@ -139,4 +167,4 @@ jobs: PRERELEASE="" case "$GITHUB_REF_NAME" in *-*) PRERELEASE="--prerelease" ;; esac gh release create "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --title "SqlJam $GITHUB_REF_NAME" \ - $PRERELEASE --generate-notes $(find artifacts -name 'SqlJam-*' -o -name 'sqljam_*.deb') + $PRERELEASE --generate-notes release/* diff --git a/docs/assets/login.png b/docs/assets/login.png index 21c6cb4..7e629d0 100644 Binary files a/docs/assets/login.png and b/docs/assets/login.png differ diff --git a/src/main/java/com/github/sqljam/face/view/LoginView.java b/src/main/java/com/github/sqljam/face/view/LoginView.java index 346c513..5b80d40 100644 --- a/src/main/java/com/github/sqljam/face/view/LoginView.java +++ b/src/main/java/com/github/sqljam/face/view/LoginView.java @@ -90,15 +90,20 @@ public LoginView(AppContext context, Consumer onLogin) { } }); VBox.setVgrow(profileList, Priority.ALWAYS); - Button newButton = new Button(Messages.get("login.new"), Icons.of(Icons.ADD)); + // Icons of the list like DBeaver and DataGrip, the names are their tooltips; texts are never cut off + Button newButton = new Button(null, Icons.of(Icons.ADD)); newButton.setId("newButton"); + newButton.setTooltip(new Tooltip(Messages.get("login.new"))); + newButton.setAccessibleText(Messages.get("login.new")); newButton.setOnAction(event -> { profileList.getSelectionModel().clearSelection(); connectionForm.setProfile(new ConnectionProfile(), true); connectionForm.focusFirstField(); }); - Button deleteButton = new Button(Messages.get("login.delete"), Icons.of(Icons.DELETE)); + Button deleteButton = new Button(null, Icons.of(Icons.DELETE)); deleteButton.setId("deleteButton"); + deleteButton.setTooltip(new Tooltip(Messages.get("login.delete"))); + deleteButton.setAccessibleText(Messages.get("login.delete")); deleteButton.disableProperty().bind(profileList.getSelectionModel().selectedItemProperty().isNull()); deleteButton.setOnAction(event -> deleteSelected()); // The example database comes back after the user removed it @@ -111,6 +116,7 @@ public LoginView(AppContext context, Consumer onLogin) { .ifPresent(profileList.getSelectionModel()::select); })); HBox listButtons = new HBox(8, newButton, deleteButton, exampleButton); + listButtons.getChildren().forEach(button -> ((Button) button).setMinWidth(Region.USE_PREF_SIZE)); Label savedLabel = new Label(Messages.get("login.savedConnections")); savedLabel.getStyleClass().add("section-title"); VBox left = new VBox(10, savedLabel, searchField, profileList, listButtons); diff --git a/src/packaging/package.sh b/src/packaging/package.sh index 0001399..6678af4 100755 --- a/src/packaging/package.sh +++ b/src/packaging/package.sh @@ -8,7 +8,8 @@ # The version names the packages, e.g. 1.0.0-rc1 of the tag v1.0.0-rc1; the version of pom.xml by default. # # mac-aarch64, mac SqlJam.app in SqlJam--.dmg -# win SqlJam--win.zip, SqlJam\SqlJam.exe without installing +# win SqlJam--win.zip, SqlJam\SqlJam.exe without installing, and SqlJam--win.msi +# of releases (not of pre-releases like 1.0.0-rc1) when the WiX Toolset 3 is on the path # linux SqlJam--linux.tar.gz (SqlJam/bin/SqlJam) and sqljam__amd64.deb # every platform SqlJam---jar.zip, the runnable jar with its launch scripts (Java 17+) # @@ -103,6 +104,28 @@ case "$PLATFORM" in win) rm -f "$OUT/SqlJam-$VERSION-win.zip" (cd "$WORK" && jar --create --no-manifest --file "$OUT/SqlJam-$VERSION-win.zip" SqlJam) + # An installer with a directory chooser, Start menu and desktop shortcuts. The upgrade code is the same + # for every version, a newer version replaces the installed one. Versions of msi are numbers only, a + # pre-release (1.0.0-rc1, 1.0.0-SNAPSHOT) would be the same version as its release and would not be + # replaced by it, pre-releases have the zip only. + case "$VERSION" in + *-*) + echo "Pre-release $VERSION, the msi installer is skipped" >&2 + ;; + *) + if command -v candle >/dev/null 2>&1 || command -v candle.exe >/dev/null 2>&1; then + jpackage --type msi --dest "$WORK" --app-image "$WORK/SqlJam" --name SqlJam \ + --app-version "$APP_VERSION" --vendor "Fred Feng" \ + --description "Import and export tool for relational and OLAP databases" \ + --win-dir-chooser --win-menu --win-menu-group SqlJam --win-shortcut \ + --win-upgrade-uuid 494b38a3-8f4d-457f-bd03-4b48948608e5 + rm -f "$OUT/SqlJam-$VERSION-win.msi" + mv "$WORK"/SqlJam-*.msi "$OUT/SqlJam-$VERSION-win.msi" + else + echo "WiX Toolset 3 not found, the msi installer is skipped" >&2 + fi + ;; + esac ;; linux) rm -f "$OUT/SqlJam-$VERSION-linux.tar.gz"