-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
201 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
name: ci | ||
on: | ||
push: | ||
branches: ["main"] | ||
tags: | ||
- "*" | ||
pull_request: | ||
branches: ["main"] | ||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
services: | ||
postgres: | ||
image: postgres:16.4-alpine | ||
ports: | ||
- "5432:5432" | ||
env: | ||
POSTGRES_DB: opengas_test | ||
POSTGRES_USER: opengas | ||
POSTGRES_PASSWORD: opengas | ||
env: | ||
RAILS_ENV: test | ||
DATABASE_URL: "postgres://opengas:opengas@localhost:5432/opengas_test" | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Install Ruby and gems | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 3.3.4 | ||
bundler-cache: true | ||
- name: Set up database schema | ||
run: bin/rails db:schema:load | ||
- name: Run tests | ||
run: bin/rails test | ||
|
||
system-tests: | ||
runs-on: ubuntu-latest | ||
services: | ||
postgres: | ||
image: postgres:16.4-alpine | ||
ports: | ||
- "5432:5432" | ||
env: | ||
POSTGRES_DB: opengas_test | ||
POSTGRES_USER: opengas | ||
POSTGRES_PASSWORD: opengas | ||
env: | ||
RAILS_ENV: test | ||
DATABASE_URL: "postgres://opengas:opengas@localhost:5432/opengas_test" | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Install Ruby and gems | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 3.3.4 | ||
bundler-cache: true | ||
- name: Set up database schema | ||
run: bin/rails db:schema:load | ||
- name: Run tests | ||
run: bin/rails test:system | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Install Ruby and gems | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 3.3.4 | ||
bundler-cache: true | ||
- name: Security audit dependencies | ||
run: bundle exec bundler-audit --update | ||
- name: Security audit | ||
run: bundle exec bundle audit | ||
- name: Security audit application code | ||
run: bin/brakeman -q -w2 | ||
- name: Lint Ruby files | ||
run: bin/rubocop --parallel | ||
|
||
build: | ||
needs: [tests, system-tests, lint] | ||
if: ${{ github.ref_type == 'tag' }} | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
DOCKER_BUILDKIT: 1 | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Set up Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 3.3.4 | ||
bundler-cache: true | ||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: baldarn | ||
password: ${{ secrets.KAMAL_REGISTRY_PASSWORD }} | ||
- name: Build image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
builder: ${{ steps.buildx.outputs.name }} | ||
push: true | ||
build-args: | | ||
APP_VERSION=${{ github.ref_name }} | ||
labels: | | ||
"service=open-gas" | ||
tags: | | ||
baldarn/open-gas:latest | ||
baldarn/open-gas:${{ github.ref_name }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
deploy: | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
concurrency: | ||
group: deploy | ||
cancel-in-progress: true | ||
|
||
env: | ||
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} | ||
KAMAL_REGISTRY_PASSWORD: ${{ secrets.KAMAL_REGISTRY_PASSWORD }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Set up Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 3.3.4 | ||
bundler-cache: true | ||
- uses: webfactory/[email protected] | ||
with: | ||
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
- name: Deploy command | ||
run: bundle exec kamal deploy --skip-push --version ${{ github.ref_name }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Kamal Command | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
command: | ||
description: "Kamal command to run" | ||
default: "kamal app details" | ||
|
||
jobs: | ||
Command: | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} | ||
KAMAL_REGISTRY_PASSWORD: ${{ secrets.KAMAL_REGISTRY_PASSWORD }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- uses: webfactory/[email protected] | ||
with: | ||
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
- name: Set up Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: 3.3.4 | ||
- name: Run KAMAL command | ||
run: ${{ github.event.inputs.command }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ AllCops: | |
Exclude: | ||
- bin/* | ||
- db/schema.rb | ||
- vendor/**/* | ||
|
||
Style/Documentation: | ||
Enabled: false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,21 @@ | ||
|
||
<div class="container-fluid"> | ||
<footer class="d-flex flex-wrap justify-content-between align-items-center py-3 my-4 border-top"> | ||
<div class="col-4 d-flex align-items-center"> | ||
<a href="https://github.com/baldarn/open-GAS"> | ||
<%= image_tag "github.svg", aria: { hidden: true }, size: 45, class: "bi d-block mx-auto mb-1" %> | ||
</div> | ||
<div class="nav col-md-4 justify-content-end list-unstyled d-flex"> | ||
<a href="https://www.iubenda.com/privacy-policy/35860933" class="iubenda-white iubenda-noiframe iubenda-embed iubenda-noiframe " title="Privacy Policy ">Privacy Policy</a><script type="text/javascript"> | ||
(function (w,d) {var loader = function () {var s = d.createElement("script"), tag = d.getElementsByTagName("script")[0]; s.src="https://cdn.iubenda.com/iubenda.js"; tag.parentNode.insertBefore(s,tag);}; if(w.addEventListener){w.addEventListener("load", loader, false);}else if(w.attachEvent){w.attachEvent("onload", loader);}else{w.onload = loader;}})(window, document); | ||
</script> | ||
<a href="https://www.iubenda.com/privacy-policy/35860933/cookie-policy" class="iubenda-white iubenda-noiframe iubenda-embed iubenda-noiframe " title="Cookie Policy ">Cookie Policy</a><script type="text/javascript"> | ||
(function (w,d) {var loader = function () {var s = d.createElement("script"), tag = d.getElementsByTagName("script")[0]; s.src="https://cdn.iubenda.com/iubenda.js"; tag.parentNode.insertBefore(s,tag);}; if(w.addEventListener){w.addEventListener("load", loader, false);}else if(w.attachEvent){w.attachEvent("onload", loader);}else{w.onload = loader;}})(window, document); | ||
</script> | ||
</div> | ||
</a> | ||
<% if ENV['APP_VERSION'].present? %> | ||
<span style='margin-left: 10px;'>v<%= ENV['APP_VERSION'] %></span> | ||
<% end %> | ||
</div> | ||
</footer> | ||
<div class="nav col-md-4 justify-content-end list-unstyled d-flex"> | ||
<a href="https://www.iubenda.com/privacy-policy/35860933" class="iubenda-white iubenda-noiframe iubenda-embed iubenda-noiframe " title="Privacy Policy ">Privacy Policy</a><script type="text/javascript"> | ||
(function (w,d) {var loader = function () {var s = d.createElement("script"), tag = d.getElementsByTagName("script")[0]; s.src="https://cdn.iubenda.com/iubenda.js"; tag.parentNode.insertBefore(s,tag);}; if(w.addEventListener){w.addEventListener("load", loader, false);}else if(w.attachEvent){w.attachEvent("onload", loader);}else{w.onload = loader;}})(window, document); | ||
</script> | ||
<a href="https://www.iubenda.com/privacy-policy/35860933/cookie-policy" class="iubenda-white iubenda-noiframe iubenda-embed iubenda-noiframe " title="Cookie Policy ">Cookie Policy</a><script type="text/javascript"> | ||
(function (w,d) {var loader = function () {var s = d.createElement("script"), tag = d.getElementsByTagName("script")[0]; s.src="https://cdn.iubenda.com/iubenda.js"; tag.parentNode.insertBefore(s,tag);}; if(w.addEventListener){w.addEventListener("load", loader, false);}else if(w.attachEvent){w.attachEvent("onload", loader);}else{w.onload = loader;}})(window, document); | ||
</script> | ||
</div> | ||
</div> | ||
</footer> | ||
</div> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.