Skip to content

Commit

Permalink
feat: исключение для скачивания контрольной суммы
Browse files Browse the repository at this point in the history
  • Loading branch information
alkoleft committed Nov 17, 2024
1 parent 6137ea7 commit 294cafe
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 37 deletions.
16 changes: 8 additions & 8 deletions __tests__/filter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ import * as filter from '../src/onegetjs/filter'

describe('filter.ts', () => {
it('windows x86 full', async () => {
let filters = filter.getFilters({
const filters = filter.getFilters({
osName: 'win',
architecture: 'x86',
type: 'full'
})
let result = filter.filter(fixtures, filters)
const result = filter.filter(fixtures, filters)
console.dir(result)
expect(result.length).toEqual(1)
})

it('x64/x86', async () => {
let files = [
const files = [
{
name: 'Технологическая платформа 1С:Предприятия (64-bit) для Windows',
url: 'https://releases.1c.ru/version_file?nick=Platform83&ver=8.3.25.1286&path=Platform%5c8_3_25_1286%5cwindows64full_8_3_25_1286.rar'
Expand All @@ -28,30 +28,30 @@ describe('filter.ts', () => {
architecture: 'x86',
type: 'full'
})
let result1 = filter.filter(files, filters)
const result1 = filter.filter(files, filters)
expect(result1.length).toEqual(1)

filters = filter.getFilters({
osName: 'win',
architecture: 'x64',
type: 'full'
})
let result2 = filter.filter(files, filters)
const result2 = filter.filter(files, filters)
expect(result2.length).toEqual(1)
expect(result1[0]).not.toEqual(result2[0])
})
it('Linux (deb) 64 client', async () => {

Check warning on line 43 in __tests__/filter.test.ts

View workflow job for this annotation

GitHub Actions / Lint Codebase

Test has no assertions
let filters = filter.getFilters({
const filters = filter.getFilters({
osName: 'deb',
architecture: 'x64',
type: 'client'
})
let result = filter.filter(fixtures, filters)
const result = filter.filter(fixtures, filters)
console.dir(result)
})
})

let fixtures = [
const fixtures = [
{
name: 'Технологическая платформа 8.3. Версия 8.3.25.1286. Список изменений и порядок обновления',
url: 'https://releases.1c.ru/version_file?nick=Platform83&ver=8.3.25.1286&path=Platform%5c8_3_25_1286%5c1cv8upd_8_3_25_1286.htm'
Expand Down
42 changes: 21 additions & 21 deletions __tests__/installer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('action', () => {
new Map()
// Set the action's inputs as return values from core.getInput()
getInputMock.mockImplementation((name: string): string => {
return input[name]n
return input[name]
})
getBooleanInput.mockImplementation((name: string): boolean => {
return input[name] === 'true'
Expand All @@ -71,25 +71,25 @@ describe('action', () => {
},
TIMEOUT
),
it(
'Install 1C:Enterprise',
async () => {
const input: Input = {
type: 'onec',
onec_version: '8.3.14.2095',
offline: 'true'
}
// Set the action's inputs as return values from core.getInput()
getInputMock.mockImplementation((name: string): string => {
return input[name]
})
getBooleanInput.mockImplementation((name: string): boolean => {
return input[name] === 'true'
})
it(
'Install 1C:Enterprise',
async () => {
const input: Input = {
type: 'onec',
onec_version: '8.3.14.2095',
offline: 'true'
}
// Set the action's inputs as return values from core.getInput()
getInputMock.mockImplementation((name: string): string => {
return input[name]
})
getBooleanInput.mockImplementation((name: string): boolean => {
return input[name] === 'true'
})

await installer.run()
expect(runMock).toHaveReturned()
},
TIMEOUT * 10
)
await installer.run()
expect(runMock).toHaveReturned()
},
TIMEOUT * 10
)
})
8 changes: 4 additions & 4 deletions __tests__/ongetjs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const TIMEOUT = 500000

describe('onegetjs', () => {
config()
const client = new OneGet('/tmp/oneget')

// const client = new OneGet('/tmp/oneget')
//
// it('versionInfo', async () => {

Check warning on line 11 in __tests__/ongetjs.test.ts

View workflow job for this annotation

GitHub Actions / Lint Codebase

Some tests seem to be commented
// await client.auth()
// await client.versionInfo('Platform83', '8.3.10.2580');
Expand All @@ -33,7 +33,7 @@ describe('onegetjs', () => {
it(

Check warning on line 33 in __tests__/ongetjs.test.ts

View workflow job for this annotation

GitHub Actions / Lint Codebase

Test has no assertions
'downloadRelease',
async () => {
const files = await downloadRelease(
await downloadRelease(
{
project: 'Platform83',
version: '8.3.10.2580',
Expand All @@ -51,7 +51,7 @@ describe('onegetjs', () => {
it(
'downloadRelease EDT',
async () => {
const files = await downloadRelease(
await downloadRelease(
{
project: 'DevelopmentTools10',
version: '2023.1.2',
Expand Down
8 changes: 7 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/onegetjs/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ const thinPattern = /^Тонкий клиент.+/
const fullPattern = /^Технологическая платформа.+/
const offlinePattern = /.+(без интернета|оффлайн).*/
const clientOrServerPattern = /^[Клиент|Cервер|Сервер].+/
const SHA = /.*(Контрольная сумма|sha).*/

type Predicate = (value: string) => unknown

export function getFilters(artifactFilter: ArtifactFilter): Predicate[] {
const filters = new Array<Predicate>()
filters.push(v => !SHA.test(v))

switch (artifactFilter.osName) {
case 'win':
filters.push(windowsPattern.test.bind(windowsPattern))
Expand Down
7 changes: 5 additions & 2 deletions src/tools/platform83.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,16 @@ export class Platform83 extends OnecTool {
}

async install(): Promise<void> {
const installerPattern = this.isWindows() ? 'setup.exe' : 'setup-full'
const installerPattern = this.isWindows()
? 'setup.exe'
: this.useNewInstaller()
? '*.deb'
: 'setup-full'

const path = `/tmp/${this.INSTALLER_CACHE_PRIMARY_KEY}`
const patterns = [`${path}/**/${installerPattern}*`]
const globber = await glob.create(patterns.join('\n'))
const files = await globber.glob()

core.info(`found ${files}`)

if (this.isLinux() && this.useNewInstaller()) {
Expand Down

0 comments on commit 294cafe

Please sign in to comment.