Skip to content

Commit

Permalink
build: update CI file to lock actions and pass CI (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshallOfSound authored Feb 5, 2025
1 parent e2ec877 commit 64210b8
Show file tree
Hide file tree
Showing 10 changed files with 4,649 additions and 43 deletions.
38 changes: 14 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,35 @@ on:
tags:
- v[0-9]+.[0-9]+.[0-9]+*
pull_request:
workflow_call:

permissions:
contents: read

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macOS-latest, ubuntu-latest]
node-version: [10.x, 12.x]
os: [windows-latest, macos-13, ubuntu-latest]
node-version: [14.x, 16.x, 18.x, 20.x]

steps:
- name: Fix git checkout line endings
run: git config --global core.autocrlf input
- uses: actions/checkout@v2
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: ${{ matrix.node-version }}
- name: Cache node_modules
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.OS }}-build-${{ env.cache-name }}-
${{ runner.OS }}-build-
${{ runner.OS }}-
cache: yarn
- name: Install
run: |
npm install --engine-strict
npm update
yarn install --frozen-lockfile --ignore-engines
- name: Lint
run: npm run lint
run: yarn lint
- name: TypeScript definition linting
run: npm run tsd
run: yarn tsd
- name: Test
run: npm run coverage
- name: Codecov
run: npm run codecov
env:
CI_OS: ${{ matrix.os }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
NODE_VERSION: ${{ matrix.node-version }}
run: yarn coverage
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Release

on:
push:
branches:
- main

jobs:
test:
uses: ./.github/workflows/ci.yml

release:
name: Release
runs-on: ubuntu-latest
needs: test
environment: npm
permissions:
id-token: write # for CFA and npm provenance
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 20.x
cache: 'yarn'
- name: Install
run: yarn install --frozen-lockfile
- uses: continuousauth/action@4e8a2573eeb706f6d7300d6a9f3ca6322740b72d # v1.0.5
with:
project-id: ${{ secrets.CFA_PROJECT_ID }}
secret: ${{ secrets.CFA_SECRET }}
npm-token: ${{ secrets.NPM_TOKEN }}
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@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5.5.3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
validateSingleCommit: false
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.nyc_output
node_modules
package-lock.json
yarn.lock
10 changes: 10 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@continuous-auth/semantic-release-npm",
"@semantic-release/github"
],
"branches": [ "main" ]
}

36 changes: 21 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "electron-installer-common",
"version": "0.10.4",
"version": "0.0.0-development",
"description": "Common functionality for creating distributable Electron apps",
"author": "Mark Lee",
"license": "Apache-2.0",
Expand All @@ -26,34 +26,35 @@
"src"
],
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.8.0",
"@typescript-eslint/parser": "^4.8.0",
"ava": "^3.0.0",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"ava": "^4.3.3",
"codecov": "^3.5.0",
"eslint": "^7.12.1",
"eslint-config-standard": "^16.0.0",
"eslint": "^8.57.1",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-ava": "^12.0.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.0.0",
"eslint-plugin-promise": "^5.1.0",
"nyc": "^15.0.0",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.1.0",
"nyc": "^15.1.0",
"sinon": "^11.1.0",
"tsd": "^0.16.0",
"typescript": "^4.0.2"
},
"dependencies": {
"@malept/cross-spawn-promise": "^1.0.0",
"@electron/asar": "^3.2.5",
"@malept/cross-spawn-promise": "^2.0.0",
"debug": "^4.1.1",
"fs-extra": "^9.0.0",
"glob": "^7.1.4",
"fs-extra": "^11.2.0",
"glob": "^8.1.0",
"lodash": "^4.17.15",
"parse-author": "^2.0.0",
"semver": "^7.1.1",
"tmp-promise": "^3.0.2"
},
"engines": {
"node": ">= 10.0.0"
"node": ">= 14.14.0"
},
"eslintConfig": {
"extends": [
Expand All @@ -64,7 +65,12 @@
"plugin:node/recommended",
"plugin:promise/recommended",
"standard"
]
],
"rules": {
"node/no-missing-require": ["error", {
"allowModules": ["ava"]
}]
}
},
"funding": {
"url": "https://github.com/electron-userland/electron-installer-common?sponsor=1"
Expand Down
2 changes: 1 addition & 1 deletion src/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function errorMessage (message, err) {
}

module.exports = {
errorMessage: errorMessage,
errorMessage,
/**
* Prepends the error message with the given `message`.
*
Expand Down
4 changes: 3 additions & 1 deletion src/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ class ElectronInstaller {
debug('Moving package to destination')

return error.wrapError('moving package files', async () => {
const files = await glob(this.packagePattern)
const files = await glob(this.packagePattern, {
windowsPathsNoEscape: true
})
this.options.packagePaths = await Promise.all(files.map(async file => {
const renameTemplate = this.options.rename(this.options.dest, path.basename(file))
const dest = _.template(renameTemplate)(this.options)
Expand Down
2 changes: 1 addition & 1 deletion test/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ test('movePackage', t => {
const rename = (dest, src) => {
return path.join(dest, 'test_<%= name %>.pkg')
}
const installer = new ElectronInstaller({ name: 'foo', dest: destDir, rename: rename })
const installer = new ElectronInstaller({ name: 'foo', dest: destDir, rename })
installer.generateOptions()
installer.packagePattern = path.join(dir.path, '*.pkg')
await fs.ensureDir(destDir)
Expand Down
Loading

0 comments on commit 64210b8

Please sign in to comment.