Skip to content

Commit

Permalink
feat: improvz
Browse files Browse the repository at this point in the history
  • Loading branch information
omarsy committed Jul 10, 2024
1 parent 5e6cdee commit b0de7a9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 184 deletions.
12 changes: 5 additions & 7 deletions src/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { exec } from "child_process"
import path from "path"
import { promisify } from "util"

import { VersionConfig } from "./version"

const execShellCommand = promisify(exec)

export enum InstallMode {
Expand Down Expand Up @@ -33,10 +31,10 @@ const printOutput = (res: ExecRes): void => {
* @param mode installation mode.
* @returns path to installed binary of golangci-lint.
*/
export async function installLint(versionConfig: VersionConfig, mode: InstallMode): Promise<string> {
export async function installLint(version: string, mode: InstallMode): Promise<string> {
core.info(`Installation mode: ${mode}`)

return goInstall(versionConfig)
return goInstall(version)
}

/**
Expand All @@ -45,15 +43,15 @@ export async function installLint(versionConfig: VersionConfig, mode: InstallMod
* @param versionConfig information about version to install.
* @returns path to installed binary of gno-lint.
*/
export async function goInstall(versionConfig: VersionConfig): Promise<string> {
core.info(`Installing gno-lint ${versionConfig.TargetVersion}...`)
export async function goInstall(version: string): Promise<string> {
core.info(`Installing gno-lint ${version}...`)

const startedAt = Date.now()

const clres = await execShellCommand(`git clone https://github.com/gnolang/gno.git`)
printOutput(clres)

const chres = await execShellCommand(`cd gno && git checkout ${versionConfig.TargetVersion}`)
const chres = await execShellCommand(`cd gno && git checkout ${version}`)
printOutput(chres)

const bres = await execShellCommand(`cd gnovm && make build && make install`)
Expand Down
5 changes: 2 additions & 3 deletions src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { promisify } from "util"
import { restoreCache, saveCache } from "./cache"
import { installLint, InstallMode } from "./install"
import { alterDiffPatch } from "./utils/diffUtils"
import { findLintVersion } from "./version"

const execShellCommand = promisify(exec)
const writeFile = promisify(fs.writeFile)
Expand All @@ -22,9 +21,9 @@ function isOnlyNewIssues(): boolean {

async function prepareLint(): Promise<string> {
const mode = core.getInput("install-mode").toLowerCase()
const versionConfig = await findLintVersion(<InstallMode>mode)
const v: string = core.getInput(`version`) || "latest"

return await installLint(versionConfig, <InstallMode>mode)
return await installLint(v, <InstallMode>mode)
}

async function fetchPatch(): Promise<string> {
Expand Down
174 changes: 0 additions & 174 deletions src/version.ts

This file was deleted.

0 comments on commit b0de7a9

Please sign in to comment.