From a55494d9a564c948954a6bd77801077e35646857 Mon Sep 17 00:00:00 2001 From: zaanposni Date: Sun, 21 Jan 2024 11:41:19 +0100 Subject: [PATCH 1/7] add github workflows --- .github/workflows/docker_pr.yml | 23 +++++++++++++++ .github/workflows/docker_publish.yml | 42 ++++++++++++++++++++++++++++ .github/workflows/pythonlint_pr.yml | 26 +++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 .github/workflows/docker_pr.yml create mode 100644 .github/workflows/docker_publish.yml create mode 100644 .github/workflows/pythonlint_pr.yml diff --git a/.github/workflows/docker_pr.yml b/.github/workflows/docker_pr.yml new file mode 100644 index 0000000..2cb9b35 --- /dev/null +++ b/.github/workflows/docker_pr.yml @@ -0,0 +1,23 @@ +name: Docker + +on: + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Build frontend + working-directory: ./src/psaggregator + run: docker build -t ghcr.io/${{ github.repository_owner }}/psaggregator_frontend:latest . + + - name: Build nginx + working-directory: ./src/nginx + run: docker build -t ghcr.io/${{ github.repository_owner }}/psaggregator_nginx:latest . + + - name: Build dataimport + working-directory: ./src/dataimport + run: docker build -t ghcr.io/${{ github.repository_owner }}/psaggregator_dataimport:latest . diff --git a/.github/workflows/docker_publish.yml b/.github/workflows/docker_publish.yml new file mode 100644 index 0000000..224ee86 --- /dev/null +++ b/.github/workflows/docker_publish.yml @@ -0,0 +1,42 @@ +name: DockerPublish + +on: + push: + branches: + - "master" + +jobs: + DockerPublish: + if: github.repository_owner == 'zaanposni' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Determine version + run: | + VERSION=$(cat ./src/psaggregator/package.json | jq -r '.version') + echo "I found version: $VERSION" + echo "VERSION=$VERSION" >> $GITHUB_ENV + + - name: Build frontend + working-directory: ./src/psaggregator + run: docker build -t ghcr.io/${{ github.repository_owner }}/psaggregator_frontend:latest -t ghcr.io/${{ github.repository_owner }}/psaggregator_frontend:${{ env.VERSION }} . + + - name: Build nginx + working-directory: ./src/nginx + run: docker build -t ghcr.io/${{ github.repository_owner }}/psaggregator_nginx:latest -t ghcr.io/${{ github.repository_owner }}/psaggregator_nginx:${{ env.VERSION }} . + + - name: Build dataimport + working-directory: ./src/dataimport + run: docker build -t ghcr.io/${{ github.repository_owner }}/psaggregator_dataimport:latest -t ghcr.io/${{ github.repository_owner }}/psaggregator_dataimport:${{ env.VERSION }} . + + - name: Push images + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u zaanposni --password-stdin + docker push ghcr.io/${{ github.repository_owner }}/psaggregator_frontend:${{ env.VERSION }} + docker push ghcr.io/${{ github.repository_owner }}/psaggregator_nginx:${{ env.VERSION }} + docker push ghcr.io/${{ github.repository_owner }}/psaggregator_dataimport:${{ env.VERSION }} + docker push ghcr.io/${{ github.repository_owner }}/psaggregator_frontend:latest + docker push ghcr.io/${{ github.repository_owner }}/psaggregator_nginx:latest + docker push ghcr.io/${{ github.repository_owner }}/psaggregator_dataimport:latest diff --git a/.github/workflows/pythonlint_pr.yml b/.github/workflows/pythonlint_pr.yml new file mode 100644 index 0000000..911e26e --- /dev/null +++ b/.github/workflows/pythonlint_pr.yml @@ -0,0 +1,26 @@ +name: Python + +on: + pull_request: + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pylint + + - name: Lint Python code + working-directory: ./src/dataimport + run: | + pylint ./*.py From 02c616b505ff68d1c69d7c5100f0a42e0f71eb89 Mon Sep 17 00:00:00 2001 From: zaanposni Date: Sun, 21 Jan 2024 11:42:05 +0100 Subject: [PATCH 2/7] bump version to major release --- SECURITY.md | 5 +---- src/psaggregator/package.json | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/SECURITY.md b/SECURITY.md index 9231625..7db326e 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -2,9 +2,6 @@ ## Supported Versions -psaggregator currently has no major release. -However, once Version `1.0.0` is released, it will be supported as a LTS. - | Version | Supported | | ------- | ------------------ | | 1.x.x | :white_check_mark: | @@ -12,4 +9,4 @@ However, once Version `1.0.0` is released, it will be supported as a LTS. ## Reporting a Vulnerability -Please report severe vulnerabilities via mail at psaggregator-vul@zaanposni.com +Please report severe vulnerabilities via mail at diff --git a/src/psaggregator/package.json b/src/psaggregator/package.json index f84e98c..829632a 100644 --- a/src/psaggregator/package.json +++ b/src/psaggregator/package.json @@ -1,6 +1,6 @@ { "name": "psaggregator", - "version": "0.0.1", + "version": "1.0.0", "scripts": { "dev": "vite dev", "build": "vite build", From ebe3cde2abdb3b145385e2b93159fc369c851278 Mon Sep 17 00:00:00 2001 From: zaanposni Date: Sun, 21 Jan 2024 11:45:01 +0100 Subject: [PATCH 3/7] errors only for pylint --- .github/workflows/pythonlint_pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonlint_pr.yml b/.github/workflows/pythonlint_pr.yml index 911e26e..7b123df 100644 --- a/.github/workflows/pythonlint_pr.yml +++ b/.github/workflows/pythonlint_pr.yml @@ -23,4 +23,4 @@ jobs: - name: Lint Python code working-directory: ./src/dataimport run: | - pylint ./*.py + pylint --errors-only ./*.py From 851e94f0b426623c9f5d2aeb0395e7541bb2a21f Mon Sep 17 00:00:00 2001 From: zaanposni Date: Sun, 21 Jan 2024 11:46:23 +0100 Subject: [PATCH 4/7] pip install requirements --- .github/workflows/pythonlint_pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pythonlint_pr.yml b/.github/workflows/pythonlint_pr.yml index 7b123df..16c40a4 100644 --- a/.github/workflows/pythonlint_pr.yml +++ b/.github/workflows/pythonlint_pr.yml @@ -19,6 +19,7 @@ jobs: run: | python -m pip install --upgrade pip pip install pylint + pip install -r requirements.txt - name: Lint Python code working-directory: ./src/dataimport From bf0138bdef6aecd44d61faa0e36a72dc3342f273 Mon Sep 17 00:00:00 2001 From: zaanposni Date: Sun, 21 Jan 2024 11:46:49 +0100 Subject: [PATCH 5/7] use prebuild images in docker-compose --- docker-compose.yml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 3bc7558..45eb66c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,9 +16,7 @@ services: frontend: container_name: psaggregator_frontend restart: unless-stopped - build: - context: ./src/psaggregator - dockerfile: Dockerfile + image: ghcr.io/zaanposni/psaggregator_frontend:latest environment: - PRIVATE_DATABASE_URL=${DATABASE_URL} - PUBLIC_LEGAL_URL=${LEGAL_URL} @@ -35,9 +33,7 @@ services: dataimport: container_name: psaggregator_dataimport restart: unless-stopped - build: - context: ./src/dataimport - dockerfile: Dockerfile + image: ghcr.io/zaanposni/psaggregator_dataimport:latest environment: - DATABASE_URL=${DATABASE_URL} - REDDIT_CLIENT_ID=${REDDIT_CLIENT_ID} @@ -54,9 +50,7 @@ services: nginx: container_name: psaggregator_nginx restart: unless-stopped - build: - context: ./src/nginx - dockerfile: Dockerfile + image: ghcr.io/zaanposni/psaggregator_nginx:latest depends_on: - frontend ports: From b11287d910e6fff96e216caf91ce5019e6ff4092 Mon Sep 17 00:00:00 2001 From: zaanposni Date: Sun, 21 Jan 2024 11:47:21 +0100 Subject: [PATCH 6/7] . --- .github/workflows/pythonlint_pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pythonlint_pr.yml b/.github/workflows/pythonlint_pr.yml index 16c40a4..14b90fc 100644 --- a/.github/workflows/pythonlint_pr.yml +++ b/.github/workflows/pythonlint_pr.yml @@ -16,6 +16,7 @@ jobs: python-version: "3.10" - name: Install dependencies + working-directory: ./src/dataimport run: | python -m pip install --upgrade pip pip install pylint From fc8d37a834c9c5e11d1f1b3017756238a4877685 Mon Sep 17 00:00:00 2001 From: zaanposni Date: Sun, 21 Jan 2024 11:50:15 +0100 Subject: [PATCH 7/7] added codeowners file --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..b77df12 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @zaanposni