Skip to content

Merge pull request #594 from dbp/readme-port-fix #12

Merge pull request #594 from dbp/readme-port-fix

Merge pull request #594 from dbp/readme-port-fix #12

Workflow file for this run

name: Makefile CI
on:
push:
branches: [ "horizon" ]
pull_request:
branches: [ "horizon" ]
jobs:
build-and-test:
runs-on: ubuntu-latest
timeout-minutes: 30
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 "GOOGLE_CLIENT_ID=" >> $GITHUB_ENV
echo "GOOGLE_CLIENT_SECRET=" >> $GITHUB_ENV
echo "GOOGLE_API_KEY=" >> $GITHUB_ENV
echo "GOOGLE_SERVER_API_KEY=" >> $GITHUB_ENV
echo "GOOGLE_APP_ID=" >> $GITHUB_ENV
echo "BASE_URL=http://localhost:4999" >> $GITHUB_ENV
echo "LOG_URL=http://localhost:5002" >> $GITHUB_ENV
echo "SESSION_SECRET=not-so-secret" >> $GITHUB_ENV
echo "REDISCLOUD_URL=" >> $GITHUB_ENV
echo "CURRENT_PYRET_RELEASE=" >> $GITHUB_ENV
echo "PYRET=http://localhost:4999/js/cpo-main.jarr" >> $GITHUB_ENV
echo "PORT=4999" >> $GITHUB_ENV
echo "NODE_ENV=development" >> $GITHUB_ENV
echo "SHARED_FETCH_SERVER=https://code.pyret.org" >> $GITHUB_ENV
echo "URL_FILE_MODE=all-remote" >> $GITHUB_ENV
echo "IMAGE_PROXY_BYPASS=true" >> $GITHUB_ENV
echo "POSTMESSAGE_ORIGIN=*" >> $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:4999 || (echo "Server failed to start" && exit 1)
- name: Run tests
run: |
# 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)"
npm run mocha -- --grep modules --invert
else
echo "Running all tests"
npm run mocha
fi