Skip to content

Commit

Permalink
🔥 remove preview version from setup-uv (#10)
Browse files Browse the repository at this point in the history
🔥 remove the preview version from setup-uv
  • Loading branch information
yezz123 committed Feb 24, 2024
2 parents 28f9145 + 17ce5cb commit e8c68ae
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 66 deletions.
14 changes: 0 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,6 @@ steps:
- run: uv --version
```

### Allow to install prerelease versions of UV

```yaml
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- uses: yezz123/setup-uv@v1
with:
uv-preview: true
- run: uv --version
```

### Create and activate a virtual environment using uv

```yaml
Expand Down
26 changes: 1 addition & 25 deletions __tests__/input.test.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
import { getInput } from '@actions/core'
import {
getBooleanInput,
getInputs,
getVenvInput,
getVersionInput
} from '../src/inputs'
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_VERSION_ALPHA: '0.1.3.0a1',

'INPUT_UV-PREVIEW': 'true',
'INPUT_UV-VERSION': '0.1.2',
'INPUT_UV-VENV': 'my_venv'
}
Expand All @@ -32,25 +25,12 @@ describe('options', () => {
}
})

it('getBooleanInput returns false if input is missing', () => {
expect(getBooleanInput('missing')).toBeFalsy()
})

it('getBooleanInput returns false if input is falsy', () => {
expect(getBooleanInput('falsy')).toBeFalsy()
})

it('getBooleanInput returns true if input is truthy', () => {
expect(getBooleanInput('truthy')).toBeTruthy()
})

it('getVersionInput returns null if input is missing', () => {
expect(getVersionInput('missing')).toBeNull()
})

it('getInputs returns inputs', () => {
expect(getInputs()).toStrictEqual({
preview: true,
version: '0.1.2',
venv: 'my_venv'
})
Expand All @@ -66,10 +46,6 @@ describe('options', () => {
expect(getVersionInput('version_supported')).toBe('0.1.2')
})

it('getVersionInput returns version if input is alpha', () => {
expect(getVersionInput('version_alpha')).toBe('0.1.3.0a1')
})

it('getVenvInput returns venv name if input is valid', () => {
expect(getVenvInput('uv-venv')).toBe('my_venv')
})
Expand Down
4 changes: 0 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ name: Setup uv
description: Set up your GitHub Actions workflow with a specific version of uv
author: Yasser Tahiri
inputs:
uv-preview:
description: Allow to install prerelease versions of uv.
required: false
default: "false"
uv-version:
description: uv version to use, if version is not provided then latest stable version will be used
required: false
Expand Down
11 changes: 1 addition & 10 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31906,25 +31906,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getVenvInput = exports.getVersionInput = exports.getBooleanInput = exports.getInputs = void 0;
exports.getVenvInput = exports.getVersionInput = exports.getInputs = void 0;
const core_1 = __nccwpck_require__(2186);
const semver_1 = __importDefault(__nccwpck_require__(1383));
function getInputs() {
return {
preview: getBooleanInput('uv-preview'),
version: getVersionInput('uv-version'),
venv: getVenvInput('uv-venv')
};
}
exports.getInputs = getInputs;
function getBooleanInput(name, default_ = false) {
const value = (0, core_1.getInput)(name);
if (!value) {
return default_;
}
return value === 'true';
}
exports.getBooleanInput = getBooleanInput;
function getVersionInput(name) {
const version = (0, core_1.getInput)(name);
if (!version) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"package": "ncc build src/main.ts --license licenses.txt",
"package:watch": "npm run package -- --watch",
"test": "jest",
"all": "npm run format:write && npm run lint && npm run test && npm run coverage && npm run package"
"all": "npm run format:write && npm run test && npm run package"
},
"license": "MIT",
"jest": {
Expand Down
12 changes: 0 additions & 12 deletions src/inputs.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,17 @@
import { getInput } from '@actions/core'
import semver from 'semver'
export interface Inputs {
// Finder related inputs
preview: boolean
version: string | null
venv: string | null
}

export function getInputs(): Inputs {
return {
preview: getBooleanInput('uv-preview'),
version: getVersionInput('uv-version'),
venv: getVenvInput('uv-venv')
}
}

export function getBooleanInput(name: string, default_ = false): boolean {
const value = getInput(name)
if (!value) {
return default_
}

return value === 'true'
}

export function getVersionInput(name: string): string | null {
const version = getInput(name)
if (!version) {
Expand Down

0 comments on commit e8c68ae

Please sign in to comment.