update npm globally at an earlier step of each job (#124)

* update npm globally at an earlier step of each job

* execute `npm update` with sudo

* seprate windows jobs from linux,mac jobs

* upgrade npm to latest on windows

* upgrade npm to latest on windows
This commit is contained in:
Naoki Oketani
2022-07-01 07:16:46 +09:00
committed by GitHub
parent 2f9b156c84
commit 3e3735791c
2 changed files with 54 additions and 3 deletions

View File

@@ -10,7 +10,7 @@ jobs:
build: # make sure build/ci work properly
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
os: [ ubuntu-latest, macos-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
@@ -21,10 +21,22 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
build-on-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
# https://stackoverflow.com/questions/72401421/message-npm-warn-config-global-global-local-are-deprecated-use-loc
- run: |
npm install npm-windows-upgrade --location=global
npm-windows-upgrade --npm-version latest
- run: |
npm ci
npm run all
test: # make sure the action works on a clean machine without building
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
os: [ ubuntu-latest, macos-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: Dump GitHub context
@@ -40,3 +52,24 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
working_directory: __tests__/testdata/workdir/
test-on-windows:
runs-on: windows-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- uses: actions/checkout@v3
# https://stackoverflow.com/questions/72401421/message-npm-warn-config-global-global-local-are-deprecated-use-loc
- run: |
npm install npm-windows-upgrade --location=global
npm-windows-upgrade --npm-version latest
- uses: ./
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
issue_title: npm audit run by test job
- uses: ./
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
working_directory: __tests__/testdata/workdir/