[Feat] Assets & testnets #1839
Workflow file for this run
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
name: CI | |
on: | |
pull_request: | |
branches: | |
- master | |
paths: | |
- '**.js' | |
- '**.ts' | |
- '**.tsx' | |
- '**.css' | |
- '**.json' | |
- '**.html' | |
- '**.nvmrc' | |
- '!package.json' | |
- '!public/manifest.json' | |
- '!release-notes.json' | |
env: | |
BLOCK_WALLET_URL: url.txt | |
BLOCK_WALLET_FOLDER: blockwallet-build | |
S3_PATH: s3://releases.blockwallet.io/tmp/ | |
CYPRESS_CACHE_FOLDER: cypress/cache | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
if: startsWith(github.head_ref, 'dependabot/') == false | |
steps: | |
- name: Checkout monorepo | |
uses: actions/checkout@v3 | |
- name: Install node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: .nvmrc | |
registry-url: https://npm.pkg.github.com | |
- name: Install yarn | |
run: | | |
npm install --global yarn | |
- name: Dependency UI cache | |
uses: actions/cache@v3 | |
with: | |
path: 'packages/ui/node_modules' | |
key: ${{ runner.os }}-modules-v1-${{ hashFiles('packages/ui/yarn.lock') }} | |
- name: Dependency Background cache | |
uses: actions/cache@v3 | |
with: | |
path: 'packages/background/node_modules' | |
key: ${{ runner.os }}-modules-v1-${{ hashFiles('packages/background/yarn.lock') }} | |
- name: Dependency Provider cache | |
uses: actions/cache@v3 | |
with: | |
path: 'packages/provider/node_modules' | |
key: ${{ runner.os }}-modules-v1-${{ hashFiles('packages/provider/yarn.lock') }} | |
- name: Install packages dependencies | |
run: | | |
make install/ci | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT }} | |
- name: Check lint in all the packages | |
run: | | |
echo "::group::UI" | |
cd packages/ui/ | |
if yarn lint; then | |
echo "::notice:: UI lint OK" | |
lint_ui=0 | |
else | |
echo '::error:: UI lint failed. Run "yarn lint:fix" in the folder "packages/ui/" to fix it and commit your changes.' | |
lint_ui=1 | |
fi | |
echo "::endgroup::" | |
echo "::group::Background" | |
cd .. | |
cd background/ | |
if yarn lint; then | |
echo "::notice:: Background lint OK" | |
lint_background=0 | |
else | |
echo '::error:: Background lint failed. Run "yarn lint:fix" in the folder "packages/background/" to fix it and commit your changes.' | |
lint_background=1 | |
fi | |
echo "::endgroup::" | |
echo "::group::Provider" | |
cd .. | |
cd provider/ | |
if yarn lint; then | |
echo "::notice:: Provider lint OK" | |
lint_provider=0 | |
else | |
echo '::error:: Provider lint failed. Run "yarn lint:fix" in the folder "packages/provider/" to fix it and commit your changes.' | |
lint_provider=1 | |
fi | |
echo "::endgroup::" | |
if [[ "$lint_ui" -ne "0" || "$lint_background" -ne "0" || "$lint_provider" -ne "0" ]]; then | |
exit 1 | |
fi | |
test: | |
runs-on: ubuntu-latest | |
if: startsWith(github.head_ref, 'dependabot/') == false | |
steps: | |
- name: Checkout monorepo | |
uses: actions/checkout@v3 | |
- name: Install node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: .nvmrc | |
registry-url: https://npm.pkg.github.com | |
- name: Install yarn | |
run: | | |
npm install --global yarn | |
- name: Dependency UI cache | |
uses: actions/cache@v3 | |
with: | |
path: 'packages/ui/node_modules' | |
key: ${{ runner.os }}-modules-v1-${{ hashFiles('packages/ui/yarn.lock') }} | |
- name: Dependency Background cache | |
uses: actions/cache@v3 | |
with: | |
path: 'packages/background/node_modules' | |
key: ${{ runner.os }}-modules-v1-${{ hashFiles('packages/background/yarn.lock') }} | |
- name: Dependency Provider cache | |
uses: actions/cache@v3 | |
with: | |
path: 'packages/provider/node_modules' | |
key: ${{ runner.os }}-modules-v1-${{ hashFiles('packages/provider/yarn.lock') }} | |
- name: Install packages dependencies | |
run: | | |
make install/ci | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT }} | |
- name: Build tailwind | |
run: | | |
cd packages/ui | |
yarn build:tailwind | |
- name: Test ui | |
run: | | |
cd packages/ui | |
make test/ui | |
env: | |
INFURA_PROJECT_ID: ${{ secrets.INFURA_PROJECT_ID }} | |
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }} | |
- name: Test provider | |
run: | | |
cd packages/provider | |
make test/provider | |
- name: Test background | |
run: | | |
cd packages/background | |
make test/background | |
build: | |
needs: [test, lint] | |
env: | |
ENVIRONMENT: prod | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout monorepo | |
uses: actions/checkout@v3 | |
- name: Install node | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: .nvmrc | |
registry-url: https://npm.pkg.github.com | |
- name: Install yarn | |
run: | | |
npm install --global yarn | |
- name: Dependency UI cache | |
uses: actions/cache@v3 | |
with: | |
path: 'packages/ui/node_modules' | |
key: ${{ runner.os }}-modules-v1-${{ hashFiles('packages/ui/yarn.lock') }} | |
- name: Dependency Background cache | |
uses: actions/cache@v3 | |
with: | |
path: 'packages/background/node_modules' | |
key: ${{ runner.os }}-modules-v1-${{ hashFiles('packages/background/yarn.lock') }} | |
- name: Dependency Provider cache | |
uses: actions/cache@v3 | |
with: | |
path: 'packages/provider/node_modules' | |
key: ${{ runner.os }}-modules-v1-${{ hashFiles('packages/provider/yarn.lock') }} | |
- name: Install packages dependencies | |
run: | | |
make install/ci | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT }} | |
- name: Build extension | |
env: | |
CI: false | |
run: | | |
make build/prod | |
- name: Zip build | |
if: startsWith(github.head_ref, 'dependabot/') == false | |
id: zip | |
run: | | |
file=block-wallet-${GITHUB_SHA::7} | |
zip -r -D $file dist/ | |
echo "::set-output name=file::$file.zip" | |
- name: Configure AWS credentials | |
if: startsWith(github.head_ref, 'dependabot/') == false | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_RELEASE_BUCKET }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_RELEASE_BUCKET }} | |
aws-region: us-east-2 | |
- name: Upload zip to S3 | |
if: startsWith(github.head_ref, 'dependabot/') == false | |
run: | | |
zip=${{ steps.zip.outputs.file }} | |
aws s3 cp $zip $S3_PATH | |
s3_url_https=$(echo "${S3_PATH/s3/https}") | |
echo "$s3_url_https""$zip" > $BLOCK_WALLET_URL | |
cat $BLOCK_WALLET_URL | |
- name: Save extension url | |
if: startsWith(github.head_ref, 'dependabot/') == false | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.BLOCK_WALLET_FOLDER }} | |
if-no-files-found: error | |
path: ${{ env.BLOCK_WALLET_URL }} |