From 143c84bf60d4045445bec7e92e40a1f7bb66382a Mon Sep 17 00:00:00 2001 From: alivahabi2112 Date: Sun, 12 Apr 2020 06:13:41 +0430 Subject: [PATCH] Revert "Fix caching directories outside of the working directory (relative paths)" --- .github/workflows/workflow.yml | 28 ++++++++-------------------- __tests__/create-cache-files.sh | 10 ++-------- __tests__/tar.test.ts | 1 - __tests__/verify-cache-files.sh | 10 ++-------- dist/restore/index.js | 9 ++++----- dist/save/index.js | 9 ++++----- src/tar.ts | 1 - 7 files changed, 20 insertions(+), 48 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index c97fe95..c394023 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -51,30 +51,23 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macOS-latest] - fail-fast: false runs-on: ${{ matrix.os }} steps: - name: Checkout uses: actions/checkout@v2 - - name: Generate files in working directory + - name: Generate files shell: bash - run: __tests__/create-cache-files.sh ${{ runner.os }} test-cache - - name: Generate files outside working directory - shell: bash - run: __tests__/create-cache-files.sh ${{ runner.os }} ~/test-cache + run: __tests__/create-cache-files.sh ${{ runner.os }} - name: Save cache uses: ./ with: key: test-${{ runner.os }}-${{ github.run_id }} - path: | - test-cache - ~/test-cache + path: test-cache test-restore: needs: test-save strategy: matrix: os: [ubuntu-latest, windows-latest, macOS-latest] - fail-fast: false runs-on: ${{ matrix.os }} steps: - name: Checkout @@ -83,15 +76,10 @@ jobs: uses: ./ with: key: test-${{ runner.os }}-${{ github.run_id }} - path: | - test-cache - ~/test-cache - - name: Verify cache files in working directory + path: test-cache + - name: Verify cache shell: bash - run: __tests__/verify-cache-files.sh ${{ runner.os }} test-cache - - name: Verify cache files outside working directory - shell: bash - run: __tests__/verify-cache-files.sh ${{ runner.os }} ~/test-cache + run: __tests__/verify-cache-files.sh ${{ runner.os }} # End to end with proxy test-proxy-save: @@ -110,7 +98,7 @@ jobs: - name: Checkout uses: actions/checkout@v2 - name: Generate files - run: __tests__/create-cache-files.sh proxy test-cache + run: __tests__/create-cache-files.sh proxy - name: Save cache uses: ./ with: @@ -138,4 +126,4 @@ jobs: key: test-proxy-${{ github.run_id }} path: test-cache - name: Verify cache - run: __tests__/verify-cache-files.sh proxy test-cache + run: __tests__/verify-cache-files.sh proxy diff --git a/__tests__/create-cache-files.sh b/__tests__/create-cache-files.sh index 0ce4140..885a5f2 100755 --- a/__tests__/create-cache-files.sh +++ b/__tests__/create-cache-files.sh @@ -7,11 +7,5 @@ if [ -z "$prefix" ]; then exit 1 fi -path="$2" -if [ -z "$path" ]; then - echo "Must supply path argument" - exit 1 -fi - -mkdir -p $path -echo "$prefix $GITHUB_RUN_ID" > $path/test-file.txt +mkdir test-cache +echo "$prefix $GITHUB_RUN_ID" > test-cache/test-file.txt \ No newline at end of file diff --git a/__tests__/tar.test.ts b/__tests__/tar.test.ts index ca10f34..fdf637a 100644 --- a/__tests__/tar.test.ts +++ b/__tests__/tar.test.ts @@ -73,7 +73,6 @@ test("create tar", async () => { "-cz", "-f", CacheFilename, - "-P", "-C", workspace, "--files-from", diff --git a/__tests__/verify-cache-files.sh b/__tests__/verify-cache-files.sh index 3ee8a84..c7b75ae 100755 --- a/__tests__/verify-cache-files.sh +++ b/__tests__/verify-cache-files.sh @@ -7,12 +7,6 @@ if [ -z "$prefix" ]; then exit 1 fi -path="$2" -if [ -z "$path" ]; then - echo "Must specify path argument" - exit 1 -fi - # Sanity check GITHUB_RUN_ID defined if [ -z "$GITHUB_RUN_ID" ]; then echo "GITHUB_RUN_ID not defined" @@ -20,7 +14,7 @@ if [ -z "$GITHUB_RUN_ID" ]; then fi # Verify file exists -file="$path/test-file.txt" +file="test-cache/test-file.txt" echo "Checking for $file" if [ ! -e $file ]; then 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 echo "Unexpected file content" exit 1 -fi +fi \ No newline at end of file diff --git a/dist/restore/index.js b/dist/restore/index.js index 2e71724..ac49982 100644 --- a/dist/restore/index.js +++ b/dist/restore/index.js @@ -2182,12 +2182,12 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); 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 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 constants_1 = __webpack_require__(694); const versionSalt = "1.0"; function isSuccessStatusCode(statusCode) { if (!statusCode) { @@ -3185,8 +3185,8 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); const core = __importStar(__webpack_require__(470)); -const glob = __importStar(__webpack_require__(281)); const io = __importStar(__webpack_require__(1)); +const glob = __importStar(__webpack_require__(281)); const fs = __importStar(__webpack_require__(747)); const path = __importStar(__webpack_require__(622)); const util = __importStar(__webpack_require__(669)); @@ -5016,7 +5016,6 @@ function createTar(archiveFolder, sourceDirectories) { "-cz", "-f", constants_1.CacheFilename, - "-P", "-C", workingDirectory, "--files-from", diff --git a/dist/save/index.js b/dist/save/index.js index f807389..ca454ed 100644 --- a/dist/save/index.js +++ b/dist/save/index.js @@ -2182,12 +2182,12 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); 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 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 constants_1 = __webpack_require__(694); const versionSalt = "1.0"; function isSuccessStatusCode(statusCode) { if (!statusCode) { @@ -3185,8 +3185,8 @@ var __importStar = (this && this.__importStar) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); const core = __importStar(__webpack_require__(470)); -const glob = __importStar(__webpack_require__(281)); const io = __importStar(__webpack_require__(1)); +const glob = __importStar(__webpack_require__(281)); const fs = __importStar(__webpack_require__(747)); const path = __importStar(__webpack_require__(622)); const util = __importStar(__webpack_require__(669)); @@ -4993,7 +4993,6 @@ function createTar(archiveFolder, sourceDirectories) { "-cz", "-f", constants_1.CacheFilename, - "-P", "-C", workingDirectory, "--files-from", diff --git a/src/tar.ts b/src/tar.ts index 9a1f446..3ca3019 100644 --- a/src/tar.ts +++ b/src/tar.ts @@ -59,7 +59,6 @@ export async function createTar( "-cz", "-f", CacheFilename, - "-P", "-C", workingDirectory, "--files-from",