-
Notifications
You must be signed in to change notification settings - Fork 1
105 lines (105 loc) · 3.86 KB
/
webserv.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
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 }}."