Skip to content

Upgrade to React 18 #267

Upgrade to React 18

Upgrade to React 18 #267

name: Check tree-shakeability
on: [ pull_request ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
pull-requests: write
concurrency: ci-treeshake-${{ github.ref }}
steps:
- uses: actions/checkout@v2
- name: Setup Node.js with Yarn cache
uses: actions/setup-node@v2
with:
node-version: '14'
cache: 'yarn'
- name: Install dependencies
run: yarn --frozen-lockfile
- name: Build artifacts
run: yarn build
- name: Run agadoo
id: agadoo
run: |
# Run Agadoo and store the output for further usage
# We store the process stdout and stderr to tmp files
STDOUT_F=$(mktemp)
STDERR_F=$(mktemp)
# Run agadoo and capture errors without breaking the workflow
$(npx agadoo 2> $STDERR_F > $STDOUT_F) && true
# Infer the result from the first word of the last line
RET="$(cat $STDERR_F | tail -1 | cut -d' ' -f 1)"
# In order to be used in GH actions `echo "::set-output` the
# multi-line output must be escaped.
STDOUT="$(cat $STDOUT_F)"
STDOUT="${STDOUT//'%'/%25}"
STDOUT="${STDOUT//$'\n'/%0A}"
STDOUT="${STDOUT//$'\r'/%0D}"
STDERR="$(cat $STDERR_F)"
STDERR="${STDERR//'%'/%25}"
STDERR="${STDERR//$'\n'/%0A}"
STDERR="${STDERR//$'\r'/%0D}"
echo "::set-output name=stdout::$STDOUT"
echo "::set-output name=stderr::$STDERR"
if [[ $RET == 'Success!' ]]; then
echo "::set-output name=status::tree-shakeable"
else
echo "::set-output name=status::not tree-shakeable"
fi
echo "$STDOUT"
echo ""
echo "$STDERR"
# Clean-up
rm $STDOUT_F
rm $STDERR_F
exit 0
- name: Fail if cannot tree-shake
if: ${{ steps.agadoo.outputs.status == 'not tree-shakeable' }}
run: exit 1