Skip to content

Commit

Permalink
TLC
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielfalcao committed Feb 3, 2023
1 parent f6dd3a6 commit c821914
Show file tree
Hide file tree
Showing 14 changed files with 12,854 additions and 14,402 deletions.
68 changes: 40 additions & 28 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ jobs:
name: functional tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: checkout
uses: actions/checkout@v3

- name: Set Node.js 14.x
uses: actions/setup-node@master
- name: set node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 16.x

- name: install dependencies
run: npm ci
Expand All @@ -22,16 +22,19 @@ jobs:

integration_test_setup:
runs-on: ubuntu-latest
name: install pyenv
name: install pyenv and check versions
steps:
- name: checkout
uses: actions/checkout@v3

- name: setup pyenv
id: pyenv
uses: "gabrielfalcao/pyenv-action@main"
uses: ./

- name: List python versions
- name: list python versions
run: pyenv versions

- name: Verify default installation
- name: verify default installation
run: python --version

- name: list files in pyenv_root
Expand All @@ -41,75 +44,84 @@ jobs:
runs-on: ubuntu-latest
name: pre-install default version
steps:
- name: checkout
uses: actions/checkout@v3

- name: pyenv + python 3.7.16
id: pyenv
uses: "gabrielfalcao/pyenv-action@main"
uses: ./
with:
default: 3.7.16

- name: pyenv + python 3.7.16 cached
id: pyenv2
uses: "gabrielfalcao/pyenv-action@main"
uses: ./
with:
default: 3.7.16

- name: List python versions
- name: list python versions
run: pyenv versions

- name: Verify default installation
- name: verify default installation
run: python --version | grep 3.7.16

integration_test_preinstall_versions:
runs-on: ubuntu-latest
name: pre-install multiple versions of python
steps:
- name: pyenv + python 3.6.15 and 3.7.16
- name: checkout
uses: actions/checkout@v3

- name: pyenv + python 3.8.16 and 3.7.16
id: pyenv
uses: "gabrielfalcao/pyenv-action@main"
uses: ./
with:
default: 3.7.16
command: |
pip install -U pip
pip install -U setuptools
versions: 3.6.15,
versions: 3.8.16,

- name: List python versions
- name: list python versions
run: pyenv versions

- name: Verify default installation
- name: verify default installation
run: python --version

- name: Verify python 3.6.15 installation
run: pyenv local 3.6.15 && python --version | grep 3.6.15
- name: verify python 3.8.16 installation
run: pyenv local 3.8.16 && python --version | grep 3.8.16

- name: Verify python 3.7.16 installation
- name: verify python 3.7.16 installation
run: pyenv local 3.7.16 && python --version | grep 3.7.16


integration_test_run_command_after_each_installation:
runs-on: ubuntu-latest
name: run command after installing each python version
steps:
- name: Python 3.6.15 and 3.7.16 with latest pip
- name: checkout
uses: actions/checkout@v3

- name: python 3.7.16 and 3.8.16 with latest pip
id: pyenv
uses: "gabrielfalcao/pyenv-action@main"
uses: ./
with:
default: 3.7.16
command: |
pip install -U pip
pip install -U setuptools
versions: 3.6.15,
versions: 3.8.16,

- name: List python versions
run: pyenv versions

- name: Verify default installation
- name: verify default installation
run: python --version

- name: Verify pip version on python 3.6.15 installation
run: pyenv local 3.6.15 && pip --version
- name: verify pip version on python 3.8.16 installation
run: pyenv local 3.8.16 && pip --version

- name: Verify pip version on python 3.7.16 installation
- name: verify pip version on python 3.7.16 installation
run: pyenv local 3.7.16 && pip --version
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ typings/
__tests__/.installer-tmp/
__tests__/.environment-tmp/
__tests__/.test-artifacts/
.tmp
.tmp
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12.16.3
16.18
27 changes: 22 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.PHONY: default watch release build format lint test clean

NODE_VERSION := v12.16.1

NODE_VERSION := v16.18.0
GIT_ROOT := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
NODE_ROOT := $(GIT_ROOT)/node_modules
NODE_BIN := $(NODE_ROOT)/.bin
Expand All @@ -23,21 +23,21 @@ $(NODE_ROOT) $(NODE_BIN):
npm install
endif

$(typescript) $(eslint) $(prettier) $(ncc) $(jest): | $(NODE_BIN)
install $(typescript) $(eslint) $(prettier) $(ncc) $(jest): | $(NODE_BIN)
npm install

watch: format | $(typescript)
npm run watch

dist/index.js: | lib/pyenv-action.js
dist/index.js: | $(NODE_BIN) lib/pyenv-action.js
npm run release

lib/pyenv-action.js: | $(typescript)
npm run build

release: clean test dist/index.js

build: format
build: format | $(NODE_BIN)
npm run build

format: | $(prettier)
Expand All @@ -54,3 +54,20 @@ test-watch: | $(jest)

clean:
rm -f dist/index.js

node-check: $(NODE_BIN) $(NODE_ROOT)
@echo BIN $(NODE_BIN)
@echo ROOT $(NODE_ROOT)


.PHONY: \
build \
clean \
default \
format \
install \
lint \
node-check \
release \
test \
watch
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ each of them and run pytest.
- 3.7.5
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install python version
uses: gabrielfalcao/pyenv-action@v11
with:
Expand Down Expand Up @@ -82,7 +82,7 @@ Enable multiple python versions in your github-action
name: install pyenv
steps:
- name: setup pyenv
uses: "gabrielfalcao/pyenv-action@v9"
uses: "gabrielfalcao/pyenv-action@v11"
with:
default: 3.7.2
versions: 3.6.8, 3.5.7
Expand Down
12 changes: 2 additions & 10 deletions __tests__/environment_manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,13 @@ describe('EnvironmentManager', () => {
const toolDir = path.join(
tmpPath,
'runner',
path.join(
Math.random()
.toString(36)
.substring(7)
),
path.join(Math.random().toString(36).substring(7)),
'tools'
);
const tempDir = path.join(
tmpPath,
'runner',
path.join(
Math.random()
.toString(36)
.substring(7)
),
path.join(Math.random().toString(36).substring(7)),
'temp'
);
await io.rmRF(toolDir);
Expand Down
12 changes: 2 additions & 10 deletions __tests__/installer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,13 @@ https: describe('PyEnvInstaller', () => {
const toolDir = path.join(
tmpPath,
'runner',
path.join(
Math.random()
.toString(36)
.substring(7)
),
path.join(Math.random().toString(36).substring(7)),
'tools'
);
const tempDir = path.join(
tmpPath,
'runner',
path.join(
Math.random()
.toString(36)
.substring(7)
),
path.join(Math.random().toString(36).substring(7)),
'temp'
);
await io.rmRF(toolDir);
Expand Down
3 changes: 2 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'Pyenv Build'
author: 'Gabriel Falcão'
description: 'Enables use of pyenv within build'
runs:
using: 'node12'
using: 'node16'
main: 'dist/index.js'

inputs:
Expand All @@ -25,6 +25,7 @@ outputs:
pyenv_root:
description: |
the full filesystem path from this action
branding:
icon: 'terminal' # or 'sliders'
color: 'gray-dark'
Loading

0 comments on commit c821914

Please sign in to comment.