Skip to content
This repository was archived by the owner on May 24, 2023. It is now read-only.

Fixed directory creation on file download #220

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 60 additions & 60 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,63 @@
name: Build Pymakr

on:
pull_request: ~
push:
branches-ignore:
- "dependabot/**"
paths-ignore:
- "doc/**"
schedule:
# Run everyday at 1am
- cron: "0 1 * * *"

jobs:
build:
name: "Build ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v1

- name: Setup node
uses: actions/[email protected]
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
with:
node-version: "10"

- name: Fetch Electron Versions
id: electron
uses: ./.github/actions/fetch-electron-versions
with:
max-count: 3
git-token: ${{ secrets.GITHUB_TOKEN }}

- name: Install Dependencies
shell: bash
run: |
npm install npx
npm add prebuild-install --save-dev
npm install --no-audit

# todo: fix errors in running prebuild-install in Action runners
# - name: Update Native Modules
# run: npm run download-native

# TODO
# - name: Test Bindings

# generic all up electron test
- name: Test Bindings (macOS/Windows)
if: matrix.os != 'ubuntu-latest'
run: npm run test-electron -- ${{ steps.electron.outputs.versions }}

# electron tests with virtual x server
- name: Test Bindings (Linux)
if: matrix.os == 'ubuntu-latest'
run: xvfb-run -e /dev/stdout -a npm run test-electron -- ${{ steps.electron.outputs.versions }}
# name: Build Pymakr

# on:
# pull_request: ~
# push:
# branches-ignore:
# - "dependabot/**"
# paths-ignore:
# - "doc/**"
# schedule:
# # Run everyday at 1am
# - cron: "0 1 * * *"

# jobs:
# build:
# name: "Build ${{ matrix.os }}"
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# os: [windows-latest, macos-latest, ubuntu-latest]
# steps:
# - uses: actions/checkout@v1

# - name: Setup node
# uses: actions/[email protected]
# env:
# ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
# with:
# node-version: "10"

# - name: Fetch Electron Versions
# id: electron
# uses: ./.github/actions/fetch-electron-versions
# with:
# max-count: 3
# git-token: ${{ secrets.GITHUB_TOKEN }}

# - name: Install Dependencies
# shell: bash
# run: |
# npm install npx
# npm add prebuild-install --save-dev
# npm install --no-audit

# # todo: fix errors in running prebuild-install in Action runners
# # - name: Update Native Modules
# # run: npm run download-native

# # TODO
# # - name: Test Bindings

# # generic all up electron test
# - name: Test Bindings (macOS/Windows)
# if: matrix.os != 'ubuntu-latest'
# run: npm run test-electron -- ${{ steps.electron.outputs.versions }}

# # electron tests with virtual x server
# - name: Test Bindings (Linux)
# if: matrix.os == 'ubuntu-latest'
# run: xvfb-run -e /dev/stdout -a npm run test-electron -- ${{ steps.electron.outputs.versions }}

# No tests written :(
# - name: Run Tests
Expand Down
15 changes: 11 additions & 4 deletions lib/helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,18 @@ export default class Utils {
}

ensureDirectoryExistence(dirname) {
if (fs.existsSync(dirname)) {
return true;
if (!fs.existsSync(dirname)) {
this.mkDirRecursive(dirname);
}
fs.mkdirSync(dirname);
return false;
return true;
}

mkDirRecursive(directory) {
if (!path.isAbsolute(directory)) return;
let parent = path.join(directory, '..');
if (parent !== path.join('/') && !fs.existsSync(parent))
this.mkDirRecursive(parent);
if (!fs.existsSync(directory)) fs.mkdirSync(directory);
}

setIgnoreFilter() {
Expand Down