Skip to content

Commit 49def60

Browse files
committed
Merge branch 'ci'
2 parents 719337e + e700c2d commit 49def60

3 files changed

Lines changed: 156 additions & 0 deletions

File tree

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: code.pyret.org/ tests
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
jobs:
9+
build-and-test:
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 30
12+
defaults:
13+
run:
14+
working-directory: ./code.pyret.org
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Link pyret-lang
21+
run: |
22+
ln -s ../lang pyret
23+
cd ../lang && npm install && make phaseA-deps
24+
25+
- name: Set up Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: '24'
29+
30+
- name: Install Chrome and ChromeDriver
31+
run: |
32+
# Get latest stable Chrome version
33+
export CHROME_VERSION=$(curl -s https://googlechromelabs.github.io/chrome-for-testing/LATEST_RELEASE_STABLE)
34+
echo "Chrome version: $CHROME_VERSION"
35+
36+
# Download Chrome and ChromeDriver
37+
curl -L https://storage.googleapis.com/chrome-for-testing-public/$CHROME_VERSION/linux64/chrome-linux64.zip -o chrome-linux64.zip
38+
curl -L https://storage.googleapis.com/chrome-for-testing-public/$CHROME_VERSION/linux64/chromedriver-linux64.zip -o chromedriver-linux64.zip
39+
40+
# Extract Chrome
41+
unzip chrome-linux64.zip
42+
43+
# Set Chrome binary path for tests
44+
echo "GOOGLE_CHROME_BINARY=./chrome-linux64/chrome" >> $GITHUB_ENV
45+
46+
- name: Install dependencies
47+
run: npm ci --ignore-scripts
48+
49+
- name: Install ChromeDriver with specific binary
50+
run: |
51+
npm install chromedriver --chromedriver_filepath=$PWD/chromedriver-linux64.zip
52+
npm install -g chromedriver --chromedriver_filepath=$PWD/chromedriver-linux64.zip
53+
54+
- name: Add node_modules/.bin to PATH
55+
run: echo "$PWD/node_modules/.bin" >> $GITHUB_PATH
56+
57+
- name: Build web assets
58+
run: npm run build
59+
60+
- name: Set up test environment variables
61+
run: |
62+
echo "TEST_LOC=local" >> $GITHUB_ENV
63+
echo "GOOGLE_CLIENT_ID=" >> $GITHUB_ENV
64+
echo "GOOGLE_CLIENT_SECRET=" >> $GITHUB_ENV
65+
echo "GOOGLE_API_KEY=" >> $GITHUB_ENV
66+
echo "GOOGLE_SERVER_API_KEY=" >> $GITHUB_ENV
67+
echo "GOOGLE_APP_ID=" >> $GITHUB_ENV
68+
echo "BASE_URL=http://localhost:4999" >> $GITHUB_ENV
69+
echo "LOG_URL=http://localhost:5002" >> $GITHUB_ENV
70+
echo "SESSION_SECRET=not-so-secret" >> $GITHUB_ENV
71+
echo "REDISCLOUD_URL=" >> $GITHUB_ENV
72+
echo "CURRENT_PYRET_RELEASE=" >> $GITHUB_ENV
73+
echo "PYRET=http://localhost:4999/js/cpo-main.jarr" >> $GITHUB_ENV
74+
echo "PORT=4999" >> $GITHUB_ENV
75+
echo "NODE_ENV=development" >> $GITHUB_ENV
76+
echo "SHARED_FETCH_SERVER=https://code.pyret.org" >> $GITHUB_ENV
77+
echo "URL_FILE_MODE=all-remote" >> $GITHUB_ENV
78+
echo "IMAGE_PROXY_BYPASS=true" >> $GITHUB_ENV
79+
echo "POSTMESSAGE_ORIGIN=*" >> $GITHUB_ENV
80+
81+
- name: Start application server
82+
run: |
83+
# Start the server in background
84+
node src/run.js &
85+
86+
# Wait for server to be ready
87+
sleep 3
88+
89+
# Verify server is running
90+
curl -f http://localhost:4999 || (echo "Server failed to start" && exit 1)
91+
92+
- name: Run tests
93+
run: |
94+
# Wait a bit more for everything to be ready
95+
sleep 3
96+
97+
# Run tests based on event type
98+
if [ "${{ github.event_name }}" = "pull_request" ]; then
99+
echo "Running PR tests (excluding modules)"
100+
npm run mocha -- --grep modules --invert
101+
else
102+
echo "Running all tests"
103+
npm run mocha
104+
fi

.github/workflows/lang-test.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: lang/ tests
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
13+
defaults:
14+
run:
15+
working-directory: ./lang
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-node@v3.9.1
20+
with:
21+
node-version: 24
22+
23+
- name: install
24+
run: make install
25+
26+
- name: build
27+
run: make
28+
29+
- name: run tests
30+
run: make all-pyret-test
31+

.github/workflows/npm-test.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Test pyret-npm CLI
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
7+
jobs:
8+
build-test-publish:
9+
runs-on: ubuntu-latest
10+
timeout-minutes: 30
11+
defaults:
12+
run:
13+
working-directory: ./npm
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-node@v4
17+
with:
18+
node-version: 24
19+
- run: npm ci
20+
- run: npm run build
21+
- run: npm test

0 commit comments

Comments
 (0)