Added permissions for actions and packages in docker.yml workflow #19
Workflow file for this run
This file contains 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: Run Headless Browser Tests | |
on: | |
push: | |
tags: | |
- 'v*.*.*' # Triggers on version tags | |
workflow_dispatch: # Allows manual triggering | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
chrome: | |
image: selenium/standalone-chrome | |
options: >- | |
--shm-size 2g | |
ports: | |
- 4444:4444 | |
http_server: | |
image: nginx:alpine | |
ports: | |
- 5500:80 | |
volumes: | |
- ${{ github.workspace }}:/usr/share/nginx/html # Mount the code directory | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.8' # Specify your desired Python version | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r ./devtools/screenshots/requirements.txt | |
- name: Wait for server to start | |
run: | | |
# Wait for the server to respond | |
curl -s http://localhost:5500/ | |
for i in {1..10}; do | |
if curl -s http://localhost:5500/ > /dev/null; then | |
echo "Server is up!" | |
break | |
fi | |
echo "Waiting for server..." | |
sleep 5 # Wait 5 seconds before trying again | |
done | |
- name: Run tests | |
run: | | |
cd ./devtools/screenshots | |
python main.py | |
- name: Add and commit screenshots | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add public/screenshots/* | |
git add manifest.json | |
git commit -m "Add screenshots from headless browser tests" || echo "No changes to commit" | |
git push origin HEAD:main | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Use the GitHub token for authentication |