furhter ga tests #271
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Check tests | |
| on: [pull_request, push] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Cache node modules | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.npm | |
| key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-node- | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Setup Chrome | |
| run: | | |
| # Update package lists | |
| sudo apt-get update | |
| # Install Chrome stable | |
| wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add - | |
| echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google-chrome.list | |
| sudo apt-get update | |
| sudo apt-get install -y google-chrome-stable | |
| # Verify installation | |
| google-chrome --version | |
| # Install ChromeDriver using Chrome for Testing API (for Chrome 115+) | |
| CHROME_VERSION=$(google-chrome --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+') | |
| echo "Chrome version: $CHROME_VERSION" | |
| # Use the new Chrome for Testing API for versions 115+ | |
| CHROMEDRIVER_URL="https://storage.googleapis.com/chrome-for-testing-public/${CHROME_VERSION}/linux64/chromedriver-linux64.zip" | |
| echo "Downloading ChromeDriver from: $CHROMEDRIVER_URL" | |
| wget -O /tmp/chromedriver.zip "$CHROMEDRIVER_URL" || { | |
| echo "Failed to download from Chrome for Testing, trying fallback..." | |
| # Fallback to latest stable if specific version fails | |
| LATEST_VERSION=$(curl -s "https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json" | grep -o '"version":"[^"]*' | head -1 | cut -d'"' -f4) | |
| wget -O /tmp/chromedriver.zip "https://storage.googleapis.com/chrome-for-testing-public/${LATEST_VERSION}/linux64/chromedriver-linux64.zip" | |
| } | |
| sudo unzip /tmp/chromedriver.zip -d /tmp/ | |
| sudo mv /tmp/chromedriver-linux64/chromedriver /usr/local/bin/ | |
| sudo chmod +x /usr/local/bin/chromedriver | |
| chromedriver --version | |
| - name: Setup display for headless testing | |
| run: | | |
| export DISPLAY=:99 | |
| sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & | |
| - name: Build project | |
| run: npm run build | |
| - name: Run tests | |
| run: npm run test:ci | |
| env: | |
| CI: true | |
| DISPLAY: :99 | |
| NODE_ENV: test |