Skip to content

Commit

Permalink
Add venv creation and activation support (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aymane11 authored and yezz123 committed Mar 7, 2024
1 parent 62a57aa commit a7fb588
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,20 @@ steps:
- run: uv pip install black # this command will run in the uv environment
```
### Create and activate a virtual environment using uv
```yaml
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- uses: yezz123/setup-uv@v1
with:
uv-venv: "your_venv_name"
- run: uv pip install black # this command will run in the uv environment
```
## Contributing
### Create issues
Expand Down
10 changes: 9 additions & 1 deletion __tests__/input.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { getInputs, getVenvInput, getVersionInput } from '../src/inputs'


const TEST_ENV_VARS = {
INPUT_MISSING: '',
INPUT_FALSY: 'false',
INPUT_TRUTHY: 'true',
INPUT_VERSION_UNSUPPORTED: '0.0.3',
INPUT_VERSION_SUPPORTED: '0.1.2',

'INPUT_UV-VERSION': '0.1.2',
'INPUT_UV-VENV': 'my_venv'
}
Expand Down Expand Up @@ -52,4 +52,12 @@ describe('options', () => {
it('getVenvInput returns null if input is not provided', () => {
expect(getVenvInput('SOMETHING')).toBeNull()
})

it('getVenvInput returns venv name if input is valid', () => {
expect(getVenvInput('uv-venv')).toBe('my_venv')
})

it('getVenvInput returns null if input is not provided', () => {
expect(getVenvInput('SOMETHING')).toBeNull()
})
})
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ async function run(): Promise<void> {
try {
const inputs = getInputs()

await findUv(inputs.version)
await findUv(inputs)
if (inputs.venv) {
await createVenv(inputs.venv)
await activateVenv(inputs.venv)
Expand Down

0 comments on commit a7fb588

Please sign in to comment.