Skip to content

Improvements, and Complete Blockera repository CI/CD workflows #8

Improvements, and Complete Blockera repository CI/CD workflows

Improvements, and Complete Blockera repository CI/CD workflows #8

name: Build Blockera Plugin Tests
on:
pull_request:
types: [opened, synchronize, ready_for_review]
workflow_dispatch:
# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true
jobs:
build_tests:
name: Building and Run E2E Tests
runs-on: ubuntu-latest
if: ${{ github.repository == 'blockeraai/blockera' || github.event_name == 'pull_request' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js and install dependencies
uses: ./.github/setup-node
- name: Install Composer dependencies
uses: ramsey/composer-install@v2
with:
custom-cache-suffix: $(/bin/date -u --date='last Mon' "+%F")
composer-options: '--no-dev -o --apcu-autoloader -a'
- name: Build Plugin Zip File
uses: ./.github/build-plugin-zip
with:
with-wp-env-json: '.wp-env.json'
- name: Extract blockera.zip to build directory
run: |
mkdir build
unzip blockera.zip -d ./build/blockera
rm -rf blockera.zip
- name: Create Requirements
run: |
cd ./build/blockera
touch .wp-env.json
echo '{"plugins": ["."]}' >> .wp-env.json
cat .wp-env.json
mkdir packages
cd ../..
cp -r ./cypress ./build/blockera
cp ./package.json ./build/blockera
cp -r ./node_modules ./build/blockera
cp ./cypress.config.js ./build/blockera
cp -r ./packages/dev-cypress ./build/blockera/packages
- name: Update Cypress Specs Patterns
run: |
cp ./cypress.env-example.json ./build/blockera/cypress.env.json
cp ./bin/update-cypress-env-specs.sh ./build/blockera
cd ./build/blockera
chmod +x ./update-cypress-env-specs.sh
./update-cypress-env-specs.sh
cd ../..
- name: Setup and Run E2E tests on Blockera build
run: |
cd ./build/blockera
npx cypress install
npm run env:start
npm run test:e2e
npm run env:stop