mirror of https://github.com/actions/cache.git
Compare commits
28 Commits
3e58125b06
...
32f3b4ee94
Author | SHA1 | Date |
---|---|---|
evandrocoan | 32f3b4ee94 | |
Bassem Dghaidi | 6849a64899 | |
Bassem Dghaidi | 5a1720c49e | |
Bassem Dghaidi | d9fef48d24 | |
Bassem Dghaidi | a50e8d027b | |
Bassem Dghaidi | acc9ae5c14 | |
Bassem Dghaidi | 1ea5f18c31 | |
Bassem Dghaidi | cc679ff3ba | |
Bassem Dghaidi | 366d43d6f8 | |
dependabot[bot] | 02bf31969b | |
Bassem Dghaidi | 6f6220be5a | |
Bassem Dghaidi | ebdd24ede1 | |
dependabot[bot] | 255c8ff306 | |
Bassem Dghaidi | 010f24cd9d | |
Bassem Dghaidi | d6151ba7db | |
dependabot[bot] | 4ca7071576 | |
dependabot[bot] | 5d692d65f4 | |
Bassem Dghaidi | 3aef79d3a3 | |
Bassem Dghaidi | aa55e5f344 | |
Bassem Dghaidi | 772385291f | |
Bassem Dghaidi | e5dc90df92 | |
dependabot[bot] | 8585f2ac5c | |
Bassem Dghaidi | 9803087a86 | |
John Wesley Walker III | e7e2547a88 | |
John Wesley Walker III | 71d826cc33 | |
John Wesley Walker III | 25942a73ac | |
John Wesley Walker III | d73025053b | |
evandrocoan | 75e8752022 |
|
@ -0,0 +1,22 @@
|
|||
# To get started with Dependabot version updates, you'll need to specify which
|
||||
# package ecosystems to update and where the package manifests are located.
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
groups:
|
||||
minor-actions-dependencies:
|
||||
update-types: [minor, patch]
|
||||
|
||||
- package-ecosystem: "npm"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
allow:
|
||||
- dependency-type: direct
|
||||
- dependency-type: production
|
|
@ -10,7 +10,7 @@ jobs:
|
|||
issues: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/stale@v3
|
||||
- uses: actions/stale@v9
|
||||
with:
|
||||
days-before-issue-stale: 200
|
||||
days-before-issue-close: 5
|
||||
|
|
|
@ -17,11 +17,11 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
uses: github/codeql-action/init@v3
|
||||
# Override language selection by uncommenting this and choosing your languages
|
||||
# with:
|
||||
# languages: go, javascript, csharp, python, cpp, java, ruby
|
||||
|
@ -29,7 +29,7 @@ jobs:
|
|||
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below).
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v2
|
||||
uses: github/codeql-action/autobuild@v3
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
||||
|
@ -43,4 +43,4 @@ jobs:
|
|||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
uses: github/codeql-action/analyze@v3
|
||||
|
|
|
@ -20,9 +20,9 @@ jobs:
|
|||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Node.js 20.x
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20.x
|
||||
cache: npm
|
||||
|
@ -43,7 +43,7 @@ jobs:
|
|||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Generate files in working directory
|
||||
shell: bash
|
||||
run: __tests__/create-cache-files.sh ${{ runner.os }} test-cache
|
||||
|
@ -66,7 +66,7 @@ jobs:
|
|||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Restore cache
|
||||
uses: ./
|
||||
with:
|
||||
|
@ -96,7 +96,7 @@ jobs:
|
|||
https_proxy: http://squid-proxy:3128
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Generate files
|
||||
run: __tests__/create-cache-files.sh proxy test-cache
|
||||
- name: Save cache
|
||||
|
@ -119,7 +119,7 @@ jobs:
|
|||
https_proxy: http://squid-proxy:3128
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Restore cache
|
||||
uses: ./
|
||||
with:
|
||||
|
|
|
@ -1,9 +1,16 @@
|
|||
# Releases
|
||||
|
||||
### 4.1.2
|
||||
|
||||
- Add GitHub Enterprise Cloud instances hostname filters to inform API endpoint choices - [#1474](https://github.com/actions/cache/pull/1474)
|
||||
- Security fix: Bump braces from 3.0.2 to 3.0.3 - [#1475](https://github.com/actions/cache/pull/1475)
|
||||
|
||||
### 4.1.1
|
||||
|
||||
- Restore original behavior of `cache-hit` output - [#1467](https://github.com/actions/cache/pull/1467)
|
||||
|
||||
### 4.1.0
|
||||
|
||||
- Ensure `cache-hit` output is set when a cache is missed - [#1404](https://github.com/actions/cache/pull/1404)
|
||||
- Deprecate `save-always` input - [#1452](https://github.com/actions/cache/pull/1452)
|
||||
|
||||
|
|
|
@ -8,17 +8,26 @@ import * as testUtils from "../src/utils/testUtils";
|
|||
jest.mock("@actions/core");
|
||||
jest.mock("@actions/cache");
|
||||
|
||||
let pristineEnv: NodeJS.ProcessEnv;
|
||||
|
||||
beforeAll(() => {
|
||||
pristineEnv = process.env;
|
||||
jest.spyOn(core, "getInput").mockImplementation((name, options) => {
|
||||
return jest.requireActual("@actions/core").getInput(name, options);
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
process.env = pristineEnv;
|
||||
delete process.env[Events.Key];
|
||||
delete process.env[RefKey];
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
process.env = pristineEnv;
|
||||
});
|
||||
|
||||
test("isGhes returns true if server url is not github.com", () => {
|
||||
try {
|
||||
process.env["GITHUB_SERVER_URL"] = "http://example.com";
|
||||
|
@ -231,3 +240,28 @@ test("isCacheFeatureAvailable for ac disabled on dotcom", () => {
|
|||
delete process.env["GITHUB_SERVER_URL"];
|
||||
}
|
||||
});
|
||||
|
||||
test("isGhes returns false when the GITHUB_SERVER_URL environment variable is not defined", async () => {
|
||||
delete process.env["GITHUB_SERVER_URL"];
|
||||
expect(actionUtils.isGhes()).toBeFalsy();
|
||||
});
|
||||
|
||||
test("isGhes returns false when the GITHUB_SERVER_URL environment variable is set to github.com", async () => {
|
||||
process.env["GITHUB_SERVER_URL"] = "https://github.com";
|
||||
expect(actionUtils.isGhes()).toBeFalsy();
|
||||
});
|
||||
|
||||
test("isGhes returns false when the GITHUB_SERVER_URL environment variable is set to a GitHub Enterprise Cloud-style URL", async () => {
|
||||
process.env["GITHUB_SERVER_URL"] = "https://contoso.ghe.com";
|
||||
expect(actionUtils.isGhes()).toBeFalsy();
|
||||
});
|
||||
|
||||
test("isGhes returns false when the GITHUB_SERVER_URL environment variable has a .localhost suffix", async () => {
|
||||
process.env["GITHUB_SERVER_URL"] = "https://mock-github.localhost";
|
||||
expect(actionUtils.isGhes()).toBeFalsy();
|
||||
});
|
||||
|
||||
test("isGhes returns true when the GITHUB_SERVER_URL environment variable is set to some other URL", async () => {
|
||||
process.env["GITHUB_SERVER_URL"] = "https://src.onpremise.fabrikam.com";
|
||||
expect(actionUtils.isGhes()).toBeTruthy();
|
||||
});
|
||||
|
|
|
@ -59586,7 +59586,11 @@ const core = __importStar(__nccwpck_require__(2186));
|
|||
const constants_1 = __nccwpck_require__(9042);
|
||||
function isGhes() {
|
||||
const ghUrl = new URL(process.env["GITHUB_SERVER_URL"] || "https://github.com");
|
||||
return ghUrl.hostname.toUpperCase() !== "GITHUB.COM";
|
||||
const hostname = ghUrl.hostname.trimEnd().toUpperCase();
|
||||
const isGitHubHost = hostname === "GITHUB.COM";
|
||||
const isGitHubEnterpriseCloudHost = hostname.endsWith(".GHE.COM");
|
||||
const isLocalHost = hostname.endsWith(".LOCALHOST");
|
||||
return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost;
|
||||
}
|
||||
exports.isGhes = isGhes;
|
||||
function isExactKeyMatch(key, cacheKey) {
|
||||
|
|
|
@ -59586,7 +59586,11 @@ const core = __importStar(__nccwpck_require__(2186));
|
|||
const constants_1 = __nccwpck_require__(9042);
|
||||
function isGhes() {
|
||||
const ghUrl = new URL(process.env["GITHUB_SERVER_URL"] || "https://github.com");
|
||||
return ghUrl.hostname.toUpperCase() !== "GITHUB.COM";
|
||||
const hostname = ghUrl.hostname.trimEnd().toUpperCase();
|
||||
const isGitHubHost = hostname === "GITHUB.COM";
|
||||
const isGitHubEnterpriseCloudHost = hostname.endsWith(".GHE.COM");
|
||||
const isLocalHost = hostname.endsWith(".LOCALHOST");
|
||||
return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost;
|
||||
}
|
||||
exports.isGhes = isGhes;
|
||||
function isExactKeyMatch(key, cacheKey) {
|
||||
|
|
|
@ -59599,7 +59599,11 @@ const core = __importStar(__nccwpck_require__(2186));
|
|||
const constants_1 = __nccwpck_require__(9042);
|
||||
function isGhes() {
|
||||
const ghUrl = new URL(process.env["GITHUB_SERVER_URL"] || "https://github.com");
|
||||
return ghUrl.hostname.toUpperCase() !== "GITHUB.COM";
|
||||
const hostname = ghUrl.hostname.trimEnd().toUpperCase();
|
||||
const isGitHubHost = hostname === "GITHUB.COM";
|
||||
const isGitHubEnterpriseCloudHost = hostname.endsWith(".GHE.COM");
|
||||
const isLocalHost = hostname.endsWith(".LOCALHOST");
|
||||
return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost;
|
||||
}
|
||||
exports.isGhes = isGhes;
|
||||
function isExactKeyMatch(key, cacheKey) {
|
||||
|
|
|
@ -59599,7 +59599,11 @@ const core = __importStar(__nccwpck_require__(2186));
|
|||
const constants_1 = __nccwpck_require__(9042);
|
||||
function isGhes() {
|
||||
const ghUrl = new URL(process.env["GITHUB_SERVER_URL"] || "https://github.com");
|
||||
return ghUrl.hostname.toUpperCase() !== "GITHUB.COM";
|
||||
const hostname = ghUrl.hostname.trimEnd().toUpperCase();
|
||||
const isGitHubHost = hostname === "GITHUB.COM";
|
||||
const isGitHubEnterpriseCloudHost = hostname.endsWith(".GHE.COM");
|
||||
const isLocalHost = hostname.endsWith(".LOCALHOST");
|
||||
return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost;
|
||||
}
|
||||
exports.isGhes = isGhes;
|
||||
function isExactKeyMatch(key, cacheKey) {
|
||||
|
|
69
examples.md
69
examples.md
|
@ -621,6 +621,75 @@ whenever possible:
|
|||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||
```
|
||||
|
||||
### Multiple OS with a build matrix
|
||||
|
||||
```yml
|
||||
name: CI
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
name: Test ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
SEP: /
|
||||
PIP_WHEELS_DIR: ~/.cache/pip
|
||||
CARGO_INDEX_DIR: ~/.cargo/git
|
||||
CARGO_REGISTRY_DIR: ~/.cargo/registry
|
||||
|
||||
- os: macos-latest
|
||||
SEP: /
|
||||
PIP_WHEELS_DIR: ~/Library/Caches/pip
|
||||
CARGO_INDEX_DIR: ~/.cargo/git
|
||||
CARGO_REGISTRY_DIR: ~/.cargo/registry
|
||||
|
||||
- os: windows-latest
|
||||
SEP: \
|
||||
PIP_WHEELS_DIR: ~\AppData\Local\pip\Cache
|
||||
CARGO_INDEX_DIR: C:\Rust\.cargo\git
|
||||
CARGO_REGISTRY_DIR: C:\Rust\.cargo\registry
|
||||
|
||||
# Keep running all matrices if something fail
|
||||
fail-fast: false
|
||||
|
||||
steps:
|
||||
- name: Cache pip wheels
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ${{ matrix.PIP_WHEELS_DIR }}
|
||||
key: ${{ runner.os }}-pip-wheels-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/setup.py') }}-14-
|
||||
|
||||
- name: Cache cargo index
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ${{ matrix.CARGO_INDEX_DIR }}
|
||||
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.toml') }}-14-
|
||||
|
||||
- name: Cache cargo registry
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ${{ matrix.CARGO_REGISTRY_DIR }}
|
||||
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.toml') }}-14-
|
||||
|
||||
- name: Cache cargo target
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ${{ github.workspace }}${{ matrix.SEP }}target
|
||||
key: ${{ runner.os }}-cargo-target-${{ hashFiles('**/Cargo.toml') }}-14-
|
||||
|
||||
- name: Run on Windows
|
||||
if: matrix.os == 'windows-latest'
|
||||
run: echo Windows
|
||||
|
||||
- name: Run on Linux
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
run: echo Linux
|
||||
```
|
||||
|
||||
## Scala - SBT
|
||||
|
||||
```yaml
|
||||
|
|
|
@ -3521,12 +3521,12 @@
|
|||
}
|
||||
},
|
||||
"node_modules/braces": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
|
||||
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
|
||||
"integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"fill-range": "^7.0.1"
|
||||
"fill-range": "^7.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
|
@ -4622,9 +4622,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/fill-range": {
|
||||
"version": "7.0.1",
|
||||
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
|
||||
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
|
||||
"version": "7.1.1",
|
||||
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
|
||||
"integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"to-regex-range": "^5.0.1"
|
||||
|
@ -12302,12 +12302,12 @@
|
|||
}
|
||||
},
|
||||
"braces": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
|
||||
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
|
||||
"integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"fill-range": "^7.0.1"
|
||||
"fill-range": "^7.1.1"
|
||||
}
|
||||
},
|
||||
"browserslist": {
|
||||
|
@ -13127,9 +13127,9 @@
|
|||
}
|
||||
},
|
||||
"fill-range": {
|
||||
"version": "7.0.1",
|
||||
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
|
||||
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
|
||||
"version": "7.1.1",
|
||||
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
|
||||
"integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"to-regex-range": "^5.0.1"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "cache",
|
||||
"version": "4.1.1",
|
||||
"version": "4.1.2",
|
||||
"private": true,
|
||||
"description": "Cache dependencies and build outputs",
|
||||
"main": "dist/restore/index.js",
|
||||
|
@ -48,4 +48,4 @@
|
|||
"ts-jest": "^28.0.8",
|
||||
"typescript": "^4.9.3"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,7 +7,13 @@ export function isGhes(): boolean {
|
|||
const ghUrl = new URL(
|
||||
process.env["GITHUB_SERVER_URL"] || "https://github.com"
|
||||
);
|
||||
return ghUrl.hostname.toUpperCase() !== "GITHUB.COM";
|
||||
|
||||
const hostname = ghUrl.hostname.trimEnd().toUpperCase();
|
||||
const isGitHubHost = hostname === "GITHUB.COM";
|
||||
const isGitHubEnterpriseCloudHost = hostname.endsWith(".GHE.COM");
|
||||
const isLocalHost = hostname.endsWith(".LOCALHOST");
|
||||
|
||||
return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost;
|
||||
}
|
||||
|
||||
export function isExactKeyMatch(key: string, cacheKey?: string): boolean {
|
||||
|
|
Loading…
Reference in New Issue