Skip to content

552020 is testing dantol29/webserver #825

552020 is testing dantol29/webserver

552020 is testing dantol29/webserver #825

name: GitHub Actions Demo
run-name: ${{ github.actor }} is testing ${{ github.repository }}
on:
push: # Trigger on push events
pull_request: # Trigger on pull request events
types: [opened, synchronize] # Trigger on PR opened and PR synchronize events
workflow_dispatch: # Allows the workflow to be manually triggered
jobs:
Explore-GitHub-Actions:
runs-on: ubuntu-latest
steps:
- name: Clear cache
uses: actions/github-script@v6
with:
script: |
console.log("About to clear")
const caches = await github.rest.actions.getActionsCacheList({
owner: context.repo.owner,
repo: context.repo.repo,
})
for (const cache of caches.data.actions_caches) {
console.log(cache)
await github.rest.actions.deleteActionsCacheById({
owner: context.repo.owner,
repo: context.repo.repo,
cache_id: cache.id,
})
}
console.log("Clear completed")
- run: echo "πŸŽ‰ The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "πŸ”Ž The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v4
- run: echo "πŸ’‘ The ${{ github.repository }} repository has been cloned to the runner."
- name: List files in the repository
run: |
ls ${{ github.workspace }}
- name: Compile webserv
run: make re
- name: Install Python dependencies
run: |
python3 -m pip install aiohttp asyncio aiofiles
- name: Start webserv in background
run: ./webserv &
- name: Run Config file tests
if: always()
working-directory: tests/config
run: |
./config_test.sh
exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "❌ Config file tests failed. Marking run as incorrect."
echo "::set-output name=config_tests_correct::false"
else
echo "βœ… Config file tests passed."
echo "::set-output name=config_tests_correct::true"
fi
- name: Check if webserv is running
run: |
if ps aux | grep -q '[w]ebserv'; then
echo "webserv is running."
else
echo "webserv is not running."
fi
- name: Run Python tests
if: always()
working-directory: tests # Set working directory to 'tests'
run: |
python3 general_tests.py
exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "❌ Tests failed. Exiting with status code $exit_code."
exit $exit_code
fi
- name: Run Error codes tests
if: always()
working-directory: tests # Set working directory to 'tests'
run: |
./error_codes.sh
exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "❌ Tests failed. Exiting with status code $exit_code."
exit $exit_code
fi
- name: Run C++ parser tests
if: always()
working-directory: tests # Set working directory to 'tests'
run: |
c++ parser.cpp -o parse && ./parse
exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "❌ Tests failed. Exiting with status code $exit_code."
exit $exit_code
fi
- name: Run C++ router and CGI tests
if: always()
working-directory: tests
run: |
c++ router.cpp -o router && ./router
exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "❌ Tests failed. Exiting with status code $exit_code."
exit $exit_code
fi
- run: echo "🍏 This job's status is ${{ job.status }}."