diff --git a/.github/workflows/Gitflow.yml b/.github/workflows/Gitflow.yml new file mode 100644 index 00000000..239cf976 --- /dev/null +++ b/.github/workflows/Gitflow.yml @@ -0,0 +1,41 @@ +name: Git Flow CI + +on: + push: + branches: + - develop + - main + - 'feature/*' + - 'release/*' + +permissions: + contents: write + +jobs: + build: + uses: ./.github/workflows/workflow.yml + with: + python-version: '3.12' + secrets: + DB_USER: ${{ secrets.DB_USER }} + DB_PASSWORD: ${{ secrets.DB_PASSWORD }} + DB_NAME: ${{ secrets.DB_NAME }} + + release: + name: Create Release Tag + if: startsWith(github.ref, 'refs/heads/release/') + needs: build + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Create release tag + env: + GIT_TAG: "v$(date +'%Y.%m.%d.%H%M')" + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git tag $GIT_TAG + git push origin $GIT_TAG diff --git a/.github/workflows/trunk.yml b/.github/workflows/trunk.yml new file mode 100644 index 00000000..1f1e4a47 --- /dev/null +++ b/.github/workflows/trunk.yml @@ -0,0 +1,42 @@ + +name: Trunk CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + +permissions: + contents: write + +jobs: + build: + uses: ./.github/workflows/workflow.yml + with: + python-version: '3.12' + secrets: + DB_USER: ${{ secrets.DB_USER }} + DB_PASSWORD: ${{ secrets.DB_PASSWORD }} + DB_NAME: ${{ secrets.DB_NAME }} + + release: + name: Create Release Tag + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + needs: build + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Create release tag + env: + GIT_TAG: "v$(date +'%Y.%m.%d.%H%M')" + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git tag $GIT_TAG + git push origin $GIT_TAG diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml new file mode 100644 index 00000000..7ae175ed --- /dev/null +++ b/.github/workflows/workflow.yml @@ -0,0 +1,65 @@ + +name: CI Workflow + +on: + workflow_call: + inputs: + python-version: + required: true + type: string + secrets: + DB_USER: + required: true + DB_PASSWORD: + required: true + DB_NAME: + required: true + +jobs: + build: + runs-on: ubuntu-latest + services: + postgres: + image: postgres:13 + env: + POSTGRES_USER: ${{ secrets.DB_USER }} + POSTGRES_PASSWORD: ${{ secrets.DB_PASSWORD }} + POSTGRES_DB: ${{ secrets.DB_NAME }} + ports: + - 5432:5432 + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ inputs.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Run migrations + env: + DJANGO_SETTINGS_MODULE: "Videogames_project.settings" + DB_NAME: ${{ secrets.DB_NAME }} + DB_USER: ${{ secrets.DB_USER }} + DB_PASSWORD: ${{ secrets.DB_PASSWORD }} + DB_HOST: localhost + DB_PORT: "5432" + run: | + python manage.py migrate --noinput + + - name: Run tests + env: + DJANGO_SETTINGS_MODULE: "Videogames_project.settings" + DB_NAME: ${{ secrets.DB_NAME }} + DB_USER: ${{ secrets.DB_USER }} + DB_PASSWORD: ${{ secrets.DB_PASSWORD }} + DB_HOST: localhost + DB_PORT: "5432" + run: | + python manage.py test --verbosity=2 diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..120ec239 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ + +.venv/ +.idea/ +.vscode/ +__pycache__/ +*.pyc + +# Ignore the credentials (for obvious reasons) +credentials.env +videogames_register/migrations/__pycache__/ +Videogames_project/__pycache__/ diff --git a/.idea/Videogames_project.iml b/.idea/Videogames_project.iml deleted file mode 100644 index 858f2dba..00000000 --- a/.idea/Videogames_project.iml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/dbnavigator.xml b/.idea/dbnavigator.xml deleted file mode 100644 index 92e8398b..00000000 --- a/.idea/dbnavigator.xml +++ /dev/null @@ -1,402 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index 80cef708..00000000 --- a/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 105ce2da..00000000 --- a/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml deleted file mode 100644 index 74c88439..00000000 --- a/.idea/jsLibraryMappings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index d38f9556..00000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index b277d59b..00000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/shelf/Uncommitted_changes_before_Update_at_11_9_2024_1_05_PM_[Changes]/shelved.patch b/.idea/shelf/Uncommitted_changes_before_Update_at_11_9_2024_1_05_PM_[Changes]/shelved.patch deleted file mode 100644 index 6fc2a27e..00000000 --- a/.idea/shelf/Uncommitted_changes_before_Update_at_11_9_2024_1_05_PM_[Changes]/shelved.patch +++ /dev/null @@ -1,210 +0,0 @@ -Index: credentials.env -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== -diff --git a/credentials.env b/credentials.env -new file mode 100644 ---- /dev/null (date 1731151836401) -+++ b/credentials.env (date 1731151836401) -@@ -0,0 +1,5 @@ -+DB_NAME=videogames_db -+DB_USER=postgres -+DB_PASSWORD=Neoclassical42 -+DB_HOST=localhost -+DB_PORT=5432 -\ No newline at end of file -Index: .idea/workspace.xml -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP -<+>\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n {\r\n "associatedIndex": 5\r\n}\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n 1730029466445\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== -diff --git a/.idea/workspace.xml b/.idea/workspace.xml ---- a/.idea/workspace.xml (revision fdcf924de63919ab3ffaac2eb83fb5a072d53cc2) -+++ b/.idea/workspace.xml (date 1731153831845) -@@ -4,137 +4,10 @@ -