Add and configure ESLint and update configuration for Prettier (#617)
* Add ESLint, update Prettier * Update docs * Update tests * Update licenses * Fix review points
This commit is contained in:
parent
7b9ef6fc5a
commit
ec365b4eba
|
@ -0,0 +1,6 @@
|
|||
# Ignore list
|
||||
/*
|
||||
|
||||
# Do not ignore these folders:
|
||||
!__tests__/
|
||||
!src/
|
|
@ -0,0 +1,49 @@
|
|||
module.exports = {
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:eslint-plugin-jest/recommended',
|
||||
'eslint-config-prettier'
|
||||
],
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: ['@typescript-eslint', 'eslint-plugin-jest'],
|
||||
rules: {
|
||||
'@typescript-eslint/no-require-imports': 'error',
|
||||
'@typescript-eslint/no-non-null-assertion': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
'@typescript-eslint/no-empty-function': 'off',
|
||||
'@typescript-eslint/ban-ts-comment': [
|
||||
'error',
|
||||
{
|
||||
'ts-ignore': 'allow-with-description'
|
||||
}
|
||||
],
|
||||
'no-console': 'error',
|
||||
'yoda': 'error',
|
||||
'prefer-const': [
|
||||
'error',
|
||||
{
|
||||
destructuring: 'all'
|
||||
}
|
||||
],
|
||||
'no-control-regex': 'off',
|
||||
'no-constant-condition': ['error', {checkLoops: false}]
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ['**/*{test,spec}.ts'],
|
||||
rules: {
|
||||
'@typescript-eslint/no-unused-vars': 'off',
|
||||
'jest/no-standalone-expect': 'off',
|
||||
'jest/no-conditional-expect': 'off',
|
||||
'no-console': 'off',
|
||||
|
||||
}
|
||||
}
|
||||
],
|
||||
env: {
|
||||
node: true,
|
||||
es6: true,
|
||||
'jest/globals': true
|
||||
}
|
||||
};
|
|
@ -2,7 +2,7 @@ name: CodeQL analysis
|
|||
|
||||
on:
|
||||
push:
|
||||
branches: [ 'main' ]
|
||||
branches: ['main']
|
||||
pull_request:
|
||||
schedule:
|
||||
- cron: '0 3 * * 0'
|
||||
|
|
|
@ -18,71 +18,71 @@ jobs:
|
|||
matrix:
|
||||
operating-system: [ubuntu-20.04, windows-latest]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Run with setup-python 2.7
|
||||
uses: ./
|
||||
with:
|
||||
python-version: 2.7
|
||||
- name: Verify 2.7
|
||||
run: python __tests__/verify-python.py 2.7
|
||||
- name: Run with setup-python 2.7
|
||||
uses: ./
|
||||
with:
|
||||
python-version: 2.7
|
||||
- name: Verify 2.7
|
||||
run: python __tests__/verify-python.py 2.7
|
||||
|
||||
- name: Run with setup-python 3.5
|
||||
uses: ./
|
||||
with:
|
||||
python-version: 3.5
|
||||
- name: Verify 3.5
|
||||
run: python __tests__/verify-python.py 3.5
|
||||
- name: Run with setup-python 3.5
|
||||
uses: ./
|
||||
with:
|
||||
python-version: 3.5
|
||||
- name: Verify 3.5
|
||||
run: python __tests__/verify-python.py 3.5
|
||||
|
||||
- name: Run with setup-python 3.6
|
||||
uses: ./
|
||||
with:
|
||||
python-version: 3.6
|
||||
- name: Verify 3.6
|
||||
run: python __tests__/verify-python.py 3.6
|
||||
- name: Run with setup-python 3.6
|
||||
uses: ./
|
||||
with:
|
||||
python-version: 3.6
|
||||
- name: Verify 3.6
|
||||
run: python __tests__/verify-python.py 3.6
|
||||
|
||||
- name: Run with setup-python 3.7
|
||||
uses: ./
|
||||
with:
|
||||
python-version: 3.7
|
||||
- name: Verify 3.7
|
||||
run: python __tests__/verify-python.py 3.7
|
||||
- name: Run with setup-python 3.7
|
||||
uses: ./
|
||||
with:
|
||||
python-version: 3.7
|
||||
- name: Verify 3.7
|
||||
run: python __tests__/verify-python.py 3.7
|
||||
|
||||
- name: Run with setup-python 3.8
|
||||
uses: ./
|
||||
with:
|
||||
python-version: 3.8
|
||||
- name: Verify 3.8
|
||||
run: python __tests__/verify-python.py 3.8
|
||||
- name: Run with setup-python 3.8
|
||||
uses: ./
|
||||
with:
|
||||
python-version: 3.8
|
||||
- name: Verify 3.8
|
||||
run: python __tests__/verify-python.py 3.8
|
||||
|
||||
- name: Run with setup-python 3.7.5
|
||||
uses: ./
|
||||
with:
|
||||
python-version: 3.7.5
|
||||
- name: Verify 3.7.5
|
||||
run: python __tests__/verify-python.py 3.7.5
|
||||
- name: Run with setup-python 3.7.5
|
||||
uses: ./
|
||||
with:
|
||||
python-version: 3.7.5
|
||||
- name: Verify 3.7.5
|
||||
run: python __tests__/verify-python.py 3.7.5
|
||||
|
||||
- name: Run with setup-python 3.6.7
|
||||
uses: ./
|
||||
with:
|
||||
python-version: 3.6.7
|
||||
- name: Verify 3.6.7
|
||||
run: python __tests__/verify-python.py 3.6.7
|
||||
- name: Run with setup-python 3.6.7
|
||||
uses: ./
|
||||
with:
|
||||
python-version: 3.6.7
|
||||
- name: Verify 3.6.7
|
||||
run: python __tests__/verify-python.py 3.6.7
|
||||
|
||||
- name: Run with setup-python 3.8.1
|
||||
uses: ./
|
||||
with:
|
||||
python-version: 3.8.1
|
||||
- name: Verify 3.8.1
|
||||
run: python __tests__/verify-python.py 3.8.1
|
||||
- name: Run with setup-python 3.8.1
|
||||
uses: ./
|
||||
with:
|
||||
python-version: 3.8.1
|
||||
- name: Verify 3.8.1
|
||||
run: python __tests__/verify-python.py 3.8.1
|
||||
|
||||
- name: Run with setup-python 3.10
|
||||
id: cp310
|
||||
uses: ./
|
||||
with:
|
||||
python-version: "3.10"
|
||||
- name: Verify 3.10
|
||||
run: python __tests__/verify-python.py 3.10
|
||||
- name: Run python-path sample 3.10
|
||||
run: pipx run --python '${{ steps.cp310.outputs.python-path }}' nox --version
|
||||
- name: Run with setup-python 3.10
|
||||
id: cp310
|
||||
uses: ./
|
||||
with:
|
||||
python-version: '3.10'
|
||||
- name: Verify 3.10
|
||||
run: python __tests__/verify-python.py 3.10
|
||||
- name: Run python-path sample 3.10
|
||||
run: pipx run --python '${{ steps.cp310.outputs.python-path }}' nox --version
|
||||
|
|
|
@ -21,8 +21,8 @@ jobs:
|
|||
name: releaseNewActionVersion
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Update the ${{ env.TAG_NAME }} tag
|
||||
uses: actions/publish-action@v0.2.2
|
||||
with:
|
||||
source-tag: ${{ env.TAG_NAME }}
|
||||
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
|
||||
- name: Update the ${{ env.TAG_NAME }} tag
|
||||
uses: actions/publish-action@v0.2.2
|
||||
with:
|
||||
source-tag: ${{ env.TAG_NAME }}
|
||||
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
|
||||
|
|
|
@ -21,17 +21,17 @@ jobs:
|
|||
matrix:
|
||||
os: [macos-latest, windows-latest, ubuntu-18.04, ubuntu-latest]
|
||||
pypy:
|
||||
- 'pypy-2.7'
|
||||
- 'pypy-3.7'
|
||||
- 'pypy3.9'
|
||||
- 'pypy-2.7-v7.3.4'
|
||||
- 'pypy-3.7-v7.3.5'
|
||||
- 'pypy-3.7-v7.3.4'
|
||||
- 'pypy-3.7-v7.3.x'
|
||||
- 'pypy-3.7-v7.x'
|
||||
- 'pypy-2.7-v7.3.4rc1'
|
||||
- 'pypy-3.7-nightly'
|
||||
- 'pypy3.8-v7.3.7'
|
||||
- 'pypy-2.7'
|
||||
- 'pypy-3.7'
|
||||
- 'pypy3.9'
|
||||
- 'pypy-2.7-v7.3.4'
|
||||
- 'pypy-3.7-v7.3.5'
|
||||
- 'pypy-3.7-v7.3.4'
|
||||
- 'pypy-3.7-v7.3.x'
|
||||
- 'pypy-3.7-v7.x'
|
||||
- 'pypy-2.7-v7.3.4rc1'
|
||||
- 'pypy-3.7-nightly'
|
||||
- 'pypy3.8-v7.3.7'
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
@ -138,8 +138,8 @@ jobs:
|
|||
uses: ./
|
||||
with:
|
||||
python-version: |
|
||||
pypy-3.7-v7.3.x
|
||||
pypy3.8
|
||||
pypy-3.7-v7.3.x
|
||||
pypy3.8
|
||||
check-latest: true
|
||||
- name: PyPy and Python version
|
||||
run: python --version
|
||||
|
|
|
@ -23,31 +23,31 @@ jobs:
|
|||
os: [macos-latest, windows-latest, ubuntu-18.04, ubuntu-20.04]
|
||||
python: [3.5.4, 3.6.7, 3.7.5, 3.8.1]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: setup-python ${{ matrix.python }}
|
||||
id: setup-python
|
||||
uses: ./
|
||||
with:
|
||||
python-version: ${{ matrix.python }}
|
||||
- name: setup-python ${{ matrix.python }}
|
||||
id: setup-python
|
||||
uses: ./
|
||||
with:
|
||||
python-version: ${{ matrix.python }}
|
||||
|
||||
- name: Check python-path
|
||||
run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'
|
||||
shell: bash
|
||||
- name: Check python-path
|
||||
run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'
|
||||
shell: bash
|
||||
|
||||
- name: Validate version
|
||||
run: |
|
||||
$pythonVersion = (python --version)
|
||||
if ("Python ${{ matrix.python }}" -ne "$pythonVersion"){
|
||||
Write-Host "The current version is $pythonVersion; expected version is ${{ matrix.python }}"
|
||||
exit 1
|
||||
}
|
||||
$pythonVersion
|
||||
shell: pwsh
|
||||
- name: Validate version
|
||||
run: |
|
||||
$pythonVersion = (python --version)
|
||||
if ("Python ${{ matrix.python }}" -ne "$pythonVersion"){
|
||||
Write-Host "The current version is $pythonVersion; expected version is ${{ matrix.python }}"
|
||||
exit 1
|
||||
}
|
||||
$pythonVersion
|
||||
shell: pwsh
|
||||
|
||||
- name: Run simple code
|
||||
run: python -c 'import math; print(math.factorial(5))'
|
||||
- name: Run simple code
|
||||
run: python -c 'import math; print(math.factorial(5))'
|
||||
|
||||
setup-versions-from-file:
|
||||
name: Setup ${{ matrix.python }} ${{ matrix.os }} version file
|
||||
|
@ -58,34 +58,34 @@ jobs:
|
|||
os: [macos-latest, windows-latest, ubuntu-18.04, ubuntu-20.04]
|
||||
python: [3.5.4, 3.6.7, 3.7.5, 3.8.1]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: build-version-file ${{ matrix.python }}
|
||||
run: echo ${{ matrix.python }} > .python-version
|
||||
- name: build-version-file ${{ matrix.python }}
|
||||
run: echo ${{ matrix.python }} > .python-version
|
||||
|
||||
- name: setup-python ${{ matrix.python }}
|
||||
id: setup-python
|
||||
uses: ./
|
||||
with:
|
||||
python-version-file: '.python-version'
|
||||
- name: setup-python ${{ matrix.python }}
|
||||
id: setup-python
|
||||
uses: ./
|
||||
with:
|
||||
python-version-file: '.python-version'
|
||||
|
||||
- name: Check python-path
|
||||
run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'
|
||||
shell: bash
|
||||
- name: Check python-path
|
||||
run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'
|
||||
shell: bash
|
||||
|
||||
- name: Validate version
|
||||
run: |
|
||||
$pythonVersion = (python --version)
|
||||
if ("Python ${{ matrix.python }}" -ne "$pythonVersion"){
|
||||
Write-Host "The current version is $pythonVersion; expected version is ${{ matrix.python }}"
|
||||
exit 1
|
||||
}
|
||||
$pythonVersion
|
||||
shell: pwsh
|
||||
- name: Validate version
|
||||
run: |
|
||||
$pythonVersion = (python --version)
|
||||
if ("Python ${{ matrix.python }}" -ne "$pythonVersion"){
|
||||
Write-Host "The current version is $pythonVersion; expected version is ${{ matrix.python }}"
|
||||
exit 1
|
||||
}
|
||||
$pythonVersion
|
||||
shell: pwsh
|
||||
|
||||
- name: Run simple code
|
||||
run: python -c 'import math; print(math.factorial(5))'
|
||||
- name: Run simple code
|
||||
run: python -c 'import math; print(math.factorial(5))'
|
||||
|
||||
setup-pre-release-version-from-manifest:
|
||||
name: Setup 3.9.0-beta.4 ${{ matrix.os }}
|
||||
|
@ -95,31 +95,31 @@ jobs:
|
|||
matrix:
|
||||
os: [macos-latest, windows-latest, ubuntu-18.04, ubuntu-20.04]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: setup-python 3.9.0-beta.4
|
||||
id: setup-python
|
||||
uses: ./
|
||||
with:
|
||||
python-version: '3.9.0-beta.4'
|
||||
- name: setup-python 3.9.0-beta.4
|
||||
id: setup-python
|
||||
uses: ./
|
||||
with:
|
||||
python-version: '3.9.0-beta.4'
|
||||
|
||||
- name: Check python-path
|
||||
run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'
|
||||
shell: bash
|
||||
- name: Check python-path
|
||||
run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'
|
||||
shell: bash
|
||||
|
||||
- name: Validate version
|
||||
run: |
|
||||
$pythonVersion = (python --version)
|
||||
if ("Python 3.9.0b4" -ne "$pythonVersion"){
|
||||
Write-Host "The current version is $pythonVersion; expected version is 3.9.0b4"
|
||||
exit 1
|
||||
}
|
||||
$pythonVersion
|
||||
shell: pwsh
|
||||
- name: Validate version
|
||||
run: |
|
||||
$pythonVersion = (python --version)
|
||||
if ("Python 3.9.0b4" -ne "$pythonVersion"){
|
||||
Write-Host "The current version is $pythonVersion; expected version is 3.9.0b4"
|
||||
exit 1
|
||||
}
|
||||
$pythonVersion
|
||||
shell: pwsh
|
||||
|
||||
- name: Run simple code
|
||||
run: python -c 'import math; print(math.factorial(5))'
|
||||
- name: Run simple code
|
||||
run: python -c 'import math; print(math.factorial(5))'
|
||||
|
||||
setup-dev-version:
|
||||
name: Setup 3.9-dev ${{ matrix.os }}
|
||||
|
@ -129,25 +129,25 @@ jobs:
|
|||
matrix:
|
||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: setup-python 3.9-dev
|
||||
id: setup-python
|
||||
uses: ./
|
||||
with:
|
||||
python-version: '3.9-dev'
|
||||
- name: setup-python 3.9-dev
|
||||
id: setup-python
|
||||
uses: ./
|
||||
with:
|
||||
python-version: '3.9-dev'
|
||||
|
||||
- name: Check python-path
|
||||
run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'
|
||||
shell: bash
|
||||
- name: Check python-path
|
||||
run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'
|
||||
shell: bash
|
||||
|
||||
- name: Validate version
|
||||
run: ${{ startsWith(steps.setup-python.outputs.python-version, '3.9.') }}
|
||||
shell: bash
|
||||
- name: Validate version
|
||||
run: ${{ startsWith(steps.setup-python.outputs.python-version, '3.9.') }}
|
||||
shell: bash
|
||||
|
||||
- name: Run simple code
|
||||
run: python -c 'import math; print(math.factorial(5))'
|
||||
- name: Run simple code
|
||||
run: python -c 'import math; print(math.factorial(5))'
|
||||
|
||||
setup-prerelease-version:
|
||||
name: Setup 3.12 ${{ matrix.os }}
|
||||
|
@ -157,26 +157,26 @@ jobs:
|
|||
matrix:
|
||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: setup-python 3.12
|
||||
id: setup-python
|
||||
uses: ./
|
||||
with:
|
||||
python-version: '3.12'
|
||||
allow-prereleases: true
|
||||
- name: setup-python 3.12
|
||||
id: setup-python
|
||||
uses: ./
|
||||
with:
|
||||
python-version: '3.12'
|
||||
allow-prereleases: true
|
||||
|
||||
- name: Check python-path
|
||||
run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'
|
||||
shell: bash
|
||||
- name: Check python-path
|
||||
run: ./__tests__/check-python-path.sh '${{ steps.setup-python.outputs.python-path }}'
|
||||
shell: bash
|
||||
|
||||
- name: Validate version
|
||||
run: ${{ startsWith(steps.setup-python.outputs.python-version, '3.12.') }}
|
||||
shell: bash
|
||||
- name: Validate version
|
||||
run: ${{ startsWith(steps.setup-python.outputs.python-version, '3.12.') }}
|
||||
shell: bash
|
||||
|
||||
- name: Run simple code
|
||||
run: python -c 'import math; print(math.factorial(5))'
|
||||
- name: Run simple code
|
||||
run: python -c 'import math; print(math.factorial(5))'
|
||||
|
||||
setup-versions-noenv:
|
||||
name: Setup ${{ matrix.python }} ${{ matrix.os }} (noenv)
|
||||
|
@ -185,23 +185,23 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-latest, windows-latest, ubuntu-18.04, ubuntu-20.04]
|
||||
python: ["3.7", "3.8", "3.9", "3.10"]
|
||||
python: ['3.7', '3.8', '3.9', '3.10']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: setup-python ${{ matrix.python }}
|
||||
id: setup-python
|
||||
uses: ./
|
||||
with:
|
||||
python-version: ${{ matrix.python }}
|
||||
update-environment: false
|
||||
- name: setup-python ${{ matrix.python }}
|
||||
id: setup-python
|
||||
uses: ./
|
||||
with:
|
||||
python-version: ${{ matrix.python }}
|
||||
update-environment: false
|
||||
|
||||
- name: Python version
|
||||
run: ${{ steps.setup-python.outputs.python-path }} --version
|
||||
- name: Python version
|
||||
run: ${{ steps.setup-python.outputs.python-path }} --version
|
||||
|
||||
- name: Run simple code
|
||||
run: ${{ steps.setup-python.outputs.python-path }} -c 'import math; print(math.factorial(5))'
|
||||
- name: Run simple code
|
||||
run: ${{ steps.setup-python.outputs.python-path }} -c 'import math; print(math.factorial(5))'
|
||||
|
||||
check-latest:
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
@ -209,7 +209,7 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
python-version: ["3.8", "3.9", "3.10"]
|
||||
python-version: ['3.8', '3.9', '3.10']
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup Python and check latest
|
||||
|
@ -239,10 +239,10 @@ jobs:
|
|||
uses: ./
|
||||
with:
|
||||
python-version: |
|
||||
3.7
|
||||
3.8
|
||||
3.9
|
||||
3.10
|
||||
3.7
|
||||
3.8
|
||||
3.9
|
||||
3.10
|
||||
check-latest: true
|
||||
- name: Validate version
|
||||
run: |
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
name: lru-cache
|
||||
version: 6.0.0
|
||||
type: npm
|
||||
summary: A cache object that deletes the least-recently-used items.
|
||||
homepage:
|
||||
license: isc
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
notices: []
|
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
name: semver
|
||||
version: 7.3.8
|
||||
type: npm
|
||||
summary: The semantic version parser used by npm.
|
||||
homepage:
|
||||
license: isc
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
notices: []
|
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
name: yallist
|
||||
version: 4.0.0
|
||||
type: npm
|
||||
summary: Yet Another Linked List
|
||||
homepage:
|
||||
license: isc
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
notices: []
|
|
@ -0,0 +1,7 @@
|
|||
# Ignore list
|
||||
/*
|
||||
|
||||
# Do not ignore these folders:
|
||||
!__tests__/
|
||||
!.github/
|
||||
!src/
|
|
@ -0,0 +1,10 @@
|
|||
module.exports = {
|
||||
printWidth: 80,
|
||||
tabWidth: 2,
|
||||
useTabs: false,
|
||||
semi: true,
|
||||
singleQuote: true,
|
||||
trailingComma: 'none',
|
||||
bracketSpacing: false,
|
||||
arrowParens: 'avoid'
|
||||
};
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"printWidth": 80,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none",
|
||||
"bracketSpacing": false,
|
||||
"arrowParens": "avoid",
|
||||
"parser": "typescript"
|
||||
}
|
|
@ -5,7 +5,6 @@ import * as exec from '@actions/exec';
|
|||
import * as io from '@actions/io';
|
||||
import {getCacheDistributor} from '../src/cache-distributions/cache-factory';
|
||||
import {State} from '../src/cache-distributions/cache-distributor';
|
||||
import * as constants from '../src/cache-distributions/constants';
|
||||
|
||||
describe('restore-cache', () => {
|
||||
const pipFileLockHash =
|
||||
|
@ -95,7 +94,7 @@ virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/patrick/Library/Caches/py
|
|||
async packageManager => {
|
||||
expect(() =>
|
||||
getCacheDistributor(packageManager, '3.8.12', undefined)
|
||||
).toThrowError(`Caching for '${packageManager}' is not supported`);
|
||||
).toThrow(`Caching for '${packageManager}' is not supported`);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
@ -210,7 +209,7 @@ virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/patrick/Library/Caches/py
|
|||
dependencyFile
|
||||
);
|
||||
|
||||
await expect(cacheDistributor.restoreCache()).rejects.toThrowError(
|
||||
await expect(cacheDistributor.restoreCache()).rejects.toThrow(
|
||||
`No file in ${process.cwd()} matched to [${cacheDependencyPath
|
||||
.split('\n')
|
||||
.join(',')}], make sure you have checked out the target repository`
|
||||
|
@ -229,7 +228,7 @@ virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/patrick/Library/Caches/py
|
|||
pythonVersion,
|
||||
dependencyFile
|
||||
);
|
||||
await expect(cacheDistributor.restoreCache()).resolves;
|
||||
await expect(cacheDistributor.restoreCache()).resolves.not.toThrow();
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -239,16 +238,15 @@ virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/patrick/Library/Caches/py
|
|||
])(
|
||||
'Should throw an error as there is no default file `pyproject.toml` to use when requirements.txt is not specified',
|
||||
async (packageManager, pythonVersion, dependencyFile) => {
|
||||
jest.mock('../src/cache-distributions/constants', () => ({
|
||||
CACHE_DEPENDENCY_BACKUP_PATH: '**/pyprojecttest.toml'
|
||||
}));
|
||||
|
||||
const cacheDistributor = getCacheDistributor(
|
||||
packageManager,
|
||||
pythonVersion,
|
||||
dependencyFile
|
||||
);
|
||||
await expect(cacheDistributor.restoreCache()).resolves;
|
||||
) as any; // Widening PipCache | PipenvCache | PoetryCache type to any allow us to change private property on the cacheDistributor to test value: "**/pyprojecttest.toml"
|
||||
|
||||
cacheDistributor.cacheDependencyBackupPath = '**/pyprojecttest.toml';
|
||||
|
||||
await expect(cacheDistributor.restoreCache()).rejects.toThrow();
|
||||
}
|
||||
);
|
||||
});
|
||||
|
|
|
@ -116,22 +116,6 @@ describe('run', () => {
|
|||
);
|
||||
expect(setFailedSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should not save cache for pipenv', async () => {
|
||||
inputs['cache'] = 'pipenv';
|
||||
|
||||
await run();
|
||||
|
||||
expect(getInputSpy).toHaveBeenCalled();
|
||||
expect(debugSpy).toHaveBeenCalledWith(
|
||||
`paths for caching are ${__dirname}`
|
||||
);
|
||||
expect(getStateSpy).toHaveBeenCalledTimes(3);
|
||||
expect(infoSpy).toHaveBeenCalledWith(
|
||||
`Cache hit occurred on the primary key ${requirementsHash}, not saving cache.`
|
||||
);
|
||||
expect(setFailedSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('action saves the cache', () => {
|
||||
|
|
|
@ -17,7 +17,7 @@ import {
|
|||
getPyPyVersionFromPath
|
||||
} from '../src/utils';
|
||||
|
||||
const manifestData = require('./data/pypy.json');
|
||||
import manifestData from './data/pypy.json';
|
||||
|
||||
let architecture: string;
|
||||
|
||||
|
@ -51,7 +51,7 @@ describe('parsePyPyVersion', () => {
|
|||
it.each(['', 'pypy-', 'pypy', 'p', 'notpypy-'])(
|
||||
'throw on invalid input "%s"',
|
||||
input => {
|
||||
expect(() => finder.parsePyPyVersion(input)).toThrowError(
|
||||
expect(() => finder.parsePyPyVersion(input)).toThrow(
|
||||
"Invalid 'version' property for PyPy. PyPy version should be specified as 'pypy<python-version>' or 'pypy-<python-version>'. See README for examples and documentation."
|
||||
);
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ describe('parsePyPyVersion', () => {
|
|||
it.each(['pypy-2', 'pypy-3', 'pypy2', 'pypy3', 'pypy3.x', 'pypy3.8.10'])(
|
||||
'throw on invalid input "%s"',
|
||||
input => {
|
||||
expect(() => finder.parsePyPyVersion(input)).toThrowError(
|
||||
expect(() => finder.parsePyPyVersion(input)).toThrow(
|
||||
"Invalid format of Python version for PyPy. Python version should be specified in format 'x.y'. See README for examples and documentation."
|
||||
);
|
||||
}
|
||||
|
@ -369,7 +369,7 @@ describe('findPyPyVersion', () => {
|
|||
false,
|
||||
false
|
||||
)
|
||||
).rejects.toThrowError(
|
||||
).rejects.toThrow(
|
||||
`PyPy version 3.7 (v7.5.x) with arch ${architecture} not found`
|
||||
);
|
||||
});
|
||||
|
@ -453,7 +453,7 @@ describe('findPyPyVersion', () => {
|
|||
spyChmodSync.mockImplementation(() => undefined);
|
||||
await expect(
|
||||
finder.findPyPyVersion('pypy3.8', architecture, false, false, false)
|
||||
).rejects.toThrowError();
|
||||
).rejects.toThrow();
|
||||
await expect(
|
||||
finder.findPyPyVersion('pypy3.8', architecture, false, false, true)
|
||||
).resolves.toEqual({
|
||||
|
|
|
@ -24,7 +24,7 @@ import * as core from '@actions/core';
|
|||
import * as finder from '../src/find-python';
|
||||
import * as installer from '../src/install-python';
|
||||
|
||||
const manifestData = require('./data/versions-manifest.json');
|
||||
import manifestData from './data/versions-manifest.json';
|
||||
|
||||
describe('Finder tests', () => {
|
||||
let writeSpy: jest.SpyInstance;
|
||||
|
@ -192,7 +192,7 @@ describe('Finder tests', () => {
|
|||
expect(infoSpy).toHaveBeenCalledWith(
|
||||
'Version 1.2.3 was not found in the local cache'
|
||||
);
|
||||
expect(infoSpy).toBeCalledWith(
|
||||
expect(infoSpy).toHaveBeenCalledWith(
|
||||
'Version 1.2.3 is available for downloading'
|
||||
);
|
||||
expect(installSpy).toHaveBeenCalled();
|
||||
|
@ -252,7 +252,7 @@ describe('Finder tests', () => {
|
|||
// This will throw if it doesn't find it in the cache and in the manifest (because no such version exists)
|
||||
await expect(
|
||||
finder.useCpythonVersion('1.1', 'x64', false, false, false)
|
||||
).rejects.toThrowError();
|
||||
).rejects.toThrow();
|
||||
await expect(
|
||||
finder.useCpythonVersion('1.1', 'x64', false, false, true)
|
||||
).resolves.toEqual({
|
||||
|
@ -262,7 +262,7 @@ describe('Finder tests', () => {
|
|||
// Check 1.1.0 version specifier does not fallback to '1.1.0-beta.2'
|
||||
await expect(
|
||||
finder.useCpythonVersion('1.1.0', 'x64', false, false, true)
|
||||
).rejects.toThrowError();
|
||||
).rejects.toThrow();
|
||||
});
|
||||
|
||||
it('Errors if Python is not installed', async () => {
|
||||
|
|
|
@ -14,7 +14,7 @@ import {
|
|||
IS_WINDOWS
|
||||
} from '../src/utils';
|
||||
|
||||
const manifestData = require('./data/pypy.json');
|
||||
import manifestData from './data/pypy.json';
|
||||
|
||||
let architecture: string;
|
||||
if (IS_WINDOWS) {
|
||||
|
@ -294,7 +294,7 @@ describe('installPyPy', () => {
|
|||
it('throw if release is not found', async () => {
|
||||
await expect(
|
||||
installer.installPyPy('7.3.3', '3.6.17', architecture, false, undefined)
|
||||
).rejects.toThrowError(
|
||||
).rejects.toThrow(
|
||||
`PyPy version 3.6.17 (7.3.3) with arch ${architecture} not found`
|
||||
);
|
||||
|
||||
|
@ -338,7 +338,7 @@ describe('installPyPy', () => {
|
|||
|
||||
await expect(
|
||||
installer.installPyPy('7.4.x', '3.6.12', architecture, false, undefined)
|
||||
).rejects.toThrowError();
|
||||
).rejects.toThrow();
|
||||
await expect(
|
||||
installer.installPyPy('7.4.x', '3.6.12', architecture, true, undefined)
|
||||
).resolves.toEqual({
|
||||
|
|
|
@ -59757,8 +59757,7 @@ exports["default"] = CacheDistributor;
|
|||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.CACHE_DEPENDENCY_BACKUP_PATH = void 0;
|
||||
const CACHE_DEPENDENCY_BACKUP_PATH = '**/pyproject.toml';
|
||||
exports.CACHE_DEPENDENCY_BACKUP_PATH = CACHE_DEPENDENCY_BACKUP_PATH;
|
||||
exports.CACHE_DEPENDENCY_BACKUP_PATH = '**/pyproject.toml';
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -60,6 +60,7 @@ Pull requests are the easiest way to contribute changes to git repos at GitHub.
|
|||
|
||||
- To implement new features or fix bugs, you need to make changes to the `.ts` files, which are located in the `src` folder
|
||||
- To comply with the code style, **you need to run the `format` script**
|
||||
- To lint the code, **you need to run the `lint:fix` script**
|
||||
- To transpile source code to `javascript` we use [NCC](https://github.com/vercel/ncc). **It is very important to run the `build` script after making changes**, otherwise your changes will not get into the final `javascript` build
|
||||
|
||||
**Learn more about how to implement tests:**
|
||||
|
|
File diff suppressed because it is too large
Load Diff
14
package.json
14
package.json
|
@ -6,9 +6,10 @@
|
|||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"build": "ncc build -o dist/setup src/setup-python.ts && ncc build -o dist/cache-save src/cache-save.ts",
|
||||
"format": "prettier --write \"{,!(node_modules)/**/}*.ts\"",
|
||||
"format-check": "prettier --check \"{,!(node_modules)/**/}*.ts\"",
|
||||
"lint": "echo \"Fake command that does nothing. It is used in reusable workflows\"",
|
||||
"format": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.js --write **/*.{ts,yml,yaml}",
|
||||
"format-check": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.js --check **/*.{ts,yml,yaml}",
|
||||
"lint": "eslint --config ./.eslintrc.js **/*.ts",
|
||||
"lint:fix": "eslint --config ./.eslintrc.js **/*.ts --fix",
|
||||
"release": "ncc build -o dist/setup src/setup-python.ts && ncc build -o dist/cache-save src/cache-save.ts && git add -f dist/",
|
||||
"test": "jest --coverage"
|
||||
},
|
||||
|
@ -36,11 +37,16 @@
|
|||
"@types/jest": "^27.0.2",
|
||||
"@types/node": "^16.11.25",
|
||||
"@types/semver": "^7.1.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.54.0",
|
||||
"@typescript-eslint/parser": "^5.54.0",
|
||||
"@vercel/ncc": "^0.33.4",
|
||||
"eslint": "^8.35.0",
|
||||
"eslint-config-prettier": "^8.6.0",
|
||||
"eslint-plugin-jest": "^27.2.1",
|
||||
"husky": "^7.0.2",
|
||||
"jest": "^27.2.5",
|
||||
"jest-circus": "^27.2.5",
|
||||
"prettier": "^2.0.2",
|
||||
"prettier": "^2.8.4",
|
||||
"ts-jest": "^27.0.5",
|
||||
"typescript": "^4.2.3"
|
||||
},
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
const CACHE_DEPENDENCY_BACKUP_PATH: string = '**/pyproject.toml';
|
||||
export {CACHE_DEPENDENCY_BACKUP_PATH};
|
||||
export const CACHE_DEPENDENCY_BACKUP_PATH = '**/pyproject.toml';
|
||||
|
|
|
@ -15,7 +15,7 @@ class PipCache extends CacheDistributor {
|
|||
|
||||
constructor(
|
||||
private pythonVersion: string,
|
||||
cacheDependencyPath: string = '**/requirements.txt'
|
||||
cacheDependencyPath = '**/requirements.txt'
|
||||
) {
|
||||
super('pip', cacheDependencyPath);
|
||||
}
|
||||
|
|
|
@ -65,17 +65,14 @@ export async function findPyPyVersion(
|
|||
));
|
||||
|
||||
if (!installDir) {
|
||||
({
|
||||
installDir,
|
||||
resolvedPythonVersion,
|
||||
resolvedPyPyVersion
|
||||
} = await pypyInstall.installPyPy(
|
||||
pypyVersionSpec.pypyVersion,
|
||||
pypyVersionSpec.pythonVersion,
|
||||
architecture,
|
||||
allowPreReleases,
|
||||
releases
|
||||
));
|
||||
({installDir, resolvedPythonVersion, resolvedPyPyVersion} =
|
||||
await pypyInstall.installPyPy(
|
||||
pypyVersionSpec.pypyVersion,
|
||||
pypyVersionSpec.pythonVersion,
|
||||
architecture,
|
||||
allowPreReleases,
|
||||
releases
|
||||
));
|
||||
}
|
||||
|
||||
const pipDir = IS_WINDOWS ? 'Scripts' : 'bin';
|
||||
|
@ -145,7 +142,7 @@ export function parsePyPyVersion(versionSpec: string): IPyPyVersionSpec {
|
|||
const versions = versionSpec.split('-').filter(item => !!item);
|
||||
|
||||
if (/^(pypy)(.+)/.test(versions[0])) {
|
||||
let pythonVersion = versions[0].replace('pypy', '');
|
||||
const pythonVersion = versions[0].replace('pypy', '');
|
||||
versions.splice(0, 1, 'pypy', pythonVersion);
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ export async function installPyPy(
|
|||
}
|
||||
|
||||
const {foundAsset, resolvedPythonVersion, resolvedPyPyVersion} = releaseData;
|
||||
let downloadUrl = `${foundAsset.download_url}`;
|
||||
const downloadUrl = `${foundAsset.download_url}`;
|
||||
|
||||
core.info(`Downloading PyPy from "${downloadUrl}" ...`);
|
||||
|
||||
|
@ -143,7 +143,7 @@ async function createPyPySymlink(
|
|||
const pythonMinor = semver.minor(version);
|
||||
const pypyBinaryPostfix = pythonBinaryPostfix === 2 ? '' : '3';
|
||||
const pypyMajorMinorBinaryPostfix = `${pythonBinaryPostfix}.${pythonMinor}`;
|
||||
let binaryExtension = IS_WINDOWS ? '.exe' : '';
|
||||
const binaryExtension = IS_WINDOWS ? '.exe' : '';
|
||||
|
||||
core.info('Creating symlinks...');
|
||||
createSymlinkInFolder(
|
||||
|
|
|
@ -23,7 +23,7 @@ async function cacheDependencies(cache: string, pythonVersion: string) {
|
|||
}
|
||||
|
||||
function resolveVersionInput() {
|
||||
let versions = core.getMultilineInput('python-version');
|
||||
const versions = core.getMultilineInput('python-version');
|
||||
let versionFile = core.getInput('python-version-file');
|
||||
|
||||
if (versions.length && versionFile) {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint no-unsafe-finally: "off" */
|
||||
import * as cache from '@actions/cache';
|
||||
import * as core from '@actions/core';
|
||||
import fs from 'fs';
|
||||
|
@ -71,7 +72,7 @@ export function getPyPyVersionFromPath(installDir: string) {
|
|||
*/
|
||||
export function readExactPyPyVersionFile(installDir: string) {
|
||||
let pypyVersion = '';
|
||||
let fileVersion = path.join(installDir, PYPY_VERSION_FILE);
|
||||
const fileVersion = path.join(installDir, PYPY_VERSION_FILE);
|
||||
if (fs.existsSync(fileVersion)) {
|
||||
pypyVersion = fs.readFileSync(fileVersion).toString().trim();
|
||||
}
|
||||
|
|
|
@ -45,7 +45,8 @@
|
|||
// "typeRoots": [], /* List of folders to include type definitions from. */
|
||||
// "types": [], /* Type declaration files to be included in compilation. */
|
||||
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
||||
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
||||
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
||||
"resolveJsonModule": true, /* Allows importing modules with a '.json' extension, which is a common practice in node projects. */
|
||||
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
extends: default
|
||||
|
||||
rules:
|
||||
# 120 chars should be enough, but don't fail if a line is longer
|
||||
line-length:
|
||||
max: 120
|
||||
level: warning
|
Loading…
Reference in New Issue