Add extension build CI job #9

Merged
dboreham merged 6 commits from dboreham/add-extension-build-job into main 2024-06-04 16:55:15 +00:00
3 changed files with 89 additions and 1 deletions

View File

@ -0,0 +1,50 @@
name: Build metamask extension
on:
pull_request:
branches: '*'
push:
branches:
- main
jobs:
test:
name: "Build metamask extension"
runs-on: ubuntu-latest
steps:
- name: "Clone project repository"
uses: actions/checkout@v3
# At present the stock setup-python action fails on Linux/aarch64
# Conditional steps below workaroud this by using deadsnakes for that case only
- name: "Install Python for ARM on Linux"
if: ${{ runner.arch == 'arm64' && runner.os == 'Linux' }}
uses: deadsnakes/action@v3.0.1
with:
python-version: '3.8'
- name: "Install Python cases other than ARM on Linux"
if: ${{ ! (runner.arch == 'arm64' && runner.os == 'Linux') }}
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: "Print Python version"
run: python3 --version
- name: "Install yarn"
run: npm install --global yarn
- name: "Set Gitea access token"
env:
TOKEN: ${{ secrets.CICD_REPO_TOKEN }}
run: |
git config --global url."https://$TOKEN:@git.vdb.to/".insteadOf https://git.vdb.to/
- name: "Install stack orchestrator"
run: ./scripts/install-so.sh
- name: "Install NodeJS"
# Project needs Node > 20 while the executor container comes with 18
uses: actions/setup-node@v4
with:
node-version: 20
- name: "Run build"
run: |
# CI must be set false to allow webpack to work
unset CI
PATH=$PATH:~/bin
./build/build-metamask-extension.sh

View File

@ -0,0 +1,38 @@
#!/usr/bin/env bash
set -e
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
SO_COMMAND=laconic-so
test_name="DIN payments stack deploy test"
echo "Running ${test_name}"
stack_name=$(pwd)/stack-orchestrator/stacks/din-payments
test_fail_exit () {
local fail_message=$1
echo "${test_name}: ${fail_message}"
echo "${test_name}: FAILED"
exit 1
}
# Sanity check the stack dir exists
if [ ! -d "${stack_name}" ]; then
test_fail_exit "stack directory not present"
exit 1
fi
# Set a non-default repo dir
export CERC_REPO_BASE_DIR=~/stack-orchestrator-test/repo-base-dir
echo "Cloning repositories into: $CERC_REPO_BASE_DIR"
rm -rf $CERC_REPO_BASE_DIR
mkdir -p $CERC_REPO_BASE_DIR
$SO_COMMAND --quiet --stack ${stack_name} setup-repositories
echo "Running build script"
cd ${CERC_REPO_BASE_DIR}/metamask-extension
./nitro-build.sh dist

View File

@ -32,7 +32,7 @@ echo "Cloning repositories into: $CERC_REPO_BASE_DIR"
rm -rf $CERC_REPO_BASE_DIR
mkdir -p $CERC_REPO_BASE_DIR
$SO_COMMAND --stack ${stack_name} setup-repositories
$SO_COMMAND --quiet --stack ${stack_name} setup-repositories
echo "Building containers"
$SO_COMMAND --stack ${stack_name} build-containers