Merge pull request #134 from saiichihashimoto/dependabot/npm_and_yarn… #180
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions | |
name: "Checks" | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
permissions: | |
contents: read | |
concurrency: checks-${{ github.ref == 'refs/heads/main' && 'main' || github.event.pull_request.head.sha }} | |
jobs: | |
build: | |
name: Build & Lint | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
id-token: write | |
issues: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- uses: actions/setup-node@v4.0.2 | |
with: | |
node-version-file: "package.json" | |
cache: "npm" | |
- id: node-modules | |
uses: actions/cache@v4 | |
with: | |
path: | | |
node_modules | |
packages/*/node_modules | |
key: node-modules-${{ hashFiles('package-lock.json') }} | |
- if: steps.node-modules.outputs.cache-hit != 'true' | |
run: npm ci --ignore-scripts | |
- run: | | |
DRY_RUN=$(npx turbo run build --dry=json) | |
HASH_PRETTIER_PLUGIN=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@standard-configs/prettier-plugin#build\")) | .hash") | |
HASH_PRETTIER_PLUGIN_AVA=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@standard-configs/prettier-plugin-ava#build\")) | .hash") | |
HASH_PRETTIER_PLUGIN_BABEL=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@standard-configs/prettier-plugin-babel#build\")) | .hash") | |
HASH_PRETTIER_PLUGIN_BOWER=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@standard-configs/prettier-plugin-bower#build\")) | .hash") | |
HASH_PRETTIER_PLUGIN_DEPENDABOT=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@standard-configs/prettier-plugin-dependabot#build\")) | .hash") | |
HASH_PRETTIER_PLUGIN_ESLINT=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@standard-configs/prettier-plugin-eslint#build\")) | .hash") | |
HASH_PRETTIER_PLUGIN_FIREBASE=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@standard-configs/prettier-plugin-firebase#build\")) | .hash") | |
HASH_PRETTIER_PLUGIN_GIT=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@standard-configs/prettier-plugin-git#build\")) | .hash") | |
HASH_PRETTIER_PLUGIN_GIT_HOOKS=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@standard-configs/prettier-plugin-git-hooks#build\")) | .hash") | |
HASH_PRETTIER_PLUGIN_GITHUB=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@standard-configs/prettier-plugin-github#build\")) | .hash") | |
HASH_PRETTIER_PLUGIN_NPM=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@standard-configs/prettier-plugin-npm#build\")) | .hash") | |
HASH_PRETTIER_PLUGIN_PACKAGE_JSON=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@standard-configs/prettier-plugin-package-json#build\")) | .hash") | |
HASH_PRETTIER_PLUGIN_PRETTIER=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@standard-configs/prettier-plugin-prettier#build\")) | .hash") | |
HASH_PRETTIER_PLUGIN_PROBOT_AUTO_ASSIGN=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@standard-configs/prettier-plugin-probot-auto-assign#build\")) | .hash") | |
HASH_PRETTIER_PLUGIN_PROBOT_SETTINGS=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@standard-configs/prettier-plugin-probot-settings#build\")) | .hash") | |
HASH_PRETTIER_PLUGIN_SANITY=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@standard-configs/prettier-plugin-sanity#build\")) | .hash") | |
HASH_PRETTIER_PLUGIN_SEMANTIC_RELEASE=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@standard-configs/prettier-plugin-semantic-release#build\")) | .hash") | |
HASH_PRETTIER_PLUGIN_TSCONFIG=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@standard-configs/prettier-plugin-tsconfig#build\")) | .hash") | |
HASH_PRETTIER_PLUGIN_TSUP=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@standard-configs/prettier-plugin-tsup#build\")) | .hash") | |
HASH_PRETTIER_PLUGIN_VSCODE=$(echo $DRY_RUN | jq --raw-output ".tasks[] | select(.taskId | contains(\"@standard-configs/prettier-plugin-vscode#build\")) | .hash") | |
echo "HASH_PRETTIER_PLUGIN=$HASH_PRETTIER_PLUGIN" >> $GITHUB_ENV | |
echo "HASH_PRETTIER_PLUGIN_AVA=$HASH_PRETTIER_PLUGIN_AVA" >> $GITHUB_ENV | |
echo "HASH_PRETTIER_PLUGIN_BABEL=$HASH_PRETTIER_PLUGIN_BABEL" >> $GITHUB_ENV | |
echo "HASH_PRETTIER_PLUGIN_BOWER=$HASH_PRETTIER_PLUGIN_BOWER" >> $GITHUB_ENV | |
echo "HASH_PRETTIER_PLUGIN_DEPENDABOT=$HASH_PRETTIER_PLUGIN_DEPENDABOT" >> $GITHUB_ENV | |
echo "HASH_PRETTIER_PLUGIN_ESLINT=$HASH_PRETTIER_PLUGIN_ESLINT" >> $GITHUB_ENV | |
echo "HASH_PRETTIER_PLUGIN_FIREBASE=$HASH_PRETTIER_PLUGIN_FIREBASE" >> $GITHUB_ENV | |
echo "HASH_PRETTIER_PLUGIN_GIT=$HASH_PRETTIER_PLUGIN_GIT" >> $GITHUB_ENV | |
echo "HASH_PRETTIER_PLUGIN_GIT_HOOKS=$HASH_PRETTIER_PLUGIN_GIT_HOOKS" >> $GITHUB_ENV | |
echo "HASH_PRETTIER_PLUGIN_GITHUB=$HASH_PRETTIER_PLUGIN_GITHUB" >> $GITHUB_ENV | |
echo "HASH_PRETTIER_PLUGIN_NPM=$HASH_PRETTIER_PLUGIN_NPM" >> $GITHUB_ENV | |
echo "HASH_PRETTIER_PLUGIN_PACKAGE_JSON=$HASH_PRETTIER_PLUGIN_PACKAGE_JSON" >> $GITHUB_ENV | |
echo "HASH_PRETTIER_PLUGIN_PRETTIER=$HASH_PRETTIER_PLUGIN_PRETTIER" >> $GITHUB_ENV | |
echo "HASH_PRETTIER_PLUGIN_PROBOT_AUTO_ASSIGN=$HASH_PRETTIER_PLUGIN_PROBOT_AUTO_ASSIGN" >> $GITHUB_ENV | |
echo "HASH_PRETTIER_PLUGIN_PROBOT_SETTINGS=$HASH_PRETTIER_PLUGIN_PROBOT_SETTINGS" >> $GITHUB_ENV | |
echo "HASH_PRETTIER_PLUGIN_SANITY=$HASH_PRETTIER_PLUGIN_SANITY" >> $GITHUB_ENV | |
echo "HASH_PRETTIER_PLUGIN_SEMANTIC_RELEASE=$HASH_PRETTIER_PLUGIN_SEMANTIC_RELEASE" >> $GITHUB_ENV | |
echo "HASH_PRETTIER_PLUGIN_TSCONFIG=$HASH_PRETTIER_PLUGIN_TSCONFIG" >> $GITHUB_ENV | |
echo "HASH_PRETTIER_PLUGIN_TSUP=$HASH_PRETTIER_PLUGIN_TSUP" >> $GITHUB_ENV | |
echo "HASH_PRETTIER_PLUGIN_VSCODE=$HASH_PRETTIER_PLUGIN_VSCODE" >> $GITHUB_ENV | |
- uses: actions/cache@v4 | |
with: | |
path: node_modules/.cache/turbo/${{ env.HASH_PRETTIER_PLUGIN }}* | |
key: turbo-cache-${{ env.HASH_PRETTIER_PLUGIN }} | |
- uses: actions/cache@v4 | |
with: | |
path: node_modules/.cache/turbo/${{ env.HASH_PRETTIER_PLUGIN_AVA }}* | |
key: turbo-cache-${{ env.HASH_PRETTIER_PLUGIN_AVA }} | |
- uses: actions/cache@v4 | |
with: | |
path: node_modules/.cache/turbo/${{ env.HASH_PRETTIER_PLUGIN_BABEL }}* | |
key: turbo-cache-${{ env.HASH_PRETTIER_PLUGIN_BABEL }} | |
- uses: actions/cache@v4 | |
with: | |
path: node_modules/.cache/turbo/${{ env.HASH_PRETTIER_PLUGIN_BOWER }}* | |
key: turbo-cache-${{ env.HASH_PRETTIER_PLUGIN_BOWER }} | |
- uses: actions/cache@v4 | |
with: | |
path: node_modules/.cache/turbo/${{ env.HASH_PRETTIER_PLUGIN_DEPENDABOT }}* | |
key: turbo-cache-${{ env.HASH_PRETTIER_PLUGIN_DEPENDABOT }} | |
- uses: actions/cache@v4 | |
with: | |
path: node_modules/.cache/turbo/${{ env.HASH_PRETTIER_PLUGIN_ESLINT }}* | |
key: turbo-cache-${{ env.HASH_PRETTIER_PLUGIN_ESLINT }} | |
- uses: actions/cache@v4 | |
with: | |
path: node_modules/.cache/turbo/${{ env.HASH_PRETTIER_PLUGIN_FIREBASE }}* | |
key: turbo-cache-${{ env.HASH_PRETTIER_PLUGIN_FIREBASE }} | |
- uses: actions/cache@v4 | |
with: | |
path: node_modules/.cache/turbo/${{ env.HASH_PRETTIER_PLUGIN_GIT }}* | |
key: turbo-cache-${{ env.HASH_PRETTIER_PLUGIN_GIT }} | |
- uses: actions/cache@v4 | |
with: | |
path: node_modules/.cache/turbo/${{ env.HASH_PRETTIER_PLUGIN_GIT_HOOKS }}* | |
key: turbo-cache-${{ env.HASH_PRETTIER_PLUGIN_GIT_HOOKS }} | |
- uses: actions/cache@v4 | |
with: | |
path: node_modules/.cache/turbo/${{ env.HASH_PRETTIER_PLUGIN_GITHUB }}* | |
key: turbo-cache-${{ env.HASH_PRETTIER_PLUGIN_GITHUB }} | |
- uses: actions/cache@v4 | |
with: | |
path: node_modules/.cache/turbo/${{ env.HASH_PRETTIER_PLUGIN_NPM }}* | |
key: turbo-cache-${{ env.HASH_PRETTIER_PLUGIN_NPM }} | |
- uses: actions/cache@v4 | |
with: | |
path: node_modules/.cache/turbo/${{ env.HASH_PRETTIER_PLUGIN_PACKAGE_JSON }}* | |
key: turbo-cache-${{ env.HASH_PRETTIER_PLUGIN_PACKAGE_JSON }} | |
- uses: actions/cache@v4 | |
with: | |
path: node_modules/.cache/turbo/${{ env.HASH_PRETTIER_PLUGIN_PRETTIER }}* | |
key: turbo-cache-${{ env.HASH_PRETTIER_PLUGIN_PRETTIER }} | |
- uses: actions/cache@v4 | |
with: | |
path: node_modules/.cache/turbo/${{ env.HASH_PRETTIER_PLUGIN_PROBOT_AUTO_ASSIGN }}* | |
key: turbo-cache-${{ env.HASH_PRETTIER_PLUGIN_PROBOT_AUTO_ASSIGN }} | |
- uses: actions/cache@v4 | |
with: | |
path: node_modules/.cache/turbo/${{ env.HASH_PRETTIER_PLUGIN_PROBOT_SETTINGS }}* | |
key: turbo-cache-${{ env.HASH_PRETTIER_PLUGIN_PROBOT_SETTINGS }} | |
- uses: actions/cache@v4 | |
with: | |
path: node_modules/.cache/turbo/${{ env.HASH_PRETTIER_PLUGIN_SANITY }}* | |
key: turbo-cache-${{ env.HASH_PRETTIER_PLUGIN_SANITY }} | |
- uses: actions/cache@v4 | |
with: | |
path: node_modules/.cache/turbo/${{ env.HASH_PRETTIER_PLUGIN_SEMANTIC_RELEASE }}* | |
key: turbo-cache-${{ env.HASH_PRETTIER_PLUGIN_SEMANTIC_RELEASE }} | |
- uses: actions/cache@v4 | |
with: | |
path: node_modules/.cache/turbo/${{ env.HASH_PRETTIER_PLUGIN_TSCONFIG }}* | |
key: turbo-cache-${{ env.HASH_PRETTIER_PLUGIN_TSCONFIG }} | |
- uses: actions/cache@v4 | |
with: | |
path: node_modules/.cache/turbo/${{ env.HASH_PRETTIER_PLUGIN_TSUP }}* | |
key: turbo-cache-${{ env.HASH_PRETTIER_PLUGIN_TSUP }} | |
- uses: actions/cache@v4 | |
with: | |
path: node_modules/.cache/turbo/${{ env.HASH_PRETTIER_PLUGIN_VSCODE }}* | |
key: turbo-cache-${{ env.HASH_PRETTIER_PLUGIN_VSCODE }} | |
- env: | |
NODE_OPTIONS: "--max_old_space_size=4096" | |
run: npm run build | |
- uses: actions/cache@v4 | |
with: | |
path: .eslintcache | |
key: eslint-${{ github.run_id }} | |
restore-keys: | | |
eslint- | |
- uses: actions/cache@v4 | |
with: | |
path: node_modules/.cache/prettier/.prettier-cache | |
key: prettier-${{ github.run_id }} | |
restore-keys: | | |
prettier- | |
- uses: awalsh128/cache-apt-pkgs-action@v1 | |
with: | |
packages: moreutils | |
version: 1.0 | |
- run: npm run lint | |
- run: | | |
if [[ $(git status --porcelain) != "" ]]; then | |
git --no-pager diff --text HEAD | |
exit 1 | |
fi | |
- run: npm config set workspaces-update false | |
- env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: npx multi-semantic-release --ignore-private-packages | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: actions/setup-node@v4.0.2 | |
with: | |
node-version-file: "package.json" | |
cache: "npm" | |
- id: node-modules | |
uses: actions/cache@v4 | |
with: | |
path: | | |
node_modules | |
packages/*/node_modules | |
key: node-modules-${{ hashFiles('package-lock.json') }} | |
- if: steps.node-modules.outputs.cache-hit != 'true' | |
run: npm ci --ignore-scripts | |
- id: cpu-cores | |
uses: SimenB/github-actions-cpu-cores@v2 | |
- run: | | |
JEST_CACHE_DIRECTORY=$(npx jest --color --showConfig | jq --raw-output ".configs[0].cacheDirectory") | |
echo "JEST_CACHE_DIRECTORY=$JEST_CACHE_DIRECTORY" >> $GITHUB_ENV | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ env.JEST_CACHE_DIRECTORY }} | |
key: jest-${{ github.run_id }} | |
restore-keys: | | |
jest- | |
- run: npm test |