Swap to gitea actions (#13)

Reviewed-on: #13
This commit is contained in:
Andrew Tomaka 2024-07-05 00:34:58 -04:00
parent 72ffe7215d
commit 3d04294c09
3 changed files with 59 additions and 96 deletions

View file

@ -1,96 +0,0 @@
name: default
kind: pipeline
steps:
- name: install
image: ruby:3.3.1
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- bin/bundle install --jobs=3 --retry=3
- name: autoload
image: ruby:3.3.1
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- bin/rails zeitwerk:check
depends_on:
- install
- name: lint
image: ruby:3.3.1
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- bin/rubocop
depends_on:
- install
- name: brakeman
image: ruby:3.3.1
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- bin/brakeman
depends_on:
- install
- name: test
image: ruby:3.3.1
volumes:
- name: bundle
path: /usr/local/bundle
commands:
- bin/rails assets:precompile
- bin/rails test
depends_on:
- install
volumes:
- name: bundle
temp: {}
trigger:
branch:
exclude: master
event: push
---
name: deploy
kind: pipeline
steps:
- name: docker-build
image: plugins/docker
environment:
SECRET_KEY_BASE:
from_secret: secret_key_base
RAILS_MASTER_KEY:
from_secret: rails_master_key
settings:
pull_image: true
registry: docker.atomaka.com
repo: docker.atomaka.com/budget
tags:
- latest
- ${DRONE_TAG}
- name: deploy
image: appleboy/drone-ssh
settings:
host:
from_secret: unraid_host
username:
from_secret: unraid_username
key:
from_secret: unraid_ssh_key
script:
- docker pull docker.atomaka.com/budget:latest
- docker restart budget
trigger:
event: tag

View file

@ -0,0 +1,26 @@
name: Deploy
on:
tag:
jobs:
deploy:
runs-on: cth-ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Push image
uses: docker/build-push-action@v6
with:
push: true
tags: |
docker.atomaka.com/budget:latest
docker.atomaka.com/budget:${{gitea.sha}}
- name: Deploy to server
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
script: |
bash "/boot/config/plugins/user.scripts/scripts/deploy budget/script"

View file

@ -0,0 +1,33 @@
name: Ruby CI
on:
pull_request:
jobs:
test:
runs-on: cth-ubuntu-latest
steps:
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3.1
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install dependencies
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: autoload
run: bin/rails zeitwerk:check
- name: lint
run: bin/rubocop
- name: security
run: bin/brakeman
- name: test
run: |
bin/rails assets:precompile
bin/rails test