Add node's caching implementation (#2)

* first iteration for implementation of caching

* add logs

* add debug line

* fix build command

* fix path

* add possible post-if

* remove braces

* test new action post-if variant

* work on built-in caching

* remove post-if

* pass version

* work on yarn support

* fix return value

* change names and remove logs

* worked on resolving comments

* check post-if for null

* add success() condition

* remove primary key field

* work on resolving comments

* remove logs

* resolving comments

* resolving comments

* resolving comments

* resolving comments

* fix getpackageManagerVersion

* run clean for unstaged changes

* fix falling version tests

* work on resolving comments

* resolving comments

* fix comment

* resolve comments

* Add tests to cover node's caching (#3)

* add tests to cover node's caching

* work on fixing tests

* fix e2e tests

* rebuild and fix test

* fixing tests

* change name of describes, it and fix test

* add names for jobs

* fix issue
This commit is contained in:
Dmitry Shibanov 2021-06-16 09:52:44 +03:00 committed by GitHub
parent 5c355be170
commit 3d0d4edb10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 148748 additions and 21447 deletions

View file

@ -2,6 +2,7 @@ import * as core from '@actions/core';
import * as installer from './installer';
import * as auth from './authutil';
import * as path from 'path';
import {restoreCache} from './cache-restore';
import {URL} from 'url';
import os = require('os');
@ -17,6 +18,7 @@ export async function run() {
}
let arch = core.getInput('architecture');
const cache = core.getInput('cache');
// if architecture supplied but node-version is not
// if we don't throw a warning, the already installed x64 node will be used which is not probably what user meant.
@ -45,7 +47,14 @@ export async function run() {
auth.configAuthentication(registryUrl, alwaysAuth);
}
const matchersPath = path.join(__dirname, '..', '.github');
if (cache) {
if (isGhes()) {
throw new Error('Caching is not supported on GHES');
}
await restoreCache(cache);
}
const matchersPath = path.join(__dirname, '../..', '.github');
core.info(`##[add-matcher]${path.join(matchersPath, 'tsc.json')}`);
core.info(
`##[add-matcher]${path.join(matchersPath, 'eslint-stylish.json')}`