Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ci-log package #115

Merged
merged 1 commit into from
Aug 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/actions_python.c201471c.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion dist/actions_python.dfab21e0.js.map

This file was deleted.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/actions_python.f71abc63.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion dist/actions_python.feac98a0.js.map

This file was deleted.

2 changes: 1 addition & 1 deletion dist/setup_cpp.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/setup_cpp.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/setup_cpp.mjs.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"@actions/io": "^1.1.2",
"@actions/tool-cache": "^2.0.1",
"@npmcli/ci-detect": "github:aminya/ci-detect#37fe40075bebec96794ba0a7c4a6d5c70cbea00d",
"ci-log": "workspace:*",
"escape-path-with-spaces": "github:aminya/escape-path-with-spaces#d9f81ee649203ddc55783a2f96ada59df06118e3",
"exec-powershell": "workspace:*",
"execa": "^5.1.1",
Expand Down
70 changes: 70 additions & 0 deletions packages/ci-log/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<h1 align="center">ci-log</h1>
<p>
<img alt="Version" src="https://img.shields.io/badge/version-1.0.0-blue.svg?cacheSeconds=2592000" />
<a href="#" target="_blank">
<img alt="License: Apache--2.0" src="https://img.shields.io/badge/License-Apache--2.0-yellow.svg" />
</a>
</p>

> Colorful logging and print for any environment including GitHub Actions

## Install

```sh
npm install --save ci-log
```

## Usage

<!-- INSERT GENERATED DOCS START -->

### `error` (function)

**Parameters:**

- err (`string | Error`)

**returns:** void

### `success` (function)

**Parameters:**

- msg (`string`)

**returns:** void

### `warning` (function)

**Parameters:**

- msg (`string`)

**returns:** void

### `notice` (function)

**Parameters:**

- msg (`string`)

**returns:** void

### `info` (function)

**Parameters:**

- msg (`string`)

**returns:** void

<!-- INSERT GENERATED DOCS END -->

## 🤝 Contributing

You can sponsor my work here:

https://github.com/sponsors/aminya

Pull requests, issues and feature requests are welcome.
See the [Contributing guide](https://github.com/aminya/setup-cpp/blob/master/CONTRIBUTING.md).
29 changes: 29 additions & 0 deletions packages/ci-log/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "ci-log",
"version": "1.0.0",
"description": "Colorful logging and print for any environment including GitHub Actions",
"homepage": "https://github.com/aminya/setup-cpp",
"license": "Apache-2.0",
"author": "Amin Yahyaabadi",
"main": "./dist/index.js",
"source": "./src/index.ts",
"scripts": {
"build": "tsc"
},
"dependencies": {
"@actions/core": "^1.9.0",
"@npmcli/ci-detect": "github:aminya/ci-detect#37fe40075bebec96794ba0a7c4a6d5c70cbea00d"
},
"keywords": [
"log",
"print",
"GitHub",
"actions",
"Gitlab",
"CI",
"color",
"console",
"info",
"notifications"
]
}
File renamed without changes.
7 changes: 7 additions & 0 deletions packages/ci-log/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist"
},
"include": ["./src"]
}
14 changes: 12 additions & 2 deletions pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion src/doxygen/doxygen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { setupBrewPack } from "../utils/setup/setupBrewPack"
import { setupChocoPack } from "../utils/setup/setupChocoPack"
import { addBinExtension } from "extension-tools"
import { extractTar, extractZip } from "../utils/setup/extract"
import { notice } from "../utils/io/io"
import { notice } from "ci-log"
import { setupGraphviz } from "../graphviz/graphviz"
import { getVersion } from "../default_versions"
import { existsSync } from "fs"
Expand Down
2 changes: 1 addition & 1 deletion src/gcc/gcc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import semverMajor from "semver/functions/major"
import semverCoerce from "semver/functions/coerce"
import { setupMacOSSDK } from "../macos-sdk/macos-sdk"
import path from "path"
import { warning, info } from "../utils/io/io"
import { warning, info } from "ci-log"
import ciDetect from "@npmcli/ci-detect"
import { addBinExtension } from "extension-tools"
import { InstallationInfo, PackageInfo, setupBin } from "../utils/setup/setupBin"
Expand Down
2 changes: 1 addition & 1 deletion src/kcov/kcov.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { hasDnf } from "../utils/env/hasDnf"
import { setupDnfPack } from "../utils/setup/setupDnfPack"
import { isUbuntu } from "../utils/env/isUbuntu"
import { addVPrefix, removeVPrefix } from "../utils/setup/version"
import { info } from "../utils/io/io"
import { info } from "ci-log"
import { untildifyUser } from "untildify-user"
import { setupNinja } from "../ninja/ninja"

Expand Down
2 changes: 1 addition & 1 deletion src/llvm/llvm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { addBinExtension } from "extension-tools"
import { addEnv } from "../utils/env/addEnv"
import { setOutput } from "@actions/core"
import { setupAptPack, updateAptAlternatives } from "../utils/setup/setupAptPack"
import { info, warning } from "../utils/io/io"
import { info, warning } from "ci-log"
import { existsSync } from "fs"
import ciDetect from "@npmcli/ci-detect"
import { setupGcc } from "../gcc/gcc"
Expand Down
2 changes: 1 addition & 1 deletion src/macos-sdk/macos-sdk.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getExecOutput } from "@actions/exec"
import { addEnv } from "../utils/env/addEnv"
import { error } from "../utils/io/io"
import { error } from "ci-log"

export async function setupMacOSSDK() {
if (process.platform === "darwin") {
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import semverValid from "semver/functions/valid"
import { getVersion, syncVersions } from "./default_versions"
import { setupGcc } from "./gcc/gcc"
import { InstallationInfo } from "./utils/setup/setupBin"
import { error, info, success, warning } from "./utils/io/io"
import { error, info, success, warning } from "ci-log"
import { setupVcpkg } from "./vcpkg/vcpkg"
import { join } from "path"
import { setupVCVarsall } from "./vcvarsall/vcvarsall"
Expand Down
2 changes: 1 addition & 1 deletion src/msvc/msvc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { vsversion_to_versionnumber, findVcvarsall } from "msvc-dev-cmd/lib.js"
import ciDetect from "@npmcli/ci-detect"
import path from "path"
import { existsSync } from "fs"
import { error, info, warning } from "../utils/io/io"
import { error, info, warning } from "ci-log"

type MSVCVersion = "2022" | "17.0" | "2019" | "16.0" | "2017" | "15.0" | "2015" | "14.0" | "2013" | "12.0" | string

Expand Down
2 changes: 1 addition & 1 deletion src/python/__tests__/python.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { cleanupTmpDir, setupTmpDir, testBin } from "../../utils/tests/test-help
import { getVersion } from "../../default_versions"
import { ubuntuVersion } from "../../utils/env/ubuntu_version"
import ciDetect from "@npmcli/ci-detect"
import { info } from "../../utils/io/io"
import { info } from "ci-log"

jest.setTimeout(300000)
describe("setup-python", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/python/actions_python.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useCpythonVersion } from "setup-python/src/find-python"
import { findPyPyVersion } from "setup-python/src/find-pypy"
import { existsSync } from "fs"
import { info, warning } from "../utils/io/io"
import { info, warning } from "ci-log"
import { debug } from "@actions/core"
import path from "path"
import ciDetect from "@npmcli/ci-detect"
Expand Down
2 changes: 1 addition & 1 deletion src/python/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
import { setupBrewPack } from "../utils/setup/setupBrewPack"
import { setupChocoPack } from "../utils/setup/setupChocoPack"
import ciDetect from "@npmcli/ci-detect"
import { warning, info } from "../utils/io/io"
import { warning, info } from "ci-log"
import { isArch } from "../utils/env/isArch"
import which from "which"
import { InstallationInfo } from "../utils/setup/setupBin"
Expand Down
2 changes: 1 addition & 1 deletion src/utils/env/addEnv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { exportVariable, addPath as ghAddPath, info, setFailed } from "@actions/
import ciDetect from "@npmcli/ci-detect"
import { untildifyUser } from "untildify-user"
import { appendFileSync, existsSync, readFileSync } from "fs"
import { error, warning } from "../io/io"
import { error, warning } from "ci-log"
import { execPowershell } from "exec-powershell"
import { delimiter } from "path"
import escapeSpace from "escape-path-with-spaces"
Expand Down
2 changes: 1 addition & 1 deletion src/utils/setup/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import execa from "execa"
import { mkdirP } from "@actions/io"
import which from "which"
import { setupSevenZip } from "../../sevenzip/sevenzip"
import { warning } from "../io/io"
import { warning } from "ci-log"
import { giveUserAccess } from "user-access"
export { extractTar, extractXar } from "@actions/tool-cache"

Expand Down
2 changes: 1 addition & 1 deletion src/utils/setup/setupChocoPack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { setupChocolatey } from "../../chocolatey/chocolatey"
import { InstallationInfo } from "./setupBin"
import execa from "execa"
import { info } from "@actions/core"
import { notice } from "../io/io"
import { notice } from "ci-log"

let hasChoco = false

Expand Down
2 changes: 1 addition & 1 deletion src/utils/setup/setupDnfPack.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable require-atomic-updates */
import { InstallationInfo } from "./setupBin"
import { execRootSync } from "root-tools"
import { info, warning } from "../io/io"
import { info, warning } from "ci-log"

// let didUpdate: boolean = false

Expand Down
2 changes: 1 addition & 1 deletion src/utils/setup/setupPacmanPack.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable require-atomic-updates */
import { InstallationInfo } from "./setupBin"
import { execRootSync } from "root-tools"
import { info } from "../io/io"
import { info } from "ci-log"

let didUpdate: boolean = false
let didInit: boolean = false
Expand Down
2 changes: 1 addition & 1 deletion src/utils/setup/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import semverCompare from "semver/functions/compare"
import semverCoerce from "semver/functions/coerce"
import semverValid from "semver/functions/valid"
import { getExecOutput } from "@actions/exec"
import { info } from "../io/io"
import { info } from "ci-log"

/**
* Gets the specific versions supported by this action compatible with the supplied (specific or minimum) version in
Expand Down
2 changes: 1 addition & 1 deletion src/vcpkg/vcpkg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { dirname, join } from "path"
import which from "which"
import { addPath } from "../utils/env/addEnv"
import { addShellExtension, addShellHere } from "extension-tools"
import { notice } from "../utils/io/io"
import { notice } from "ci-log"
import { setupAptPack } from "../utils/setup/setupAptPack"
import { setupPacmanPack } from "../utils/setup/setupPacmanPack"
import { InstallationInfo } from "../utils/setup/setupBin"
Expand Down
2 changes: 1 addition & 1 deletion src/vcvarsall/vcvarsall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { existsSync } from "fs"
// @ts-ignore
import { setupMSVCDevCmd } from "msvc-dev-cmd/lib.js"
import { addEnv } from "../utils/env/addEnv"
import { info } from "../utils/io/io"
import { info } from "ci-log"

function getArch(arch: string): string {
switch (arch) {
Expand Down