1
0
Fork 0
mirror of https://code.forgejo.org/actions/cache.git synced 2024-12-23 12:36:01 +01:00

Revert "Fix caching directories outside of the working directory (relative paths)"

This commit is contained in:
alivahabi2112 2020-04-12 06:13:41 +04:30 committed by GitHub
parent 78809b91d7
commit 143c84bf60
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 20 additions and 48 deletions

View file

@ -51,30 +51,23 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, windows-latest, macOS-latest] os: [ubuntu-latest, windows-latest, macOS-latest]
fail-fast: false
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Generate files in working directory - name: Generate files
shell: bash shell: bash
run: __tests__/create-cache-files.sh ${{ runner.os }} test-cache run: __tests__/create-cache-files.sh ${{ runner.os }}
- name: Generate files outside working directory
shell: bash
run: __tests__/create-cache-files.sh ${{ runner.os }} ~/test-cache
- name: Save cache - name: Save cache
uses: ./ uses: ./
with: with:
key: test-${{ runner.os }}-${{ github.run_id }} key: test-${{ runner.os }}-${{ github.run_id }}
path: | path: test-cache
test-cache
~/test-cache
test-restore: test-restore:
needs: test-save needs: test-save
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, windows-latest, macOS-latest] os: [ubuntu-latest, windows-latest, macOS-latest]
fail-fast: false
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Checkout - name: Checkout
@ -83,15 +76,10 @@ jobs:
uses: ./ uses: ./
with: with:
key: test-${{ runner.os }}-${{ github.run_id }} key: test-${{ runner.os }}-${{ github.run_id }}
path: | path: test-cache
test-cache - name: Verify cache
~/test-cache
- name: Verify cache files in working directory
shell: bash shell: bash
run: __tests__/verify-cache-files.sh ${{ runner.os }} test-cache run: __tests__/verify-cache-files.sh ${{ runner.os }}
- name: Verify cache files outside working directory
shell: bash
run: __tests__/verify-cache-files.sh ${{ runner.os }} ~/test-cache
# End to end with proxy # End to end with proxy
test-proxy-save: test-proxy-save:
@ -110,7 +98,7 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Generate files - name: Generate files
run: __tests__/create-cache-files.sh proxy test-cache run: __tests__/create-cache-files.sh proxy
- name: Save cache - name: Save cache
uses: ./ uses: ./
with: with:
@ -138,4 +126,4 @@ jobs:
key: test-proxy-${{ github.run_id }} key: test-proxy-${{ github.run_id }}
path: test-cache path: test-cache
- name: Verify cache - name: Verify cache
run: __tests__/verify-cache-files.sh proxy test-cache run: __tests__/verify-cache-files.sh proxy

View file

@ -7,11 +7,5 @@ if [ -z "$prefix" ]; then
exit 1 exit 1
fi fi
path="$2" mkdir test-cache
if [ -z "$path" ]; then echo "$prefix $GITHUB_RUN_ID" > test-cache/test-file.txt
echo "Must supply path argument"
exit 1
fi
mkdir -p $path
echo "$prefix $GITHUB_RUN_ID" > $path/test-file.txt

View file

@ -73,7 +73,6 @@ test("create tar", async () => {
"-cz", "-cz",
"-f", "-f",
CacheFilename, CacheFilename,
"-P",
"-C", "-C",
workspace, workspace,
"--files-from", "--files-from",

View file

@ -7,12 +7,6 @@ if [ -z "$prefix" ]; then
exit 1 exit 1
fi fi
path="$2"
if [ -z "$path" ]; then
echo "Must specify path argument"
exit 1
fi
# Sanity check GITHUB_RUN_ID defined # Sanity check GITHUB_RUN_ID defined
if [ -z "$GITHUB_RUN_ID" ]; then if [ -z "$GITHUB_RUN_ID" ]; then
echo "GITHUB_RUN_ID not defined" echo "GITHUB_RUN_ID not defined"
@ -20,7 +14,7 @@ if [ -z "$GITHUB_RUN_ID" ]; then
fi fi
# Verify file exists # Verify file exists
file="$path/test-file.txt" file="test-cache/test-file.txt"
echo "Checking for $file" echo "Checking for $file"
if [ ! -e $file ]; then if [ ! -e $file ]; then
echo "File does not exist" echo "File does not exist"
@ -33,4 +27,4 @@ echo "File content:\n$content"
if [ -z "$(echo $content | grep --fixed-strings "$prefix $GITHUB_RUN_ID")" ]; then if [ -z "$(echo $content | grep --fixed-strings "$prefix $GITHUB_RUN_ID")" ]; then
echo "Unexpected file content" echo "Unexpected file content"
exit 1 exit 1
fi fi

View file

@ -2182,12 +2182,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(__webpack_require__(470)); const core = __importStar(__webpack_require__(470));
const fs = __importStar(__webpack_require__(747));
const crypto = __importStar(__webpack_require__(417));
const http_client_1 = __webpack_require__(539); const http_client_1 = __webpack_require__(539);
const auth_1 = __webpack_require__(226); const auth_1 = __webpack_require__(226);
const crypto = __importStar(__webpack_require__(417));
const fs = __importStar(__webpack_require__(747));
const constants_1 = __webpack_require__(694);
const utils = __importStar(__webpack_require__(443)); const utils = __importStar(__webpack_require__(443));
const constants_1 = __webpack_require__(694);
const versionSalt = "1.0"; const versionSalt = "1.0";
function isSuccessStatusCode(statusCode) { function isSuccessStatusCode(statusCode) {
if (!statusCode) { if (!statusCode) {
@ -3185,8 +3185,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(__webpack_require__(470)); const core = __importStar(__webpack_require__(470));
const glob = __importStar(__webpack_require__(281));
const io = __importStar(__webpack_require__(1)); const io = __importStar(__webpack_require__(1));
const glob = __importStar(__webpack_require__(281));
const fs = __importStar(__webpack_require__(747)); const fs = __importStar(__webpack_require__(747));
const path = __importStar(__webpack_require__(622)); const path = __importStar(__webpack_require__(622));
const util = __importStar(__webpack_require__(669)); const util = __importStar(__webpack_require__(669));
@ -5016,7 +5016,6 @@ function createTar(archiveFolder, sourceDirectories) {
"-cz", "-cz",
"-f", "-f",
constants_1.CacheFilename, constants_1.CacheFilename,
"-P",
"-C", "-C",
workingDirectory, workingDirectory,
"--files-from", "--files-from",

9
dist/save/index.js vendored
View file

@ -2182,12 +2182,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(__webpack_require__(470)); const core = __importStar(__webpack_require__(470));
const fs = __importStar(__webpack_require__(747));
const crypto = __importStar(__webpack_require__(417));
const http_client_1 = __webpack_require__(539); const http_client_1 = __webpack_require__(539);
const auth_1 = __webpack_require__(226); const auth_1 = __webpack_require__(226);
const crypto = __importStar(__webpack_require__(417));
const fs = __importStar(__webpack_require__(747));
const constants_1 = __webpack_require__(694);
const utils = __importStar(__webpack_require__(443)); const utils = __importStar(__webpack_require__(443));
const constants_1 = __webpack_require__(694);
const versionSalt = "1.0"; const versionSalt = "1.0";
function isSuccessStatusCode(statusCode) { function isSuccessStatusCode(statusCode) {
if (!statusCode) { if (!statusCode) {
@ -3185,8 +3185,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(__webpack_require__(470)); const core = __importStar(__webpack_require__(470));
const glob = __importStar(__webpack_require__(281));
const io = __importStar(__webpack_require__(1)); const io = __importStar(__webpack_require__(1));
const glob = __importStar(__webpack_require__(281));
const fs = __importStar(__webpack_require__(747)); const fs = __importStar(__webpack_require__(747));
const path = __importStar(__webpack_require__(622)); const path = __importStar(__webpack_require__(622));
const util = __importStar(__webpack_require__(669)); const util = __importStar(__webpack_require__(669));
@ -4993,7 +4993,6 @@ function createTar(archiveFolder, sourceDirectories) {
"-cz", "-cz",
"-f", "-f",
constants_1.CacheFilename, constants_1.CacheFilename,
"-P",
"-C", "-C",
workingDirectory, workingDirectory,
"--files-from", "--files-from",

View file

@ -59,7 +59,6 @@ export async function createTar(
"-cz", "-cz",
"-f", "-f",
CacheFilename, CacheFilename,
"-P",
"-C", "-C",
workingDirectory, workingDirectory,
"--files-from", "--files-from",