Compare commits

17 Commits
main ... dev

Author SHA1 Message Date
5ca1bf798e I removed the name, run-name and on, why am I like this
Some checks failed
Compile / Compile (push) Failing after 1m1s
2026-01-06 18:26:22 -03:00
24dbb16ad7 One last attempt, removing the creating of pgsql and adding password to the services 2026-01-06 18:23:44 -03:00
e037333da1 Added "sudo" to please the Gods
Some checks failed
Compile / Compile (push) Failing after 16s
2026-01-06 18:21:41 -03:00
ffa982eb74 Removed the "-u" of the command line, sob
Some checks failed
Compile / Compile (push) Failing after 17s
2026-01-06 18:20:16 -03:00
6c0c15d3fa Added postgres user and db creation to workflow
Some checks failed
Compile / Compile (push) Failing after 18s
2026-01-06 18:19:05 -03:00
d8fc36bffb Changed host to IP address to see if workflow works now
Some checks failed
Compile / Compile (push) Failing after 22s
2026-01-06 18:16:55 -03:00
f516f0cf00 Forgot the comma, oopsies
Some checks failed
Compile / Compile (push) Failing after 20s
2026-01-06 18:13:54 -03:00
1253471fc3 Updated database code to see if it aligns with workflow requirements
Some checks failed
Compile / Compile (push) Failing after 22s
2026-01-06 18:12:55 -03:00
77d992720d Added postgres to the workflow just to see if it works
Some checks failed
Compile / Compile (push) Failing after 31s
2026-01-06 18:10:45 -03:00
eed6a9d9f6 Changed "export" to env
Some checks failed
Compile / Compile (push) Failing after 18s
2026-01-06 18:05:30 -03:00
9dc1cf10c7 Updated Set Token workflow to correct variables
Some checks failed
Compile / Compile (push) Failing after 23s
2026-01-06 17:56:04 -03:00
70e21fd118 Testing Gitea's Secrets
Some checks failed
Compile / Compile (push) Failing after 25s
2026-01-06 17:52:54 -03:00
4c06e3fbbd Added "gem install bundler" because it does not come with Ruby by default
Some checks failed
Compile / Compile (push) Failing after 19s
2026-01-06 17:41:49 -03:00
28529158e5 Added "apt-get update" to Install Ruby workflow
Some checks failed
Compile / Compile (push) Failing after 15s
2026-01-06 17:39:49 -03:00
13dbb86d38 Updated workflow: Install ruby first -> Install dependencies -> Run main file
Some checks failed
Compile / Compile (push) Failing after 5s
2026-01-06 17:37:33 -03:00
504773b1ca Changed "uses" to "run" 'cause I'm a bit dummy
Some checks failed
Compile / Compile (push) Failing after 4s
2026-01-06 17:33:14 -03:00
659bd70c75 Workflow added for testing purposes
Some checks failed
Compile / Compile (push) Failing after 4s
2026-01-06 17:31:10 -03:00
2 changed files with 50 additions and 1 deletions

View File

@@ -0,0 +1,45 @@
name: Compile
run-name: Compiling software (Ubuntu)
on: [push]
jobs:
Compile:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_DB: fgbot_db
POSTGRES_USER: postgres
POSTGRES_PASSWORD: test_password
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Ruby and Bundler
run: |
apt-get update
apt-get install -y ruby-full libsodium-dev libpq-dev
gem install bundler
- name: Install dependencies
run: bundle install
- name: Execute program
env:
BOT_TOKEN: ${{ secrets.TOKEN }}
TEST_SERVER_ID: ${{ secrets.SERVER_ID }}
DB_HOST: 127.0.0.1
DB_USER: postgres
DB_PASS: test_password
DB_NAME: fgbot_db
run: bundle exec ruby main.rb

View File

@@ -19,7 +19,11 @@ require 'pg'
class Database
def initialize
# Connect once when the bot starts
@conn = PG.connect(dbname: 'fgbot_db')
@conn = PG.connect(
host: ENV['DB_HOST'] || 'localhost',
dbname: ENV['DB_NAME'] || 'fgbot_db',
user: ENV['DB_USER'] || 'postgres'
)
init_tables
end