mirror of
https://github.com/withastro/astro.git
synced 2025-01-13 22:11:20 -05:00
GitHub Actions: add install action (#5196)
* GitHub Actions: add install action to reduce duplication * debug, temp * expect strings add warnings * minor, consistency Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
This commit is contained in:
parent
b6a478f376
commit
d7b27a17e3
10 changed files with 84 additions and 145 deletions
49
.github/actions/install/action.yml
vendored
Normal file
49
.github/actions/install/action.yml
vendored
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
name: Install Tools & Dependencies
|
||||||
|
description: Installs pnpm, JS runtime & package dependencies
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
node-version:
|
||||||
|
description: 'Node version'
|
||||||
|
required: false
|
||||||
|
default: '16'
|
||||||
|
js-runtime:
|
||||||
|
description: 'JS runtime'
|
||||||
|
required: false
|
||||||
|
default: 'node'
|
||||||
|
install-dependencies:
|
||||||
|
description: 'Install dependencies'
|
||||||
|
required: false
|
||||||
|
default: 'true'
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- name: Check inputs.js-runtime
|
||||||
|
if: ${{ !contains(fromJson('["node", "deno"]'), inputs.js-runtime) }}
|
||||||
|
run: echo "::warning::unknown 'js-runtime' value '${{ inputs.js-runtime }}'"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Check inputs.install-dependencies
|
||||||
|
if: ${{ !contains(fromJson('["true", "false"]'), inputs.install-dependencies) }}
|
||||||
|
run: echo "::warning::unknown 'install-dependencies' value '${{ inputs.install-dependencies }}'"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Setup pnpm
|
||||||
|
uses: pnpm/action-setup@v2.2.4
|
||||||
|
|
||||||
|
- name: Setup Node
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: ${{ inputs.node-version }}
|
||||||
|
cache: pnpm
|
||||||
|
|
||||||
|
- name: Use Deno
|
||||||
|
if: ${{ inputs.js-runtime == 'deno' }}
|
||||||
|
uses: denoland/setup-deno@v1
|
||||||
|
with:
|
||||||
|
deno-version: v1.26.1
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
if: ${{ fromJSON(inputs.install-dependencies) }}
|
||||||
|
run: pnpm install
|
||||||
|
shell: bash
|
19
.github/workflows/benchmark.yml
vendored
19
.github/workflows/benchmark.yml
vendored
|
@ -22,7 +22,7 @@ jobs:
|
||||||
MAIN-BENCH-16: ${{ steps.benchmark-main.outputs.BENCH_RESULT16 }}
|
MAIN-BENCH-16: ${{ steps.benchmark-main.outputs.BENCH_RESULT16 }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [14, 16]
|
NODE_VERSION: [14, 16]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
|
@ -30,17 +30,10 @@ jobs:
|
||||||
ref: ${{github.event.pull_request.head.sha}}
|
ref: ${{github.event.pull_request.head.sha}}
|
||||||
repository: ${{github.event.pull_request.head.repo.full_name}}
|
repository: ${{github.event.pull_request.head.repo.full_name}}
|
||||||
|
|
||||||
- name: Setup PNPM
|
- name: Install Tools & Dependencies
|
||||||
uses: pnpm/action-setup@v2.2.1
|
uses: ./.github/actions/install
|
||||||
|
|
||||||
- name: Setup Node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.NODE_VERSION }}
|
||||||
cache: 'pnpm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: pnpm install
|
|
||||||
|
|
||||||
- name: Build Packages
|
- name: Build Packages
|
||||||
run: pnpm run build
|
run: pnpm run build
|
||||||
|
@ -50,7 +43,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
pnpm run --silent benchmark > ./bench-result.md
|
pnpm run --silent benchmark > ./bench-result.md
|
||||||
result=$(awk '/requests in/' ./bench-result.md)
|
result=$(awk '/requests in/' ./bench-result.md)
|
||||||
echo "::set-output name=BENCH_RESULT${{matrix.node-version}}::$result"
|
echo "::set-output name=BENCH_RESULT${{matrix.NODE_VERSION}}::$result"
|
||||||
|
|
||||||
# main benchmark
|
# main benchmark
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
@ -70,7 +63,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
pnpm run --silent benchmark > ./bench-result.md
|
pnpm run --silent benchmark > ./bench-result.md
|
||||||
result=$(awk '/requests in/' ./bench-result.md)
|
result=$(awk '/requests in/' ./bench-result.md)
|
||||||
echo "::set-output name=BENCH_RESULT${{matrix.node-version}}::$result"
|
echo "::set-output name=BENCH_RESULT${{matrix.NODE_VERSION}}::$result"
|
||||||
|
|
||||||
output-benchmark:
|
output-benchmark:
|
||||||
if: ${{ github.repository_owner == 'withastro' && github.event.issue.pull_request && startsWith(github.event.comment.body, '!bench') }}
|
if: ${{ github.repository_owner == 'withastro' && github.event.issue.pull_request && startsWith(github.event.comment.body, '!bench') }}
|
||||||
|
|
13
.github/workflows/check.yml
vendored
13
.github/workflows/check.yml
vendored
|
@ -25,17 +25,8 @@ jobs:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Setup PNPM
|
- name: Install Tools & Dependencies
|
||||||
uses: pnpm/action-setup@v2.2.1
|
uses: ./.github/actions/install
|
||||||
|
|
||||||
- name: Setup Node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 16
|
|
||||||
cache: 'pnpm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: pnpm install
|
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: pnpm run build
|
run: pnpm run build
|
||||||
|
|
61
.github/workflows/ci.yml
vendored
61
.github/workflows/ci.yml
vendored
|
@ -32,17 +32,8 @@ jobs:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Setup PNPM
|
- name: Install Tools & Dependencies
|
||||||
uses: pnpm/action-setup@v2.2.1
|
uses: ./.github/actions/install
|
||||||
|
|
||||||
- name: Setup Node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 16
|
|
||||||
cache: 'pnpm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: pnpm install
|
|
||||||
|
|
||||||
- name: Status
|
- name: Status
|
||||||
run: git status
|
run: git status
|
||||||
|
@ -87,17 +78,10 @@ jobs:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Setup PNPM
|
- name: Install Tools & Dependencies
|
||||||
uses: pnpm/action-setup@v2.2.1
|
uses: ./.github/actions/install
|
||||||
|
|
||||||
- name: Setup node@${{ matrix.NODE_VERSION }}
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.NODE_VERSION }}
|
node-version: ${{ matrix.NODE_VERSION }}
|
||||||
cache: 'pnpm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: pnpm install
|
|
||||||
|
|
||||||
- name: Build Packages
|
- name: Build Packages
|
||||||
run: pnpm run build
|
run: pnpm run build
|
||||||
|
@ -121,22 +105,11 @@ jobs:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Setup PNPM
|
- name: Install Tools & Dependencies
|
||||||
uses: pnpm/action-setup@v2.2.1
|
uses: ./.github/actions/install
|
||||||
|
|
||||||
- name: Setup node@${{ matrix.NODE_VERSION }}
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.NODE_VERSION }}
|
node-version: ${{ matrix.NODE_VERSION }}
|
||||||
cache: 'pnpm'
|
js-runtime: deno
|
||||||
|
|
||||||
- name: Use Deno
|
|
||||||
uses: denoland/setup-deno@v1
|
|
||||||
with:
|
|
||||||
deno-version: v1.26.1
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: pnpm install
|
|
||||||
|
|
||||||
- name: Build Packages
|
- name: Build Packages
|
||||||
run: pnpm run build
|
run: pnpm run build
|
||||||
|
@ -160,17 +133,10 @@ jobs:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Setup PNPM
|
- name: Install Tools & Dependencies
|
||||||
uses: pnpm/action-setup@v2.2.1
|
uses: ./.github/actions/install
|
||||||
|
|
||||||
- name: Setup node@${{ matrix.NODE_VERSION }}
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.NODE_VERSION }}
|
node-version: ${{ matrix.NODE_VERSION }}
|
||||||
cache: 'pnpm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: pnpm install
|
|
||||||
|
|
||||||
- name: Build Packages
|
- name: Build Packages
|
||||||
run: pnpm run build
|
run: pnpm run build
|
||||||
|
@ -192,14 +158,11 @@ jobs:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Setup PNPM
|
- name: Install Tools & Dependencies
|
||||||
uses: pnpm/action-setup@v2.2.1
|
uses: ./.github/actions/install
|
||||||
|
|
||||||
- name: Setup node@${{ matrix.NODE_VERSION }}
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.NODE_VERSION }}
|
node-version: ${{ matrix.NODE_VERSION }}
|
||||||
cache: 'pnpm'
|
install-dependencies: false
|
||||||
|
|
||||||
- name: Checkout docs
|
- name: Checkout docs
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
11
.github/workflows/format.yml
vendored
11
.github/workflows/format.yml
vendored
|
@ -17,15 +17,8 @@ jobs:
|
||||||
ref: ${{ github.head_ref }}
|
ref: ${{ github.head_ref }}
|
||||||
# Needs access to push to main
|
# Needs access to push to main
|
||||||
token: ${{ secrets.FREDKBOT_GITHUB_TOKEN }}
|
token: ${{ secrets.FREDKBOT_GITHUB_TOKEN }}
|
||||||
- name: Setup PNPM
|
- name: Install Tools & Dependencies
|
||||||
uses: pnpm/action-setup@v2.2.1
|
uses: ./.github/actions/install
|
||||||
- name: Setup Node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 16
|
|
||||||
cache: 'pnpm'
|
|
||||||
- name: Install dependencies
|
|
||||||
run: pnpm install
|
|
||||||
- name: Format code
|
- name: Format code
|
||||||
run: pnpm run format:ci
|
run: pnpm run format:ci
|
||||||
- name: Commit changes
|
- name: Commit changes
|
||||||
|
|
13
.github/workflows/main.yml
vendored
13
.github/workflows/main.yml
vendored
|
@ -41,17 +41,8 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Setup PNPM
|
- name: Install Tools & Dependencies
|
||||||
uses: pnpm/action-setup@v2.2.1
|
uses: ./.github/actions/install
|
||||||
|
|
||||||
- name: Setup Node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 16
|
|
||||||
cache: 'pnpm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: pnpm install
|
|
||||||
|
|
||||||
- name: Check Modified
|
- name: Check Modified
|
||||||
run: pnpm exec changeset status --output ./status.json
|
run: pnpm exec changeset status --output ./status.json
|
||||||
|
|
23
.github/workflows/nightly.yml
vendored
23
.github/workflows/nightly.yml
vendored
|
@ -14,17 +14,8 @@ jobs:
|
||||||
- name: Check out code using Git
|
- name: Check out code using Git
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Setup PNPM
|
- name: Install Tools & Dependencies
|
||||||
uses: pnpm/action-setup@v2.2.1
|
uses: ./.github/actions/install
|
||||||
|
|
||||||
- name: Setup Node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 16
|
|
||||||
cache: 'pnpm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: pnpm install
|
|
||||||
|
|
||||||
- name: Collect stats
|
- name: Collect stats
|
||||||
run: node scripts/stats/index.js
|
run: node scripts/stats/index.js
|
||||||
|
@ -48,14 +39,10 @@ jobs:
|
||||||
- name: Check out code using Git
|
- name: Check out code using Git
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Setup PNPM
|
- name: Install Tools & Dependencies
|
||||||
uses: pnpm/action-setup@v2.2.1
|
uses: ./.github/actions/install
|
||||||
|
|
||||||
- name: Setup Node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
with:
|
||||||
node-version: 16
|
install-dependencies: false
|
||||||
cache: 'pnpm'
|
|
||||||
|
|
||||||
- name: Delete the existing pnpm-lock.yaml file
|
- name: Delete the existing pnpm-lock.yaml file
|
||||||
run: rm pnpm-lock.yaml
|
run: rm pnpm-lock.yaml
|
||||||
|
|
13
.github/workflows/release.yml
vendored
13
.github/workflows/release.yml
vendored
|
@ -22,17 +22,8 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Setup PNPM
|
- name: Install Tools & Dependencies
|
||||||
uses: pnpm/action-setup@v2.2.1
|
uses: ./.github/actions/install
|
||||||
|
|
||||||
- name: Setup Node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 16
|
|
||||||
cache: 'pnpm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: pnpm install
|
|
||||||
|
|
||||||
- name: Build Packages
|
- name: Build Packages
|
||||||
run: pnpm run build
|
run: pnpm run build
|
||||||
|
|
13
.github/workflows/scripts.yml
vendored
13
.github/workflows/scripts.yml
vendored
|
@ -30,17 +30,8 @@ jobs:
|
||||||
ref: main
|
ref: main
|
||||||
path: main
|
path: main
|
||||||
|
|
||||||
- name: Setup PNPM
|
- name: Install Tools & Dependencies
|
||||||
uses: pnpm/action-setup@v2.2.1
|
uses: ./.github/actions/install
|
||||||
|
|
||||||
- name: Setup Node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 16
|
|
||||||
cache: 'pnpm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: pnpm install
|
|
||||||
|
|
||||||
- name: Check Bundle Size
|
- name: Check Bundle Size
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v6
|
||||||
|
|
14
.github/workflows/snapshot-release.yml
vendored
14
.github/workflows/snapshot-release.yml
vendored
|
@ -51,18 +51,8 @@ jobs:
|
||||||
with:
|
with:
|
||||||
ref: ${{ steps.refs.outputs.head_ref }}
|
ref: ${{ steps.refs.outputs.head_ref }}
|
||||||
|
|
||||||
- name: Setup PNPM
|
- name: Install Tools & Dependencies
|
||||||
uses: pnpm/action-setup@v2.2.1
|
uses: ./.github/actions/install
|
||||||
|
|
||||||
- name: Setup Node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 16
|
|
||||||
registry-url: 'https://registry.npmjs.org'
|
|
||||||
cache: 'pnpm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: pnpm install
|
|
||||||
|
|
||||||
- name: Build Packages
|
- name: Build Packages
|
||||||
run: pnpm run build
|
run: pnpm run build
|
||||||
|
|
Loading…
Add table
Reference in a new issue