Skip to content

Commit

Permalink
feat: add auth app
Browse files Browse the repository at this point in the history
  • Loading branch information
jerryOkafor committed Mar 29, 2024
1 parent e215386 commit bb691d1
Show file tree
Hide file tree
Showing 25 changed files with 2,680 additions and 109 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ jobs:
- name: Run tests
run: |
pipenv run python manage.py test
pipenv run coverage run --source='.' manage.py test
env:
SECRET_KEY: "NSNLNDNLN"
SECRET_KEY: "NSNLNDNLN"

- name: Generate coverage report
run: |
pipenv run coverage report
168 changes: 84 additions & 84 deletions .github/workflows/Docker.yml
Original file line number Diff line number Diff line change
@@ -1,84 +1,84 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.

name: Publish Docker image

on:
push:
branches:
- main
release:
types: [ published ]
workflow_dispatch:

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: jerryokafor/url-shortener

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Setup gcloud Auth
id: auth
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}

- name: Setup gcloud CLI
uses: google-github-actions/setup-gcloud@v2
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}

# - name: Access gcloud CLI
# run: |
# gcloud auth configure-docker

- name: SSH into VM
id: compute-ssh
uses: google-github-actions/ssh-compute@v1
with:
instance_name: ${{ vars.GCP_INSTANCE_NAME }}
zone: ${{ vars.GCP_INSTANCE_ZONE }}
ssh_private_key: ${{ secrets.GCP_SSH_PRIVATE_KEY }}
command: |
cat /home/jerryhanksokafor/.env
sudo docker ps
# sudo docker run --name url-shortener --env-file /home/jerryhanksokafor/.env -p 8000:8000 jerryokafor/url-shortener

# Example of using the output
- name: Show result of SSH int Vm
id: test
run: |-
echo '${{ steps.compute-ssh.outputs.stdout }}'
echo '${{ steps.compute-ssh.outputs.stderr }}'
## This workflow uses actions that are not certified by GitHub.
## They are provided by a third-party and are governed by
## separate terms of service, privacy policy, and support
## documentation.
#
## GitHub recommends pinning actions to a commit SHA.
## To get a newer version, you will need to update the SHA.
## You can also reference a tag or branch, but the action may change without warning.
#
#name: Publish Docker image
#
#on:
# push:
# branches:
# - main
# release:
# types: [ published ]
# workflow_dispatch:
#
#jobs:
# push_to_registry:
# name: Push Docker image to Docker Hub
# runs-on: ubuntu-latest
# steps:
# - name: Check out the repo
# uses: actions/checkout@v4
#
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
#
# - name: Log in to Docker Hub
# uses: docker/login-action@v3
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
#
# - name: Extract metadata (tags, labels) for Docker
# id: meta
# uses: docker/metadata-action@v5
# with:
# images: jerryokafor/url-shortener
#
# - name: Build and push Docker image
# uses: docker/build-push-action@v5
# with:
# context: .
# file: ./Dockerfile
# push: true
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}
#
# - name: Setup gcloud Auth
# id: account
# uses: google-github-actions/account@v2
# with:
# credentials_json: ${{ secrets.GCP_SA_KEY }}
#
# - name: Setup gcloud CLI
# uses: google-github-actions/setup-gcloud@v2
# with:
# project_id: ${{ secrets.GCP_PROJECT_ID }}
#
# # - name: Access gcloud CLI
# # run: |
# # gcloud account configure-docker
#
# - name: SSH into VM
# id: compute-ssh
# uses: google-github-actions/ssh-compute@v1
# with:
# instance_name: ${{ vars.GCP_INSTANCE_NAME }}
# zone: ${{ vars.GCP_INSTANCE_ZONE }}
# ssh_private_key: ${{ secrets.GCP_SSH_PRIVATE_KEY }}
# command: |
# cat /home/jerryhanksokafor/.env
# sudo docker ps
## sudo docker run --name url-shortener --env-file /home/jerryhanksokafor/.env -p 8000:8000 jerryokafor/url-shortener
#
# # Example of using the output
# - name: Show result of SSH int Vm
# id: test
# run: |-
# echo '${{ steps.compute-ssh.outputs.stdout }}'
# echo '${{ steps.compute-ssh.outputs.stderr }}'
17 changes: 17 additions & 0 deletions .idea/dataSources.local.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .idea/dataSources.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit bb691d1

Please sign in to comment.