Skip to content

Test the CI with PR from a fork #7251

Test the CI with PR from a fork

Test the CI with PR from a fork #7251

Workflow file for this run

name: CI
on:
push: { branches: [dev, main] }
pull_request:
jobs:
install:
timeout-minutes: 10
strategy:
matrix: { node: ["18.x"], os: [ubuntu-latest] }
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- if: ${{ steps.yarn-cache.outputs.cache-hit != 'true' }}
name: Install dependencies
run: yarn --immutable
test:
if: false
needs: install
timeout-minutes: 60
strategy:
matrix: { node: ["18.x"], os: [ubuntu-latest] }
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn --immutable
- name: Verify linting
run: yarn lint
- name: Build Pioneer
run: yarn build
- name: Run tests
run: node --max_old_space_size=7000 --expose-gc $(yarn bin jest) --logHeapUsage --silent
working-directory: packages/ui
storybook-test:
needs: install
timeout-minutes: 60
strategy:
matrix: { node: ["18.x"], os: [ubuntu-latest] }
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
# - name: Get yarn cache directory path
# id: yarn-cache-dir-path
# run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
# - uses: actions/cache@v3
# with:
# path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
# restore-keys: |
# ${{ runner.os }}-yarn-
# - name: Install dependencies
# run: yarn --immutable
# - name: Install Playwright
# run: npx playwright install --with-deps
- name: Get branch names
id: branch-name
uses: tj-actions/branch-names@v7
- run: |
echo "${{ toJSON(steps.branch-name.outputs) }}"
echo "${{ toJSON(github.event.pull_request.head) }}"
echo "${{ github.repository }}"
echo "${{ github.repository_owner }}"
echo "${{ github.repositoryUrl }}"
echo "${{ github.ref }}"
- name: Get the Storybook preview deployment url
run: |
URL_BRANCH=$(echo "$BRANCH" | tr -d '#' | tr -c '[:alnum:]' '-' | tr '[:upper:]' '[:lower:]')
SUBDOMAIN="$PROJECT-$PREFIX-$URL_BRANCH-joystream"
if [ ${#LONG} -gt 63 ]; then
[ "$PREFIX" == 'git-fork' ] && BRANCH=$(echo "$BRANCH" | sed 's/:/-/')
HASH=$(echo -n "$PREFIX-$BRANCH$PROJECT" | sha256sum | head -c 6)
SUBDOMAIN="$(echo "$LONG" | head -c 46)-$HASH"
fi
echo "VERCEL_DEPLOYMENT_URL=$SUBDOMAIN.vercel.app" >> "$GITHUB_ENV"
env:
PROJECT: pioneer-2-storybook
PREFIX: ${{ github.event.pull_request.head.repo.fork && 'git-fork' || 'git' }}
BRANCH: ${{ github.event.pull_request.head.label || github.ref_name }}
- run: echo "$TARGET_URL"
env:
TARGET_URL: https://${{ env.VERCEL_DEPLOYMENT_URL }}
# - name: Wait for the deployment to complete
# run: |
# while true; do
# RES=$(curl -L "https://api.vercel.com/v13/deployments/${{ env.VERCEL_DEPLOYMENT_URL }}")
# ARR=($( \
# node \
# -e '
# const res = JSON.parse(process.argv[1]);
# process.stdout.write(`${res.status} ${res.meta.githubCommitSha}`);
# ' \
# "$RES" \
# ))
# STATUS=${ARR[0]}
# SHA=${ARR[1]}
# [ "$SHA" == "$COMMIT_SHA" ] && [ "$STATUS" == "READY" ] && break
# echo "Wait for the Storybook deployment..."
# sleep 20
# done
# env:
# COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
# - name: Run Storybook tests
# run: yarn workspace @joystream/pioneer test-storybook
# env:
# TARGET_URL: https://${{ env.VERCEL_DEPLOYMENT_URL }}