Fix reuse #42
This file contains hidden or 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
name: Code verify | |
concurrency: | |
group: code-PR-verify-${{ github.event.pull_request.number }} | |
cancel-in-progress: true | |
on: | |
pull_request: | |
paths: | |
- "code/**" | |
- ".github/workflows/code*" | |
env: | |
NEXT_PUBLIC_API_ENDPOINT: ${{ vars.NEXT_PUBLIC_API_ENDPOINT }} | |
NEXT_PUBLIC_API_ENDPOINT_HUB_NAME: ${{ vars.NEXT_PUBLIC_API_ENDPOINT_HUB_NAME }} | |
BACKEND_ENDPOINT: "http://weavejs-backend" | |
jobs: | |
unit-tests: | |
name: Code / Verify | |
timeout-minutes: 60 | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout / Branch Head | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: NPM / Setup Dependencies Cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: asdf / Setup Dependencies Cache | |
uses: actions/cache@v4 | |
id: asdf-cache | |
with: | |
path: ~/.asdf/data | |
key: ${{ runner.os }}-asdf-${{ hashFiles('**/.tool-versions') }} | |
restore-keys: | | |
${{ runner.os }}-asdf- | |
- name: Save tool-versions content | |
run: | | |
{ | |
echo "TOOL_VERSIONS<<EOF" | |
cat code/.tool-versions | |
echo "EOF" | |
} >> "$GITHUB_ENV" | |
- name: NPM / Setup asdf environment | |
uses: asdf-vm/actions/install@v3 | |
# https://github.com/asdf-vm/actions/issues/356 | |
if: steps.asdf-cache.outputs.cache-hit != 'true' | |
with: | |
tool_versions: ${{ env.TOOL_VERSIONS }} | |
- name: NPM / Create Cache Folders | |
run: | | |
mkdir -p "$HOME"/.npm | |
mkdir -p "$HOME"/.asdf/data | |
- name: Create .env.production file | |
working-directory: code | |
run: | | |
touch .env.production | |
echo NEXT_PUBLIC_API_ENDPOINT=${{ env.NEXT_PUBLIC_API_ENDPOINT }} >> .env.production | |
echo NEXT_PUBLIC_API_ENDPOINT_HUB_NAME=${{ env.NEXT_PUBLIC_API_ENDPOINT_HUB_NAME }} >> .env.production | |
echo BACKEND_ENDPOINT=${{ env.BACKEND_ENDPOINT }} >> .env.production | |
cat .env.production | |
- name: NPM / Verify | |
working-directory: code | |
run: | | |
npm run verify | |
- name: Store project information | |
id: version | |
run: | | |
echo "app-version=$(jq ".version" code/package.json)" >> "$GITHUB_OUTPUT" | |
echo "app-name=$(yq -oy '.name' code/package.json)" >> "$GITHUB_OUTPUT" | |
echo "github-repository=$(echo $GITHUB_REPOSITORY | cut -d'/' -f2)" >> "$GITHUB_OUTPUT" |