Binary file not shown.
|
Before Width: | Height: | Size: 134 KiB After Width: | Height: | Size: 121 KiB |
@@ -9,7 +9,7 @@ type Props = {
|
||||
}
|
||||
export const LandingSection = ({ title, children, className, sectionLink, description }: Props) => {
|
||||
return (
|
||||
<div className={cx('container-xl px-3 px-md-6', className)} id={sectionLink}>
|
||||
<div className={cx('container-xl px-3 px-md-6 mt-6', className)} id={sectionLink}>
|
||||
{title && (
|
||||
<h2 className={cx('h1 color-fg-default', !description ? 'mb-3' : 'mb-4')}>
|
||||
{sectionLink ? (
|
||||
|
||||
@@ -180,7 +180,11 @@ const article: PlaygroundArticleT = {
|
||||
type: 'sub-section',
|
||||
title: 'Example caching dependencies',
|
||||
content: dedent`
|
||||
When using GitHub-hosted runners, you can cache dependencies using a unique key, and restore the dependencies when you run future workflows using the \`cache\` action. For more information, see [Caching dependencies to speed up workflows](/actions/guides/caching-dependencies-to-speed-up-workflows) and the [\`cache\` action](https://github.com/marketplace/actions/cache).
|
||||
|
||||
When using GitHub-hosted runners, you can cache and restore the dependencies using the [\`setup-node\` action](https://github.com/actions/setup-node). To cache dependencies with the \`setup-node\` action, you must have a \`package-lock.json\`, \`yarn.lock\`, or \`pnpm-lock.yaml\` file in the root of the repository.
|
||||
|
||||
If you have a custom requirement or need finer controls for caching, you can use the [\`cache\` action](https://github.com/marketplace/actions/cache). For more information, see [Caching dependencies to speed up workflows](/actions/guides/caching-dependencies-to-speed-up-workflows) and the [\`cache\` action](https://github.com/marketplace/actions/cache).
|
||||
|
||||
`,
|
||||
},
|
||||
{
|
||||
@@ -493,15 +497,7 @@ const article: PlaygroundArticleT = {
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: '12.x'
|
||||
- name: Cache Node.js modules
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
# npm cache files are stored in \`~/.npm\` on Linux/macOS
|
||||
path: ~/.npm
|
||||
key: \${{ runner.OS }}-node-\${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
\${{ runner.OS }}-node-
|
||||
\${{ runner.OS }}-
|
||||
cache: 'npm'
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
`,
|
||||
|
||||
@@ -136,11 +136,11 @@ const article: PlaygroundArticleT = {
|
||||
},
|
||||
title: 'Caching Dependencies',
|
||||
content: dedent`
|
||||
When using GitHub-hosted runners, you can cache pip dependencies using a unique key, and restore the dependencies when you run future workflows using the [\`cache\`](https://github.com/marketplace/actions/cache) action. For more information, see "[Caching dependencies to speed up workflows](/actions/guides/caching-dependencies-to-speed-up-workflows)."
|
||||
|
||||
Pip caches dependencies in different locations, depending on the operating system of the runner. The path you'll need to cache may differ from the Ubuntu example shown depending on the operating system you use. For more information, see [Python caching examples](https://github.com/actions/cache/blob/main/examples.md#python---pip).
|
||||
When using GitHub-hosted runners, you can cache and restore the dependencies using the [\`setup-python\` action](https://github.com/actions/setup-python). By default, the \`setup-python\` action searches for the dependency file (\`requirements.txt\` for pip or \`Pipfile.lock\` for pipenv) in the whole repository.
|
||||
|
||||
If you have a custom requirement or need finer controls for caching, you can use the [\`cache\` action](https://github.com/marketplace/actions/cache). Pip caches dependencies in different locations, depending on the operating system of the runner. The path you'll need to cache may differ from the Ubuntu example shown here, depending on the operating system you use. For more information, see [Caching dependencies to speed up workflows](/actions/guides/caching-dependencies-to-speed-up-workflows) and the [\`cache\` action](https://github.com/marketplace/actions/cache).
|
||||
|
||||
**Note:** Depending on the number of dependencies, it may be faster to use the dependency cache. Projects with many large dependencies should see a performance increase as it cuts down the time required for downloading. Projects with fewer dependencies may not see a significant performance increase and may even see a slight decrease due to how pip installs cached dependencies. The performance varies from project to project.
|
||||
`,
|
||||
},
|
||||
{
|
||||
@@ -392,16 +392,7 @@ const article: PlaygroundArticleT = {
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Cache pip
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
# This path is specific to Ubuntu
|
||||
path: ~/.cache/pip
|
||||
# Look to see if there is a cache hit for the corresponding requirements file
|
||||
key: \${{ runner.os }}-pip-\${{ hashFiles('requirements.txt') }}
|
||||
restore-keys: |
|
||||
\${{ runner.os }}-pip-
|
||||
\${{ runner.os }}-
|
||||
cache: 'pip'
|
||||
- name: Install dependencies
|
||||
run: pip install -r requirements.txt
|
||||
`,
|
||||
|
||||
@@ -23,11 +23,34 @@ Jobs on {% data variables.product.prodname_dotcom %}-hosted runners start in a c
|
||||
|
||||
To cache dependencies for a job, you'll need to use {% data variables.product.prodname_dotcom %}'s `cache` action. The action retrieves a cache identified by a unique key. For more information, see [`actions/cache`](https://github.com/actions/cache).
|
||||
|
||||
If you are caching Ruby gems, instead consider using the Ruby maintained action, which can cache bundle installs on initiation. For more information, see [`ruby/setup-ruby`](https://github.com/ruby/setup-ruby#caching-bundle-install-automatically).
|
||||
If you are caching the package managers listed below, consider using the respective setup-* actions, which require almost zero configuration and are easy to use.
|
||||
|
||||
To cache and restore dependencies for npm, Yarn, or pnpm, you can use the [`actions/setup-node` action](https://github.com/actions/setup-node).
|
||||
|
||||
Gradle and Maven caching is available with [`actions/setup-java` action](https://github.com/actions/setup-java).
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Package managers</th>
|
||||
<th>setup-* action for caching</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>npm, yarn, pnpm</td>
|
||||
<td><a href="https://github.com/actions/setup-node">setup-node</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>pip, pipenv</td>
|
||||
<td><a href="https://github.com/actions/setup-python">setup-python</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>gradle, maven</td>
|
||||
<td><a href="https://github.com/actions/setup-java">setup-java</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ruby gems</td>
|
||||
<td><a href="https://github.com/ruby/setup-ruby">setup-ruby</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% warning %}
|
||||
|
||||
|
||||
@@ -288,7 +288,7 @@ steps:
|
||||
- run: pnpm test
|
||||
```
|
||||
|
||||
To cache dependencies, you must have a `package-lock.json`, `yarn.lock`, or `pnpm-lock.yaml` file in the root of the repository. If you need more flexible customization, you can use the [`cache` action](https://github.com/marketplace/actions/cache). For more information, see "<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">Caching dependencies to speed up workflows</a>".
|
||||
If you have a custom requirement or need finer controls for caching, you can use the [`cache` action](https://github.com/marketplace/actions/cache). For more information, see "<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">Caching dependencies to speed up workflows</a>".
|
||||
|
||||
## Building and testing your code
|
||||
|
||||
|
||||
@@ -241,38 +241,24 @@ steps:
|
||||
|
||||
### Caching Dependencies
|
||||
|
||||
When using {% data variables.product.prodname_dotcom %}-hosted runners, you can cache pip dependencies using a unique key, and restore the dependencies when you run future workflows using the [`cache`](https://github.com/marketplace/actions/cache) action. For more information, see "<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">Caching dependencies to speed up workflows</a>."
|
||||
When using {% data variables.product.prodname_dotcom %}-hosted runners, you can cache and restore the dependencies using the [`setup-python` action](https://github.com/actions/setup-python).
|
||||
|
||||
Pip caches dependencies in different locations, depending on the operating system of the runner. The path you'll need to cache may differ from the Ubuntu example below depending on the operating system you use. For more information, see [Python caching examples](https://github.com/actions/cache/blob/main/examples.md#python---pip).
|
||||
The following example caches dependencies for pip.
|
||||
|
||||
{% raw %}
|
||||
```yaml{:copy}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v2
|
||||
- uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Cache pip
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
# This path is specific to Ubuntu
|
||||
path: ~/.cache/pip
|
||||
# Look to see if there is a cache hit for the corresponding requirements file
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
${{ runner.os }}-
|
||||
- name: Install dependencies
|
||||
run: pip install -r requirements.txt
|
||||
python-version: '3.9'
|
||||
cache: 'pip'
|
||||
- run: pip install -r requirements.txt
|
||||
- run: pip test
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
{% note %}
|
||||
By default, the `setup-python` action searches for the dependency file (`requirements.txt` for pip or `Pipfile.lock` for pipenv) in the whole repository. For more information, see "<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">Caching packages dependencies</a>" in the `setup-python` actions README.
|
||||
|
||||
**Note:** Depending on the number of dependencies, it may be faster to use the dependency cache. Projects with many large dependencies should see a performance increase as it cuts down the time required for downloading. Projects with fewer dependencies may not see a significant performance increase and may even see a slight decrease due to how pip installs cached dependencies. The performance varies from project to project.
|
||||
|
||||
{% endnote %}
|
||||
If you have a custom requirement or need finer controls for caching, you can use the [`cache` action](https://github.com/marketplace/actions/cache). Pip caches dependencies in different locations, depending on the operating system of the runner. The path you'll need to cache may differ from the Ubuntu example above, depending on the operating system you use. For more information, see [Python caching examples](https://github.com/actions/cache/blob/main/examples.md#python---pip) in the `cache` action repository.
|
||||
|
||||
## Testing your code
|
||||
|
||||
|
||||
@@ -128,8 +128,8 @@ To configure whether workflows in an internal repository can be accessed from ou
|
||||
1. Under **Access**, choose one of the access settings:
|
||||

|
||||
* **Not accessible** - Workflows in other repositories can't use workflows in this repository.
|
||||
* **Repositories in the <organization name> organization can access** - Workflows in other repositories can use workflows in this repository if they belong to the same organization and their visibility is private or internal.
|
||||
* **Repositories in any organization belong to the <enterprise name> enterprise can access** - Workflows in other repositories can use workflows in this repository if they belong to the same enterprise and their visibility is private or internal.
|
||||
* **Accessible from repositories in the '<organization name>' organization** - Workflows in other repositories can use workflows in this repository if they are part of the same organization and their visibility is private or internal.
|
||||
* **Accessible from repositories in the '<enterprise name>' enterprise** - Workflows in other repositories can use workflows in this repository if they are part of the same enterprise and their visibility is private or internal.
|
||||
1. Click **Save** to apply the settings.
|
||||
{% endif %}
|
||||
|
||||
|
||||
9
package-lock.json
generated
9
package-lock.json
generated
@@ -7,7 +7,6 @@
|
||||
"name": "docs.github.com",
|
||||
"license": "(MIT AND CC-BY-4.0)",
|
||||
"dependencies": {
|
||||
"@alex_neo/jest-expect-message": "^1.0.5",
|
||||
"@github/failbot": "0.7.0",
|
||||
"@hapi/accept": "^5.0.2",
|
||||
"@primer/components": "^31.1.0",
|
||||
@@ -65,7 +64,6 @@
|
||||
"rate-limit-redis": "^2.1.0",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-is": "^17.0.2",
|
||||
"react-markdown": "^7.1.0",
|
||||
"react-syntax-highlighter": "^15.4.4",
|
||||
"redis": "^3.1.2",
|
||||
@@ -98,6 +96,7 @@
|
||||
"devDependencies": {
|
||||
"@actions/core": "^1.6.0",
|
||||
"@actions/github": "^5.0.0",
|
||||
"@alex_neo/jest-expect-message": "^1.0.5",
|
||||
"@babel/core": "^7.16.0",
|
||||
"@babel/eslint-parser": "^7.16.3",
|
||||
"@babel/plugin-syntax-top-level-await": "^7.14.5",
|
||||
@@ -221,7 +220,8 @@
|
||||
"node_modules/@alex_neo/jest-expect-message": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@alex_neo/jest-expect-message/-/jest-expect-message-1.0.5.tgz",
|
||||
"integrity": "sha512-1eBykZCd0pPGl5qKtV6Z5ARA6yuhXzHsVN2h5GH5/H6svYa37Jr7vMio5OFpiw1LBHtscrZs7amSkZkcwm0cvQ=="
|
||||
"integrity": "sha512-1eBykZCd0pPGl5qKtV6Z5ARA6yuhXzHsVN2h5GH5/H6svYa37Jr7vMio5OFpiw1LBHtscrZs7amSkZkcwm0cvQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@babel/code-frame": {
|
||||
"version": "7.16.0",
|
||||
@@ -22585,7 +22585,8 @@
|
||||
"@alex_neo/jest-expect-message": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@alex_neo/jest-expect-message/-/jest-expect-message-1.0.5.tgz",
|
||||
"integrity": "sha512-1eBykZCd0pPGl5qKtV6Z5ARA6yuhXzHsVN2h5GH5/H6svYa37Jr7vMio5OFpiw1LBHtscrZs7amSkZkcwm0cvQ=="
|
||||
"integrity": "sha512-1eBykZCd0pPGl5qKtV6Z5ARA6yuhXzHsVN2h5GH5/H6svYa37Jr7vMio5OFpiw1LBHtscrZs7amSkZkcwm0cvQ==",
|
||||
"dev": true
|
||||
},
|
||||
"@babel/code-frame": {
|
||||
"version": "7.16.0",
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
".next/cache"
|
||||
],
|
||||
"dependencies": {
|
||||
"@alex_neo/jest-expect-message": "^1.0.5",
|
||||
"@github/failbot": "0.7.0",
|
||||
"@hapi/accept": "^5.0.2",
|
||||
"@primer/components": "^31.1.0",
|
||||
@@ -67,7 +66,6 @@
|
||||
"rate-limit-redis": "^2.1.0",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-is": "^17.0.2",
|
||||
"react-markdown": "^7.1.0",
|
||||
"react-syntax-highlighter": "^15.4.4",
|
||||
"redis": "^3.1.2",
|
||||
@@ -100,6 +98,7 @@
|
||||
"devDependencies": {
|
||||
"@actions/core": "^1.6.0",
|
||||
"@actions/github": "^5.0.0",
|
||||
"@alex_neo/jest-expect-message": "^1.0.5",
|
||||
"@babel/core": "^7.16.0",
|
||||
"@babel/eslint-parser": "^7.16.3",
|
||||
"@babel/plugin-syntax-top-level-await": "^7.14.5",
|
||||
|
||||
Reference in New Issue
Block a user