Skip to content

Commit

Permalink
Merge pull request #3 from cloudsteak/Action
Browse files Browse the repository at this point in the history
Kód1 Action
  • Loading branch information
the1bit authored Apr 29, 2024
2 parents 1168ffa + 7a65529 commit af1f0fc
Show file tree
Hide file tree
Showing 14 changed files with 211 additions and 22 deletions.
32 changes: 29 additions & 3 deletions .github/workflows/Kod2.01.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,45 @@ on:
paths:
- "Kod2/01/**"
pull_request:
branches:
- release-*
paths:
- "Kod2/01/**"

env:
APP_NAME: python-flask-app-01 # Alkalmazás képfájl neve

jobs:
build:
test:
name: Tesztelés (CI)
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest

steps:

- name: Kód letöltése
uses: actions/checkout@v4
- name: Python beállítása
uses: actions/setup-python@v4
with:
python-version: '3.11'
architecture: 'x64'
- name: Python verzió megjelenítése
run: python -c "import sys; print(sys.version)"
- name: Python csomagok telepítése
run: |
cd Kod2/01
pip install -r requirements.txt
- name: Tesztelés
run: |
cd Kod2/01
python -m unittest test_app.py
deploy:
name: Telepítés (CD)
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest

steps:

- name: Kód letöltése
uses: actions/checkout@v4

Expand Down
36 changes: 31 additions & 5 deletions .github/workflows/Kod2.02.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,45 @@ on:
paths:
- "Kod2/02/**"
pull_request:
branches:
- release-*
paths:
- "Kod2/02/**"

env:
APP_NAME: python-flask-app-02 # Alkalmazás képfájl neve
APP_NAME: python-flask-app-01 # Alkalmazás képfájl neve

jobs:
build:
test:
name: Tesztelés (CI)
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest

steps:

- name: Kód letöltése
uses: actions/checkout@v4
- name: Python beállítása
uses: actions/setup-python@v4
with:
python-version: '3.11'
architecture: 'x64'
- name: Python verzió megjelenítése
run: python -c "import sys; print(sys.version)"
- name: Python csomagok telepítése
run: |
cd Kod2/02
pip install -r requirements.txt
- name: Tesztelés
run: |
cd Kod2/02
python -m unittest test_app.py
deploy:
name: Telepítés (CD)
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest

steps:

- name: Kód letöltése
uses: actions/checkout@v4

Expand Down Expand Up @@ -52,4 +78,4 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}

- name: ACR kijelentkezés
run: docker logout ${{ secrets.ACR_LOGIN_SERVER }}
run: docker logout ${{ secrets.ACR_LOGIN_SERVER }}
36 changes: 31 additions & 5 deletions .github/workflows/Kod2.03.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,45 @@ on:
paths:
- "Kod2/03/**"
pull_request:
branches:
- release-*
paths:
- "Kod2/03/**"

env:
APP_NAME: python-flask-app-03 # Alkalmazás képfájl neve
APP_NAME: python-flask-app-01 # Alkalmazás képfájl neve

jobs:
build:
test:
name: Tesztelés (CI)
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest

steps:

- name: Kód letöltése
uses: actions/checkout@v4
- name: Python beállítása
uses: actions/setup-python@v4
with:
python-version: '3.11'
architecture: 'x64'
- name: Python verzió megjelenítése
run: python -c "import sys; print(sys.version)"
- name: Python csomagok telepítése
run: |
cd Kod2/03
pip install -r requirements.txt
- name: Tesztelés
run: |
cd Kod2/03
python -m unittest test_app.py
deploy:
name: Telepítés (CD)
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest

steps:

- name: Kód letöltése
uses: actions/checkout@v4

Expand Down Expand Up @@ -52,4 +78,4 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}

- name: ACR kijelentkezés
run: docker logout ${{ secrets.ACR_LOGIN_SERVER }}
run: docker logout ${{ secrets.ACR_LOGIN_SERVER }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,6 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/


**/nohup.out
12 changes: 9 additions & 3 deletions Kod2/01/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
# Python 3.11
FROM python:3.11-slim-buster

# Kiinduló munkakönyvtár beállítása
WORKDIR /app

COPY requirements.txt ./
RUN pip install -r requirements.txt

# Fájlok másolása
COPY . .

# Függőségek telepítése
RUN pip install -r requirements.txt

# Port definiálása
EXPOSE 8000

# Flask alkalmazás beállítása
ENV FLASK_APP=app.py

# Flask alkalmazás indítása
CMD ["flask", "run", "--host", "0.0.0.0", "--port", "8000"]
2 changes: 1 addition & 1 deletion Kod2/01/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Kezdőoldal
@app.route("/", methods=["GET"])
def info():
return "Docker webalkalmazás"
return "Docker alkalmazás"

if __name__ == "__main__":
app.run(host="0.0.0.0", port=8000)
8 changes: 7 additions & 1 deletion Kod2/01/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
Flask==3.0.2
blinker==1.8.1
click==8.1.7
Flask==3.0.3
itsdangerous==2.2.0
Jinja2==3.1.3
MarkupSafe==2.1.5
Werkzeug==3.0.2
20 changes: 20 additions & 0 deletions Kod2/01/test_app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import unittest
from app import app # Make sure this import matches the location and name of your Flask application module

class TestFlaskApp(unittest.TestCase):
def setUp(self):
# Configure the app for testing
app.config['TESTING'] = True
# Create a test client
self.client = app.test_client()

def test_info_endpoint(self):
# Send a GET request to the '/' endpoint
response = self.client.get('/')
# Check that the response is OK
self.assertEqual(response.status_code, 200)
# Check the data returned
self.assertEqual(response.data.decode('utf-8'), "Docker alkalmazás")

if __name__ == '__main__':
unittest.main()
2 changes: 1 addition & 1 deletion Kod2/02/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Kezdőoldal
@app.route("/", methods=["GET"])
def info():
return "Docker webalkalmazás"
return "Docker alkalmazás"

# Helló Világ!
@app.route("/hello", methods=["GET"])
Expand Down
8 changes: 7 additions & 1 deletion Kod2/02/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
Flask==3.0.2
blinker==1.8.1
click==8.1.7
Flask==3.0.3
itsdangerous==2.2.0
Jinja2==3.1.3
MarkupSafe==2.1.5
Werkzeug==3.0.2
28 changes: 28 additions & 0 deletions Kod2/02/test_app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import unittest
from app import app # Make sure this import matches the location and name of your Flask application module

class TestFlaskApp(unittest.TestCase):
def setUp(self):
# Configure the app for testing
app.config['TESTING'] = True
# Create a test client
self.client = app.test_client()

def test_info_endpoint(self):
# Send a GET request to the '/' endpoint
response = self.client.get('/')
# Check that the response is OK
self.assertEqual(response.status_code, 200)
# Check the data returned
self.assertEqual(response.data.decode('utf-8'), "Docker alkalmazás")

def test_hello_endpoint(self):
# Send a GET request to the '/' endpoint
response = self.client.get('/hello')
# Check that the response is OK
self.assertEqual(response.status_code, 200)
# Check the data returned
self.assertEqual(response.data.decode('utf-8'), "Helló Világ!")

if __name__ == '__main__':
unittest.main()
2 changes: 1 addition & 1 deletion Kod2/03/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Kezdőoldal
@app.route("/", methods=["GET"])
def info():
return "Docker webalkalmazás"
return "Docker alkalmazás"

# Helló Világ!
@app.route("/hello", methods=["GET"])
Expand Down
8 changes: 7 additions & 1 deletion Kod2/03/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
Flask==3.0.2
blinker==1.8.1
click==8.1.7
Flask==3.0.3
itsdangerous==2.2.0
Jinja2==3.1.3
MarkupSafe==2.1.5
Werkzeug==3.0.2
36 changes: 36 additions & 0 deletions Kod2/03/test_app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import unittest
from app import app # Make sure this import matches the location and name of your Flask application module

class TestFlaskApp(unittest.TestCase):
def setUp(self):
# Configure the app for testing
app.config['TESTING'] = True
# Create a test client
self.client = app.test_client()

def test_info_endpoint(self):
# Send a GET request to the '/' endpoint
response = self.client.get('/')
# Check that the response is OK
self.assertEqual(response.status_code, 200)
# Check the data returned
self.assertEqual(response.data.decode('utf-8'), "Docker alkalmazás")

def test_hello_endpoint(self):
# Send a GET request to the '/hello' endpoint
response = self.client.get('/hello')
# Check that the response is OK
self.assertEqual(response.status_code, 200)
# Check the data returned
self.assertEqual(response.data.decode('utf-8'), "Helló Világ!")

def test_name_endpoint(self):
# Send a GET request to the '/name' endpoint
response = self.client.get('/name?name=teszt')
# Check that the response is OK
self.assertEqual(response.status_code, 200)
# Check the data returned
self.assertEqual(response.data.decode('utf-8'), "Helló teszt!")

if __name__ == '__main__':
unittest.main()

0 comments on commit af1f0fc

Please sign in to comment.