Skip to content

Commit

Permalink
Merge branch 'master' into set-resource-strings
Browse files Browse the repository at this point in the history
  • Loading branch information
dsanders11 committed Aug 4, 2023
2 parents 0561c3e + b696ed2 commit 4c7f14d
Show file tree
Hide file tree
Showing 9 changed files with 176 additions and 1,071 deletions.
193 changes: 75 additions & 118 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,131 +1,88 @@
step-env: &step-env
run:
# prevent Wine popup dialogs about installing additional packages
name: Setup Environment Variables
command: |
echo 'export WINEDLLOVERRIDES="mscoree,mshtml="' >> $BASH_ENV
echo 'export WINEDEBUG="-all"' >> $BASH_ENV
step-restore-brew-cache: &step-restore-brew-cache
restore_cache:
name: Restoring Homebrew cache
paths:
- /usr/local/Homebrew
keys:
- v1-brew-cache-{{ arch }}

step-save-brew-cache: &step-save-brew-cache
save_cache:
name: Persisting Homebrew cache
paths:
- /usr/local/Homebrew
key: v1-brew-cache-{{ arch }}

step-restore-cache: &step-restore-cache
restore_cache:
keys:
- v1-dependencies-{{ arch }}-{{ checksum "yarn.lock" }}
- v1-dependencies-{{ arch }}

step-save-cache: &step-save-cache
save_cache:
paths:
- node_modules
key: v1-dependencies-{{ arch }}-{{ checksum "yarn.lock" }}

step-install-os-dependencies: &step-install-os-dependencies
run:
name: Install OS Dependencies
command: |
case "$(uname)" in
Linux)
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install --no-install-recommends -y wine64 wine32 wine
;;
Darwin)
brew install --cask xquartz
# TODO: use first-party wine-stable when winehq generates installers again
# See: https://bugs.winehq.org/show_bug.cgi?id=49167
brew tap gcenx/wine
brew install --cask --no-quarantine gcenx-wine-stable
;;
esac
steps-linux-win: &steps-linux-win
steps:
- *step-env
- *step-install-os-dependencies
- checkout
- *step-restore-cache
- run: yarn
- *step-save-cache
- run: yarn test

steps-mac: &steps-mac
steps:
- *step-env
- *step-restore-brew-cache
- *step-install-os-dependencies
- *step-save-brew-cache
- checkout
- *step-restore-cache
- run: yarn
- *step-save-cache
- run: yarn test

version: 2.1

orbs:
win: circleci/[email protected]
jobs:
test-linux-10:
docker:
- image: circleci/node:10
<<: *steps-linux-win
test-linux-12:
docker:
- image: circleci/node:12
<<: *steps-linux-win
test-linux-14:
docker:
- image: circleci/node:14
<<: *steps-linux-win
test-mac:
macos:
xcode: "10.2.0"
<<: *steps-mac
test-windows:
executor:
name: win/vs2019
shell: bash.exe
<<: *steps-linux-win
cfa: continuousauth/[email protected]
node: electronjs/[email protected]

release:
docker:
- image: circleci/node:14.15.1
jobs:
test:
environment:
# prevent Wine popup dialogs about installing additional packages
WINEDLLOVERRIDES: mscoree,mshtml=
WINEDEBUG: -all
executor: <<parameters.executor>>
parameters:
executor:
description: The executor to use for the job.
type: string
node-version:
description: Specify the Node.js version to install.
type: string
steps:
- checkout
- *step-restore-cache
- run: yarn
- run: npx semantic-release
- node/test:
checkout-steps:
- when:
condition:
equal: [ node/macos, << parameters.executor >> ]
steps:
- restore_cache:
name: Restoring Homebrew cache
paths:
- /usr/local/Homebrew
keys:
- v1-brew-cache-{{ arch }}
- run:
name: Install OS Dependencies
command: |
case "$(uname)" in
Linux)
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install --no-install-recommends -y wine64 wine32 wine
;;
Darwin)
brew install --cask xquartz
brew tap homebrew/cask-versions
brew install --cask --no-quarantine wine-stable
;;
esac
- when:
condition:
equal: [ node/macos, << parameters.executor >> ]
steps:
- save_cache:
name: Persisting Homebrew cache
paths:
- /usr/local/Homebrew
key: v1-brew-cache-{{ arch }}
- checkout
node-version: << parameters.node-version >>

workflows:
version: 2
test_and_release:
# Run the test jobs first, then the release only when all the test jobs are successful
jobs:
- test-linux-10
- test-linux-12
- test-linux-14
- test-mac
- test-windows
- release:
- test:
name: test-<< matrix.executor >>-<< matrix.node-version >>
matrix:
alias: test
parameters:
executor:
- node/linux
- node/macos
- node/windows
node-version:
- 20.2.0
- 18.14.0
- 16.19.0
- 14.19.0
- 12.22.12
- 10.24.1
- cfa/release:
requires:
- test-linux-10
- test-linux-12
- test-linux-14
- test-mac
- test-windows
- test
filters:
branches:
only:
- master
context: cfa-release
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @electron/wg-ecosystem
26 changes: 26 additions & 0 deletions .github/workflows/semantic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "Check Semantic Commit"

on:
pull_request:
types:
- opened
- edited
- synchronize

permissions:
contents: read

jobs:
main:
permissions:
pull-requests: read # for amannn/action-semantic-pull-request to analyze PRs
statuses: write # for amannn/action-semantic-pull-request to mark status of analyzed PR
name: Validate PR Title
runs-on: ubuntu-latest
steps:
- name: semantic-pull-request
uses: amannn/action-semantic-pull-request@c3cd5d1ea3580753008872425915e343e351ab54 # v5.2.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
validateSingleCommit: false
9 changes: 0 additions & 9 deletions .npmignore

This file was deleted.

4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Code of Conduct

This project is a part of the Electron ecosystem. As such, all contributions to this project follow [Electron's code of conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md)
This project is a part of the Electron ecosystem. As such, all contributions to this project follow [Electron's code of conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md)
where appropriate.

## Bugs / Feature Requests
Expand All @@ -15,4 +15,4 @@ first before filing an issue here.

`node-rcedit` uses `semantic-release` plus a plugin named "continuous factor authentication" to
publish new releases to NPM. When a pull request is merged, a new release is queued in CircleCI, and
a member of the Electron [Docs & Tools Working Group](https://github.com/electron/governance/tree/master/wg-docs-tools) needs to approve it.
a member of the Electron [Ecosystem Working Group](https://github.com/electron/governance/tree/main/wg-ecosystem) needs to approve it.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# node-rcedit

[![CircleCI build status](https://circleci.com/gh/electron/node-rcedit/tree/master.svg?style=svg)](https://circleci.com/gh/electron/node-rcedit/tree/master)
[![CircleCI build status](https://circleci.com/gh/electron/node-rcedit/tree/master.svg?style=shield)](https://circleci.com/gh/electron/node-rcedit/tree/master)
[![NPM package](https://img.shields.io/npm/v/rcedit)](https://npm.im/rcedit)

Node module to edit resources of Windows executables.

Expand Down Expand Up @@ -41,5 +42,5 @@ Returns a `Promise` with no value.
## Building

* Clone the repository
* Run `npm install`
* Run `npm test` to run the tests
* Run `yarn install`
* Run `yarn test` to run the tests
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
"description": "Node module to edit resources of exe",
"main": "lib/rcedit.js",
"types": "lib/index.d.ts",
"files": [
"bin",
"lib/index.d.ts"
],
"scripts": {
"docs:build": "node script/build-docs.js",
"mocha": "mocha test/*.js",
Expand Down Expand Up @@ -31,8 +35,6 @@
"@continuous-auth/semantic-release-npm": "^2.0.0",
"got": "^11.8.0",
"mocha": "^8.2.1",
"rcinfo": "^0.1.3",
"semantic-release": "^17.3.0",
"standard": "^16.0.3",
"temp": "^0.9.4",
"ts-standard": "^10.0.0",
Expand Down
32 changes: 29 additions & 3 deletions test/rcedit-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,38 @@ const fs = require('fs')
const path = require('path')
const { promisify } = require('util')
const rcedit = require('..')
const rcinfo = promisify(require('rcinfo'))
const { canRunWindowsExeNatively, is64BitArch, spawnExe } = require('cross-spawn-windows-exe')
const temp = require('temp').track()

const copyFile = promisify(fs.copyFile)
const readFile = promisify(fs.readFile)

// Replicate the functionality of the rcinfo npm package using rcedit
async function rcinfo (exe) {
const rceditExe = is64BitArch(process.arch) ? 'rcedit-x64.exe' : 'rcedit.exe'
const rcedit = path.resolve(__dirname, '..', 'bin', rceditExe)

const spawnOptions = {
env: { ...process.env }
}

if (!canRunWindowsExeNatively()) {
// Suppress "fixme:" stderr log messages
spawnOptions.env.WINEDEBUG = '-all'
}

const getVersionString = (key) => spawnExe(rcedit, [exe, '--get-version-string', key], spawnOptions)

return {
CompanyName: await getVersionString('CompanyName'),
FileDescription: await getVersionString('FileDescription'),
LegalCopyright: await getVersionString('LegalCopyright'),
ProductName: await getVersionString('ProductName'),
FileVersion: await getVersionString('FileVersion'),
ProductVersion: await getVersionString('ProductVersion')
}
}

async function assertRceditError (exePath, options, messages) {
try {
await rcedit(exePath, options)
Expand Down Expand Up @@ -75,14 +101,14 @@ describe('async rcedit(exePath, options)', function () {
await rcedit(exePath, { 'product-version': '1' })

const info = await rcinfo(exePath)
assert.strictEqual(info.ProductVersion, '1.0.0.0')
assert.strictEqual(info.ProductVersion, '1')
})

it('supports a product version of 1.0', async () => {
await rcedit(exePath, { 'product-version': '1.0' })

const info = await rcinfo(exePath)
assert.strictEqual(info.ProductVersion, '1.0.0.0')
assert.strictEqual(info.ProductVersion, '1.0')
})

it('supports setting requestedExecutionLevel to requireAdministrator', async () => {
Expand Down
Loading

0 comments on commit 4c7f14d

Please sign in to comment.