Skip to content

trying updated workflowfile (thanks cline) #2

trying updated workflowfile (thanks cline)

trying updated workflowfile (thanks cline) #2

Workflow file for this run

name: Makefile CI
on:
push:
branches: [ "horizon" ]
pull_request:
branches: [ "horizon" ]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'npm'
- name: Install Chrome and ChromeDriver
run: |
# Get latest stable Chrome version
export CHROME_VERSION=$(curl -s https://googlechromelabs.github.io/chrome-for-testing/LATEST_RELEASE_STABLE)
echo "Chrome version: $CHROME_VERSION"
# Download Chrome and ChromeDriver
curl -L https://storage.googleapis.com/chrome-for-testing-public/$CHROME_VERSION/linux64/chrome-linux64.zip -o chrome-linux64.zip
curl -L https://storage.googleapis.com/chrome-for-testing-public/$CHROME_VERSION/linux64/chromedriver-linux64.zip -o chromedriver-linux64.zip
# Extract Chrome
unzip chrome-linux64.zip
# Set Chrome binary path for tests
echo "GOOGLE_CHROME_BINARY=./chrome-linux64/chrome" >> $GITHUB_ENV
- name: Update Pyret to newest version
run: npm update pyret-lang
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Install ChromeDriver with specific binary
run: |
npm install chromedriver --chromedriver_filepath=$PWD/chromedriver-linux64.zip
npm install -g chromedriver --chromedriver_filepath=$PWD/chromedriver-linux64.zip
- name: Add node_modules/.bin to PATH
run: echo "$PWD/node_modules/.bin" >> $GITHUB_PATH
- name: Build web assets
run: make web
- name: Deploy CPO main
run: make deploy-cpo-main
- name: Set up test environment variables
run: |
echo "TEST_LOC=local" >> $GITHUB_ENV
echo "BASE_URL=http://localhost:5000" >> $GITHUB_ENV
echo "SESSION_SECRET=not-so-secret-for-testing" >> $GITHUB_ENV
echo "PYRET=http://localhost:5000/js/cpo-main.jarr" >> $GITHUB_ENV
echo "PORT=5000" >> $GITHUB_ENV
echo "POSTMESSAGE_ORIGIN=*" >> $GITHUB_ENV
echo "SHARED_FETCH_SERVER=https://code.pyret.org" >> $GITHUB_ENV
- name: Start application server
run: |
# Start the server in background
node src/run.js &
# Wait for server to be ready
sleep 3
# Verify server is running
curl -f http://localhost:5000 || (echo "Server failed to start" && exit 1)
- name: Run tests
run: |
# Set up virtual display for headless browser testing
export DISPLAY=:99
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
# Wait a bit more for everything to be ready
sleep 3
# Run tests based on event type
if [ "${{ github.event_name }}" = "pull_request" ]; then
echo "Running PR tests (excluding modules)"
npx mocha --grep modules --invert
else
echo "Running all tests"
npx mocha
fi