Skip to content

Commit

Permalink
Testing out the secrets part (#11)
Browse files Browse the repository at this point in the history
* Assignment 02

- Created a authentication system using Go
- Created a Github to do simple build and test check upon pushing it to main branch

* Testing out if the actions are working?

- Added a line in README

* Testing again now with postgres config

* Cool

* Made changes only in the README to check if the Git Actions are working

- README is changed.

* Found the mistake

* Missing UUID extension added in the Github Actions File

- ERROR: function uuid_generate_v4() does not exist
- I think this is causing the subsequent to be failing
- Resolution: Added a line to install the extension in YAML

* Testing Forked Repo to Organization Repo Secrets part
- Gave myself an admin access to see if my forked repo is able to access the secrets of base org repo

* pretty much trying the same thing but wrote a workflow to run post merge
  • Loading branch information
Kashyab19 authored Jul 9, 2024
1 parent 3803158 commit 4573bd3
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/go-build-post-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: A Simple Go Build Check after the PR merges

on:
push:
branches:
- main

jobs:
build:
name: Compile Go Code
runs-on: ubuntu-latest

services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_DB: ${{ secrets.POSTGRES_DB }}
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready"
--health-interval=10s
--health-timeout=5s
--health-retries=5
steps:
- uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.21.6'

- name: Wait for PostgreSQL to be ready
run: |
until pg_isready -h localhost -p 5432 -U ${{ secrets.POSTGRES_USER }} -d ${{ secrets.POSTGRES_DB }}; do
echo "Waiting for PostgreSQL to be ready..."
sleep 1
done
- name: Create uuid-ossp extension
run: |
docker exec $(docker ps -q -f ancestor=postgres:latest) psql -U ${{ secrets.POSTGRES_USER }} -d ${{ secrets.POSTGRES_DB }} -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";"
- name: Set environment variables
run: |
echo "DATABASE_URL=${{ secrets.DATABASE_URL }}" >> $GITHUB_ENV
- name: Build
run: go build ./...

- name: Test
run: go test ./...
env:
DATABASE_URL: ${{ env.DATABASE_URL }}

0 comments on commit 4573bd3

Please sign in to comment.