30 lines
772 B
YAML
30 lines
772 B
YAML
name: CI Test with Python
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Python
|
|
run: sudo apt update && sudo apt install -y python3 python3-pip
|
|
|
|
- name: Create a Sample Python Test
|
|
run: |
|
|
echo "import unittest" > test_sample.py
|
|
echo "class TestSample(unittest.TestCase):" >> test_sample.py
|
|
echo " def test_example(self):" >> test_sample.py
|
|
echo " assert 1 + 1 == 2" >> test_sample.py
|
|
echo "if __name__ == '__main__':" >> test_sample.py
|
|
echo " unittest.main()" >> test_sample.py
|
|
|
|
- name: Run the Python Test
|
|
run: python3 test_sample.py
|
|
|