From 8a2ec8fcb3db72b990e19a5ba7464e33f48143ed Mon Sep 17 00:00:00 2001 From: epszaw Date: Wed, 24 Apr 2024 12:08:27 +0200 Subject: [PATCH] add build workflow to reproduce einval problem --- .github/workflows/build.yml | 35 +++++++++++++++++++++++++++++++++++ fetch-source.ps1 | 23 +++++++++++++++++++++++ index.js | 3 ++- package-lock.json | 16 ++++++++++++++-- package.json | 2 +- 5 files changed, 75 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 fetch-source.ps1 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..b7b1f9e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,35 @@ +name: Build + +on: + workflow_dispatch: + pull_request: + branches: + - "*" + push: + branches: + - "main" + - "hotfix-*" + +jobs: + build: + strategy: + fail-fast: false + matrix: + node-version: [ 18, 20, 21 ] + os: [ ubuntu-latest, windows-latest, macos-latest ] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + registry-url: https://registry.npmjs.org/ + - run: npm ci + - name: "Fetch & Unpack Allure Commandline from Maven Central" + run: ./fetch-source.sh + if: runner.os != 'Windows' + - name: "Fetch & Unpack Allure Commandline from Maven Central" + run: powershell -ExecutionPolicy Bypass -File fetch-source.ps1 + if: runner.os == 'Windows' + - run: npm link + - run: allure --version \ No newline at end of file diff --git a/fetch-source.ps1 b/fetch-source.ps1 new file mode 100644 index 0000000..82bd007 --- /dev/null +++ b/fetch-source.ps1 @@ -0,0 +1,23 @@ +# Get version from package.json +$version = node -p "require('./package.json').version" + +# Remove dist directory if it exists and create a new one +if(Test-Path -Path dist) { + Remove-Item -Path dist -Recurse -Force +} +New-Item -ItemType Directory -Path dist + +# Remove allure-commandline.zip if it exists +if(Test-Path -Path allure-commandline.zip) { + Remove-Item -Path allure-commandline.zip -Force +} + +# Download allure-commandline.zip from Maven repository +Invoke-WebRequest -Uri "https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/$version/allure-commandline-$version.zip" -OutFile allure-commandline.zip + +# Extract allure-commandline.zip to dist directory +Add-Type -AssemblyName System.IO.Compression.FileSystem +[System.IO.Compression.ZipFile]::ExtractToDirectory('allure-commandline.zip', 'dist') + +# List files in current directory +Get-ChildItem -Path . \ No newline at end of file diff --git a/index.js b/index.js index c363b30..5e054b8 100644 --- a/index.js +++ b/index.js @@ -6,6 +6,7 @@ var allureCommand = 'allure' + (isWindows ? '.bat' : ''); module.exports = function(args) { return require('child_process').spawn(path.join(__dirname, 'dist/bin', allureCommand), args, { env: process.env, - stdio: 'inherit' + stdio: 'inherit', + shell: true, }); } diff --git a/package-lock.json b/package-lock.json index 6eccdf6..ca73f48 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,17 @@ { "name": "allure-commandline", - "version": "2.13.8", - "lockfileVersion": 1 + "version": "2.28.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "allure-commandline", + "version": "2.28.0", + "license": "Apache-2.0", + "bin": { + "allure": "bin/allure" + }, + "devDependencies": {} + } + } } diff --git a/package.json b/package.json index 5deaf1a..b38019a 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "index.js" ], "scripts": { - "test": "./bin/allure --version" + "test": "node ./bin/allure --version" }, "repository": "https://github.com/allure-framework/allure-npm.git", "license": "Apache-2.0",