Restore Windows support; fix Node.js paths

This commit is contained in:
Wilson Lin 2020-07-22 21:52:54 +10:00
parent 697823ab17
commit 4e691ac550
10 changed files with 51 additions and 81 deletions

View File

@ -12,16 +12,20 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [macos-latest, ubuntu-latest, windows-latest]
include:
- os: ubuntu-latest
ARCH: linux-x86_64
MIME: application/octet-stream
EXT: ''
- os: macos-latest
ARCH: macos-x86_64
MIME: application/octet-stream
EXT: ''
- os: ubuntu-latest
ARCH: linux-x86_64
MIME: application/octet-stream
EXT: ''
- os: windows-latest
ARCH: windows-x86_64
MIME: application/vnd.microsoft.portable-executable
EXT: '.exe'
steps:
- uses: actions/checkout@v1
- name: Get version
@ -32,27 +36,16 @@ jobs:
id: file
shell: bash
run: echo ::set-output name=FILE::${{ steps.version.outputs.VERSION }}-${{ matrix.ARCH }}${{ matrix.EXT }}
- name: Set up Rust (macOS, Linux)
if: runner.os != 'Windows'
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
- name: Set up Rust (Windows)
if: runner.os == 'Windows'
uses: actions-rs/toolchain@v1
with:
toolchain: stable-gnu
profile: minimal
default: true
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '^1.14.0'
- name: Set up GCC (Windows)
if: runner.os == 'Windows'
run: .\.github\workflows\gcc.ps1
- name: Run prebuild steps
shell: bash
run: bash ./prebuild.sh

View File

@ -1,4 +0,0 @@
Invoke-WebRequest 'https://wilsonl.in/TDM-GCC-64.7z' -OutFile C:\gcc.7z
7z x C:\gcc.7z -oC:\
$oldpath = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).Path
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value "C:\TDM-GCC-64\bin;$oldpath"

View File

@ -12,37 +12,29 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [macos-latest, ubuntu-latest, windows-latest]
include:
- os: ubuntu-latest
ARCH: linux-x86_64
FILE: 'libminify_html_java.so'
- os: macos-latest
ARCH: macos-x86_64
FILE: 'libminify_html_java.dylib'
- os: ubuntu-latest
ARCH: linux-x86_64
FILE: 'libminify_html_java.so'
- os: windows-latest
ARCH: windows-x86_64
FILE: 'hyperbuild_java.dll'
steps:
- uses: actions/checkout@v1
- name: Set up Rust (macOS, Linux)
if: runner.os != 'Windows'
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
- name: Set up Rust (Windows)
if: runner.os == 'Windows'
uses: actions-rs/toolchain@v1
with:
toolchain: stable-gnu
profile: minimal
default: true
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '^1.14.0'
- name: Set up GCC (Windows)
if: runner.os == 'Windows'
run: .\.github\workflows\gcc.ps1
- name: Run prebuild steps
shell: bash
run: bash ./prebuild.sh
@ -59,22 +51,32 @@ jobs:
needs: build
steps:
- uses: actions/checkout@v1
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: '1.7'
java-package: jdk
architecture: x64
- name: Download Linux built library
uses: actions/download-artifact@v1
with:
name: linux-x86_64
path: java/src/main/resources/linux-x86_64
- name: Download macOS built library
uses: actions/download-artifact@v1
with:
name: macos-x86_64
path: java/src/main/resources/macos-x86_64
- name: Download Windows built library
uses: actions/download-artifact@v1
with:
name: windows-x86_64
path: java/src/main/resources/windows-x86_64
- name: Move native library files to correct location
shell: bash
working-directory: ./java/src/main/resources
@ -83,6 +85,7 @@ jobs:
mv $f/* "$f.nativelib"
rmdir "$f"
done
- name: Build, pack, and publish JAR
working-directory: ./java
env:

View File

@ -12,13 +12,15 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [macos-latest, ubuntu-latest, windows-latest]
node: [8, 9, 10, 11, 12, 13, 14]
include:
- os: ubuntu-latest
ARCH: linux-x86_64
- os: macos-latest
ARCH: macos-x86_64
- os: ubuntu-latest
ARCH: linux-x86_64
- os: windows-latest
ARCH: windows-x86_64
steps:
- uses: actions/checkout@v1
- name: Get version
@ -29,27 +31,16 @@ jobs:
uses: actions/setup-node@master
with:
node-version: ${{ matrix.node }}.x
- name: Set up Rust (macOS, Linux)
if: runner.os != 'Windows'
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
- name: Set up Rust (Windows)
if: runner.os == 'Windows'
uses: actions-rs/toolchain@v1
with:
toolchain: stable-gnu
profile: minimal
default: true
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '^1.14.0'
- name: Set up GCC (Windows)
if: runner.os == 'Windows'
run: .\.github\workflows\gcc.ps1
- name: Run prebuild steps
shell: bash
run: bash ./prebuild.sh
@ -58,7 +49,7 @@ jobs:
shell: bash
run: |
npm install
npm run build-binary
npm run build
node compress.js
- name: Install B2 CLI (macOS, Linux)
if: runner.os != 'Windows'
@ -74,7 +65,7 @@ jobs:
run: |
binary_name="$(node -e 'console.log([process.platform, process.arch, process.versions.modules].join("__"))')"
b2 authorize-account ${{ secrets.CICD_CLI_B2_KEY_ID }} ${{ secrets.CICD_CLI_B2_APPLICATION_KEY }}
b2 upload-file ${{ secrets.CICD_CLI_B2_BUCKET_NAME }} ./nodejs/dist/index.node.gz "minify-html/bin/nodejs/${{ steps.version.outputs.VERSION }}/$binary_name.node.gz"
b2 upload-file ${{ secrets.CICD_CLI_B2_BUCKET_NAME }} ./nodejs/index.node.gz "minify-html/bin/nodejs/${{ steps.version.outputs.VERSION }}/$binary_name.node.gz"
package:
runs-on: ubuntu-latest
needs: build

View File

@ -12,7 +12,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [macos-latest, ubuntu-latest, windows-latest]
python: [3.5, 3.6, 3.7, 3.8]
steps:
- uses: actions/checkout@v1
@ -22,31 +22,18 @@ jobs:
python-version: ${{ matrix.python }}
architecture: 'x64'
- name: Set up Rust (macOS, Linux)
if: runner.os != 'Windows'
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
default: true
- name: Set up Rust (Windows)
if: runner.os == 'Windows'
uses: actions-rs/toolchain@v1
with:
toolchain: stable-gnu
profile: minimal
default: true
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '^1.14.0'
- name: Set up GCC (Windows)
if: runner.os == 'Windows'
run: .\.github\workflows\gcc.ps1
- name: Run prebuild steps
shell: bash
run: bash ./prebuild.sh

View File

@ -17,12 +17,13 @@ Comparison with [html-minfier](https://github.com/kangax/html-minifier) and [min
### CLI
Precompiled binaries are available for x86-64 macOS and Linux.
Precompiled binaries are available for x86-64 Linux, macOS, and Windows.
##### Get
[Linux](https://wilsonl.in/minify-html/bin/0.2.6-linux-x86_64) |
[macOS](https://wilsonl.in/minify-html/bin/0.2.6-macos-x86_64) |
[Linux](https://wilsonl.in/minify-html/bin/0.2.6-linux-x86_64)
[Windows](https://wilsonl.in/minify-html/bin/0.2.6-windows-x86_64)
##### Use
@ -101,7 +102,7 @@ fn main() {
- Package: [@minify-html/js](https://www.npmjs.com/package/@minify-html/js)
- Binding: [Neon](https://neon-bindings.com/)
- Platforms: macOS, Linux; Node.js 8 and higher
- Platforms: Linux, macOS, Windows; Node.js 8 and higher
##### Get
@ -150,7 +151,7 @@ const minified = minifyHtml.minifyInPlace(fs.readFileSync("source.html"), cfg);
- Package: [in.wilsonl.minifyhtml](https://search.maven.org/artifact/in.wilsonl.minifyhtml/minify-html)
- Binding: [JNI](https://github.com/jni-rs/jni-rs)
- Platforms: macOS, Linux; Java 7 and higher
- Platforms: Linux, macOS, Windows; Java 7 and higher
##### Get
@ -190,7 +191,7 @@ MinifyHtml.minifyInPlace(source, cfg);
- Package: [minify-html](https://pypi.org/project/minify-html)
- Binding: [PyO3](https://github.com/PyO3/pyo3)
- Platforms: macOS, Linux; Python 3.5 and higher
- Platforms: Linux, macOS, Windows; Python 3.5 and higher
##### Get
@ -214,7 +215,7 @@ except SyntaxError as e:
- Package: [minify_html](https://rubygems.org/gems/minify_html)
- Binding: [Rutie](https://github.com/danielpclark/rutie)
- Platforms: macOS, Linux; Ruby 2.5 and higher
- Platforms: Linux, macOS; Ruby 2.5 and higher
##### Get

View File

@ -6,7 +6,6 @@ pushd "$(dirname "$0")"
pushd ../nodejs
npm run build
npm run build-binary
popd
pushd minify-html-bench

View File

@ -2,6 +2,6 @@ const {readFileSync, writeFileSync} = require('fs');
const {join} = require('path');
const {gzipSync} = require('zlib');
const src = readFileSync(join(__dirname, 'dist', 'index.node'));
const src = readFileSync(join(__dirname, 'index.node'));
const out = gzipSync(src);
writeFileSync(join(__dirname, 'dist', 'index.node.gz'), out);
writeFileSync(join(__dirname, 'index.node.gz'), out);

View File

@ -2,12 +2,12 @@
"name": "@minify-html/js",
"version": "0.2.6",
"description": "Fast and smart HTML + JS minifier",
"main": "dist/index.node",
"main": "index.node",
"files": [
"postinstall.js"
],
"scripts": {
"build": "neon build --release && mkdir -p dist && mv native/index.node dist/index.node",
"build": "neon build --release && mv native/index.node index.node",
"postinstall": "node postinstall.js"
},
"repository": {

View File

@ -7,7 +7,7 @@ const pkg = require('./package.json');
const MAX_DOWNLOAD_ATTEMPTS = 4;
const binaryName = [process.platform, process.arch, process.versions.modules].join('__');
const binaryPath = path.join(__dirname, 'dist', 'index.node');
const binaryPath = path.join(__dirname, 'index.node');
const wait = ms => new Promise(resolve => setTimeout(resolve, ms));