From dc36cf12d01db81b012f6e3a467102d02b435ea2 Mon Sep 17 00:00:00 2001 From: Sofiane2002 <76939868+Sofiane2002@users.noreply.github.com> Date: Fri, 4 Mar 2022 14:59:55 +0100 Subject: [PATCH 01/13] pythonTest --- .github/workflows/test-build.yml | 20 ++++++++++++++++++++ requirements.txt | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test-build.yml diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml new file mode 100644 index 00000000..988c299e --- /dev/null +++ b/.github/workflows/test-build.yml @@ -0,0 +1,20 @@ +name: AppTest + +on: push +env: + APP_VERSION: 1.0.0 + +jobs: + Python: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: '3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax + architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified + - run: pipenv install + - run: pip install -r requirements.txt + - run: pytest + + diff --git a/requirements.txt b/requirements.txt index 7938abe0..0b7a25b1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,6 +8,6 @@ pluggy==0.13.1; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2 py==1.10.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3' pytest-mock==1.10.3 pytest-watch==4.2.0 -pytest==4.4.0 +pytest==6.2.5 six==1.15.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2' watchdog==2.0.2; python_version >= '3.6' From 876a7a9bb0329ba1226ff71411a10e6a9c8af7d4 Mon Sep 17 00:00:00 2001 From: Sofiane2002 <76939868+Sofiane2002@users.noreply.github.com> Date: Fri, 4 Mar 2022 15:02:26 +0100 Subject: [PATCH 02/13] PYHTONTEST2 --- .github/workflows/test-build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 988c299e..a3247982 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -13,7 +13,6 @@ jobs: with: python-version: '3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified - - run: pipenv install - run: pip install -r requirements.txt - run: pytest From af71b2d7b2078841fefd28dd94b926c5bbb5446d Mon Sep 17 00:00:00 2001 From: Sofiane2002 <76939868+Sofiane2002@users.noreply.github.com> Date: Fri, 4 Mar 2022 15:12:07 +0100 Subject: [PATCH 03/13] TESTBUILD4 --- .github/workflows/test-build.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index a3247982..04051e6b 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -15,5 +15,10 @@ jobs: architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified - run: pip install -r requirements.txt - run: pytest + - name: Recuperation du rapport + uses: actions/upload-artifact@v3 + with: + name: mon-artefact + path: /home/runner/work/intro-to-pytest/intro-to-pytest From eb371b84f5d6bfaaccb031d762fe625527d7827c Mon Sep 17 00:00:00 2001 From: Sofiane2002 <76939868+Sofiane2002@users.noreply.github.com> Date: Fri, 4 Mar 2022 15:16:37 +0100 Subject: [PATCH 04/13] PYHTONTEST5 --- .github/workflows/test-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 04051e6b..39a5cea3 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -19,6 +19,6 @@ jobs: uses: actions/upload-artifact@v3 with: name: mon-artefact - path: /home/runner/work/intro-to-pytest/intro-to-pytest + path: ./other_code/** From a70e79d526814ae9808cfdefaea67f540d80eb4c Mon Sep 17 00:00:00 2001 From: Sofiane2002 <76939868+Sofiane2002@users.noreply.github.com> Date: Fri, 4 Mar 2022 16:04:21 +0100 Subject: [PATCH 05/13] pushDev --- .github/workflows/dockerBuild.yml | 35 ++++++++++++++++++++ .github/workflows/pythonInstall.yml | 50 +++++++++++++++++++++++++++++ .github/workflows/test-build.yml | 24 -------------- Dockerfile | 5 +++ 4 files changed, 90 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/dockerBuild.yml create mode 100644 .github/workflows/pythonInstall.yml delete mode 100644 .github/workflows/test-build.yml create mode 100644 Dockerfile diff --git a/.github/workflows/dockerBuild.yml b/.github/workflows/dockerBuild.yml new file mode 100644 index 00000000..d9e1d53d --- /dev/null +++ b/.github/workflows/dockerBuild.yml @@ -0,0 +1,35 @@ +name: DockerBuild + +on: + pull_request: + types: + - closed + +env: + APP_VERSION: 1.0.0 + +jobs: + Build-App: + runs-on: ubuntu-latest + needs: Python + steps: + - name: Recuperation du repo + uses: actions/checkout@v3 + - name: Installation de QEMU + uses: docker/setup-qemu-action@v1 + - name: Installation docker BuildX + uses: docker/setup-buildx-action@v1 + - name: Login & password docker + uses: docker/login-action@v1 + with: + username: ${{secrets.USERNAME_DOCKER}} + password: ${{secrets.PASSWORD_DOCKER}} + - name: build & push docker + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: ${{secrets.USERNAME_DOCKER}}/weather:${{env.APP_VERSION}} + + + diff --git a/.github/workflows/pythonInstall.yml b/.github/workflows/pythonInstall.yml new file mode 100644 index 00000000..45989961 --- /dev/null +++ b/.github/workflows/pythonInstall.yml @@ -0,0 +1,50 @@ +name: AppTest + +on: + push: + branches: + - dev + +env: + APP_VERSION: 1.0.0 + +jobs: + Python: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: '3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax + architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified + - run: pip install -r requirements.txt + - run: pytest + - name: Recuperation du rapport + uses: actions/upload-artifact@v3 + with: + name: mon-artefact + path: ./other_code/** + Build-App: + runs-on: ubuntu-latest + needs: Python + steps: + - name: Recuperation du repo + uses: actions/checkout@v3 + - name: Installation de QEMU + uses: docker/setup-qemu-action@v1 + - name: Installation docker BuildX + uses: docker/setup-buildx-action@v1 + - name: Login & password docker + uses: docker/login-action@v1 + with: + username: ${{secrets.USERNAME_DOCKER}} + password: ${{secrets.PASSWORD_DOCKER}} + - name: build & push docker + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: ${{secrets.USERNAME_DOCKER}}/weather:${{env.APP_VERSION}} + + + diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml deleted file mode 100644 index 39a5cea3..00000000 --- a/.github/workflows/test-build.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: AppTest - -on: push -env: - APP_VERSION: 1.0.0 - -jobs: - Python: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - with: - python-version: '3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax - architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified - - run: pip install -r requirements.txt - - run: pytest - - name: Recuperation du rapport - uses: actions/upload-artifact@v3 - with: - name: mon-artefact - path: ./other_code/** - - diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..ce9a5da1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM python:latest +WORKDIR /app +COPY . . +RUN pip install -r requirement.txt +CMD [ "python3", "-m" , "flask", "run", "--host=0.0.0.0"] \ No newline at end of file From 8b459eef1402d5c6b482d42354c83b536e096320 Mon Sep 17 00:00:00 2001 From: Sofiane2002 <76939868+Sofiane2002@users.noreply.github.com> Date: Fri, 4 Mar 2022 16:06:30 +0100 Subject: [PATCH 06/13] pushDev2 --- .github/workflows/pythonInstall.yml | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/.github/workflows/pythonInstall.yml b/.github/workflows/pythonInstall.yml index 45989961..8bf75ff9 100644 --- a/.github/workflows/pythonInstall.yml +++ b/.github/workflows/pythonInstall.yml @@ -24,27 +24,4 @@ jobs: with: name: mon-artefact path: ./other_code/** - Build-App: - runs-on: ubuntu-latest - needs: Python - steps: - - name: Recuperation du repo - uses: actions/checkout@v3 - - name: Installation de QEMU - uses: docker/setup-qemu-action@v1 - - name: Installation docker BuildX - uses: docker/setup-buildx-action@v1 - - name: Login & password docker - uses: docker/login-action@v1 - with: - username: ${{secrets.USERNAME_DOCKER}} - password: ${{secrets.PASSWORD_DOCKER}} - - name: build & push docker - uses: docker/build-push-action@v2 - with: - context: . - push: true - tags: ${{secrets.USERNAME_DOCKER}}/weather:${{env.APP_VERSION}} - - - + \ No newline at end of file From b015339e0240337d11434f693d46c57bdd4284bb Mon Sep 17 00:00:00 2001 From: Sofiane2002 <76939868+Sofiane2002@users.noreply.github.com> Date: Fri, 4 Mar 2022 16:18:43 +0100 Subject: [PATCH 07/13] openPullRequest --- .github/workflows/dockerBuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dockerBuild.yml b/.github/workflows/dockerBuild.yml index d9e1d53d..838ddd29 100644 --- a/.github/workflows/dockerBuild.yml +++ b/.github/workflows/dockerBuild.yml @@ -3,7 +3,7 @@ name: DockerBuild on: pull_request: types: - - closed + - opened env: APP_VERSION: 1.0.0 From e59560c9e19ff49c9fbfcd867cf77f759bfd48b6 Mon Sep 17 00:00:00 2001 From: Sofiane2002 <76939868+Sofiane2002@users.noreply.github.com> Date: Fri, 4 Mar 2022 16:22:00 +0100 Subject: [PATCH 08/13] ajout app.js --- app.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 app.js diff --git a/app.js b/app.js new file mode 100644 index 00000000..e69de29b From db7be7c95cf208bc23afe4da50350188f8d218c1 Mon Sep 17 00:00:00 2001 From: Sofiane2002 <76939868+Sofiane2002@users.noreply.github.com> Date: Fri, 4 Mar 2022 16:25:06 +0100 Subject: [PATCH 09/13] pushdev --- .github/workflows/dockerBuild.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dockerBuild.yml b/.github/workflows/dockerBuild.yml index 838ddd29..ea28c5a1 100644 --- a/.github/workflows/dockerBuild.yml +++ b/.github/workflows/dockerBuild.yml @@ -1,9 +1,9 @@ name: DockerBuild on: - pull_request: - types: - - opened + push: + branches: + - dev env: APP_VERSION: 1.0.0 From d3558184cb32ce964cd6553c28ab75b1f4a9678b Mon Sep 17 00:00:00 2001 From: Sofiane2002 <76939868+Sofiane2002@users.noreply.github.com> Date: Fri, 4 Mar 2022 16:27:01 +0100 Subject: [PATCH 10/13] pushdev2 --- .github/workflows/dockerBuild.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/dockerBuild.yml b/.github/workflows/dockerBuild.yml index ea28c5a1..ce2f8266 100644 --- a/.github/workflows/dockerBuild.yml +++ b/.github/workflows/dockerBuild.yml @@ -11,7 +11,6 @@ env: jobs: Build-App: runs-on: ubuntu-latest - needs: Python steps: - name: Recuperation du repo uses: actions/checkout@v3 From 206480a6891e35e490666d3c27b0ec7979ea6616 Mon Sep 17 00:00:00 2001 From: Sofiane2002 <76939868+Sofiane2002@users.noreply.github.com> Date: Fri, 4 Mar 2022 16:30:31 +0100 Subject: [PATCH 11/13] pushDev3 --- .github/workflows/dockerBuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dockerBuild.yml b/.github/workflows/dockerBuild.yml index ce2f8266..529bf56f 100644 --- a/.github/workflows/dockerBuild.yml +++ b/.github/workflows/dockerBuild.yml @@ -23,7 +23,7 @@ jobs: with: username: ${{secrets.USERNAME_DOCKER}} password: ${{secrets.PASSWORD_DOCKER}} - - name: build & push docker + - name: build & push uses: docker/build-push-action@v2 with: context: . From 73b8fa9899019feb9224a077a911138d137cb05d Mon Sep 17 00:00:00 2001 From: Sofiane2002 <76939868+Sofiane2002@users.noreply.github.com> Date: Fri, 4 Mar 2022 16:48:10 +0100 Subject: [PATCH 12/13] lastTest --- .github/workflows/dockerBuild.yml | 9 +++++---- .github/workflows/pythonInstall.yml | 6 +++--- Dockerfile | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/dockerBuild.yml b/.github/workflows/dockerBuild.yml index 529bf56f..c2cff663 100644 --- a/.github/workflows/dockerBuild.yml +++ b/.github/workflows/dockerBuild.yml @@ -1,10 +1,11 @@ name: DockerBuild on: - push: + pull_request: branches: - - dev - + - master + types: + - closed env: APP_VERSION: 1.0.0 @@ -28,7 +29,7 @@ jobs: with: context: . push: true - tags: ${{secrets.USERNAME_DOCKER}}/weather:${{env.APP_VERSION}} + tags: ${{secrets.USERNAME_DOCKER}}/pyapp:${{env.APP_VERSION}} diff --git a/.github/workflows/pythonInstall.yml b/.github/workflows/pythonInstall.yml index 8bf75ff9..d4a0c6cb 100644 --- a/.github/workflows/pythonInstall.yml +++ b/.github/workflows/pythonInstall.yml @@ -18,10 +18,10 @@ jobs: python-version: '3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified - run: pip install -r requirements.txt - - run: pytest + - run: pytest > report.txt - name: Recuperation du rapport uses: actions/upload-artifact@v3 with: - name: mon-artefact - path: ./other_code/** + name: mon-report + path: ./report.txt \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index ce9a5da1..012a09c2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM python:latest WORKDIR /app COPY . . -RUN pip install -r requirement.txt -CMD [ "python3", "-m" , "flask", "run", "--host=0.0.0.0"] \ No newline at end of file +RUN pip install -r requirements.txt +CMD [ "python", "conftest"] \ No newline at end of file From d1efd43aa40a0cdd4a6e94f19f74fdd90735a1d7 Mon Sep 17 00:00:00 2001 From: Sofiane2002 <76939868+Sofiane2002@users.noreply.github.com> Date: Mon, 4 Apr 2022 14:49:10 +0200 Subject: [PATCH 13/13] modif pythoninstall.yml --- .github/workflows/pythonInstall.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonInstall.yml b/.github/workflows/pythonInstall.yml index d4a0c6cb..4456a5ec 100644 --- a/.github/workflows/pythonInstall.yml +++ b/.github/workflows/pythonInstall.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/setup-python@v2 with: python-version: '3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax - architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified + architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified - run: pip install -r requirements.txt - run: pytest > report.txt - name: Recuperation du rapport