Skip to content

Commit

Permalink
feat: install old platforms on ubuntu
Browse files Browse the repository at this point in the history
  • Loading branch information
alkoleft committed Nov 17, 2024
1 parent 4410b4d commit 96d1c0c
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 75 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@ jobs:
id: checkout
uses: actions/checkout@v4

- name: Test Local Action
- name: Install 1C:Enterprise from deb-packages
id: test-action
uses: ./
with:
milliseconds: 2000

- name: Print Output
id: output
run: echo "${{ steps.test-action.outputs.time }}"
type: onec
onec_version: 8.3.14.2095
cache_distr: true
env:
ONEC_USERNAME: ${{ secrets.ONEC_USERNAME }}
ONEC_PASSWORD: ${{ secrets.ONEC_PASSWORD }}
timeout-minutes: 10
62 changes: 29 additions & 33 deletions 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.

33 changes: 12 additions & 21 deletions src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,35 +27,26 @@ export async function run(): Promise<void> {
throw new Error('failed to recognize the installer type')
}

// let installerRestoredKey: string | undefined
// let installerRestored = false
let instalationRestoredKey: string | undefined
let instalationRestored = false
let installerRestoredKey: string | undefined
let installerRestored = false
let installationRestoredKey: string | undefined
let installationRestored = false

if (useCache) {
instalationRestoredKey = await installer.restoreInstalledTool()
instalationRestored = instalationRestoredKey !== undefined
installationRestoredKey = await installer.restoreInstalledTool()
installationRestored = installationRestoredKey !== undefined
}

if (instalationRestored) {
if (installationRestored) {
return
}

// if (useCacheDistr) {
// installerRestoredKey = await installer.restoreInstallationPackage()
// installerRestored = installerRestoredKey !== undefined
// }
if (useCacheDistr) {
installerRestoredKey = await installer.restoreInstallationPackage()
installerRestored = installerRestoredKey !== undefined

Check failure on line 46 in src/installer.ts

View workflow job for this annotation

GitHub Actions / Lint Codebase

'installerRestored' is assigned a value but never used
}

// if (!installerRestored) {
// const oneget = new OneGet(onegetVersion, process.platform)
// await oneget.download()
// await oneget.install()
// await installer.download()
// if (useCacheDistr) {
// await installer.saveInstallerCache()
// }
// }
if (!instalationRestored) {
if (!installationRestored) {
await installer.download()
if (useCacheDistr) {
await installer.saveInstallerCache()
Expand Down
4 changes: 2 additions & 2 deletions src/tools/oneGet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class OneGet extends OnecTool {
platform = 'darwin'
extension = 'tar.gz'
}
const installerPath = `/tmp/${this.INSTALLER_CACHE_PRIMARY_KEY}`
const installerPath = this.getInstallersPath()
await io.rmRF(installerPath)

const archivePath = `${installerPath}/oneget.${extension}`
Expand All @@ -49,7 +49,7 @@ class OneGet extends OnecTool {
} else if (this.isMac()) {
extension = 'tar.gz'
}
const onegetPath = `/tmp/${this.INSTALLER_CACHE_PRIMARY_KEY}/oneget.${extension}`
const onegetPath = `${this.getInstallersPath()}/oneget.${extension}`

let oneGetFolder
if (this.isWindows()) {
Expand Down
8 changes: 6 additions & 2 deletions src/tools/onecTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,18 @@ export abstract class OnecTool implements IOnecTools {
}
}

protected getInstallersPath(): string {
return `/tmp/${this.INSTALLER_CACHE_PRIMARY_KEY}`
}

protected async handleLoadedCache(): Promise<void> {
await this.updatePath()
}

async restoreInstallationPackage(): Promise<string | undefined> {
const primaryKey = this.computeInstallerKey()

const restorePath = `/tmp/${this.INSTALLER_CACHE_PRIMARY_KEY}`
const restorePath = this.getInstallersPath()
const matchedKey = await restoreCasheByPrimaryKey([restorePath], primaryKey)

await this.handleLoadedCache()
Expand Down Expand Up @@ -93,7 +97,7 @@ export abstract class OnecTool implements IOnecTools {
async saveInstallerCache(): Promise<void> {
try {
await cache.saveCache(
[`/tmp/${this.INSTALLER_CACHE_PRIMARY_KEY}`],
[this.getInstallersPath()],
this.computeInstallerKey()
)
} catch (error) {
Expand Down
27 changes: 17 additions & 10 deletions src/tools/platform83.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class Platform83 extends OnecTool {
architecture: 'x64',
type: installerType
},
`/tmp/${this.INSTALLER_CACHE_PRIMARY_KEY}`,
this.getInstallersPath(),
true
)

Expand All @@ -54,9 +54,9 @@ export class Platform83 extends OnecTool {
? 'setup-full'
: '*.deb'

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

const globber = await glob.create(`${path}/**/${installerPattern}*`)
const files = await globber.glob()
core.info(`found ${files}`)

Expand All @@ -71,12 +71,19 @@ export class Platform83 extends OnecTool {
'client_thin,client_thin_fib,ws'
])
} else if (this.isLinux()) {
await exec('sudo', [
'dpkg',
'-i',
'--force-all',
`${path}/1c-enterprise83*-{common,server,thin-client,client}_*.deb`
])
for await (const mask of ['common', 'server', 'thin-client', 'client']) {
const files = await (
await glob.create(`${path}/1c-enterprise83-${mask}_*.deb`)
).glob()

if (files.length !== 0) {
await exec('sudo', ['dpkg', '-i', '--force-all', `${files[0]}`])
} else {
core.warning(
`File not found for ${mask} (mask: 1c-enterprise83-${mask}_*.deb)`
)
}
}
} else if (this.isWindows()) {
await exec(files[0], [
'/l',
Expand Down

0 comments on commit 96d1c0c

Please sign in to comment.