Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
76ba387
initial project creation
wendelfabianchinsamy Mar 4, 2025
32dba93
rubocop autofixes
wendelfabianchinsamy Mar 4, 2025
606af24
rubocop fixes
wendelfabianchinsamy Mar 5, 2025
b3ea9af
configure rubocop
wendelfabianchinsamy Mar 5, 2025
e859cd0
add git actions
wendelfabianchinsamy Mar 6, 2025
ee3c1cf
Delete config/master.key
wendelfabianchinsamy Mar 6, 2025
8faaced
Delete config/credentials.yml.enc
wendelfabianchinsamy Mar 6, 2025
41f4b97
merge from remote
wendelfabianchinsamy Mar 6, 2025
06c7c05
changes to git actions
wendelfabianchinsamy Mar 6, 2025
b6e518e
fix git action
wendelfabianchinsamy Mar 6, 2025
1dadefa
fix git actions
wendelfabianchinsamy Mar 6, 2025
2702fef
fix git action
wendelfabianchinsamy Mar 6, 2025
2b64887
comment out modules in the model temporarily
wendelfabianchinsamy Mar 6, 2025
bd3c1da
fix git action
wendelfabianchinsamy Mar 6, 2025
ee834a8
fix git action
wendelfabianchinsamy Mar 6, 2025
ec01e8f
fix git action
wendelfabianchinsamy Mar 6, 2025
425cccb
fix specs
wendelfabianchinsamy Mar 7, 2025
8f791f2
rework git action
wendelfabianchinsamy Mar 7, 2025
9b351f6
add shoryuken changes
wendelfabianchinsamy Mar 11, 2025
ebbefb5
rubocop changes
wendelfabianchinsamy Mar 12, 2025
96f46ee
disable tagged logging
wendelfabianchinsamy Mar 12, 2025
6f95e65
fix logging
wendelfabianchinsamy Mar 12, 2025
3531039
test build
wendelfabianchinsamy Mar 17, 2025
bf88011
work around the log_level issue
wendelfabianchinsamy Mar 17, 2025
de91b35
log workaround
wendelfabianchinsamy Mar 17, 2025
7a833ae
fix github action env vars
wendelfabianchinsamy Mar 17, 2025
b5198c8
fix github action env vars
wendelfabianchinsamy Mar 17, 2025
e043065
fix github action env vars
wendelfabianchinsamy Mar 17, 2025
1ed3d23
fix specs
wendelfabianchinsamy Mar 17, 2025
ef873d1
skip db checks for specs
wendelfabianchinsamy Mar 17, 2025
d4906a0
update gemfile.lock
wendelfabianchinsamy Mar 17, 2025
2c985da
fix specs
wendelfabianchinsamy Mar 17, 2025
e660046
add log_level env var for specs
wendelfabianchinsamy Mar 17, 2025
be11570
attempt of fixing ci
wendelfabianchinsamy Mar 18, 2025
5f3ebd0
attempt to skip db checks for specs
wendelfabianchinsamy Mar 18, 2025
e52d71e
remove nulldb config
wendelfabianchinsamy Mar 18, 2025
560e50e
fix specs
wendelfabianchinsamy Mar 18, 2025
0819085
fix specs
wendelfabianchinsamy Mar 18, 2025
9cf5840
fix specs
wendelfabianchinsamy Mar 18, 2025
81d86b6
fix specs
wendelfabianchinsamy Mar 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/_update_terraform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Update Terraform
on:
workflow_call:
secrets:
PERSONAL_ACCESS_TOKEN:
required: true
inputs:
image_tag:
description: Tag for the image for docker/ghcr registries
required: true
type: string
deployment_environment:
description: The terraform target environment
required: true
type: string
default: staging
jobs:
update:
runs-on: ubuntu-latest
env:
GIT_SHA: ${{ github.sha }}
GIT_TAG: ${{ inputs.image_tag }}
steps:
- name: Checkout terraform config repo
uses: actions/checkout@v4
with:
# public repo with terraform configuration
repository: "datacite/mastino"
persist-credentials: false
- name: Setup dokerize and template parameters
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
wget https://github.com/jwilder/dockerize/releases/download/v0.6.0/dockerize-linux-amd64-v0.6.0.tar.gz
tar -xzvf dockerize-linux-amd64-v0.6.0.tar.gz
rm dockerize-linux-amd64-v0.6.0.tar.gz

- name: Conditionally update staging environment
if: ${{ (inputs.deployment_environment == 'staging') }}
run: |
./dockerize -template stage/services/client-api/_events.auto.tfvars.tmpl:stage/services/client-api/_events.auto.tfvars
git add stage/services/client-api/_events.auto.tfvars
git commit -m "Adding events git variables for commit ${{ github.sha }}"

- name: Conditionally update production/test environments
if: ${{ (inputs.deployment_environment == 'production') }}
run: |
./dockerize -template prod-eu-west/services/client-api/_events.auto.tfvars.tmpl:prod-eu-west/services/client-api/_events.auto.tfvars
./dockerize -template test/services/client-api/_events.auto.tfvars.tmpl:test/services/client-api/_events.auto.tfvars

git add prod-eu-west/services/client-api/_events.auto.tfvars
git add test/services/client-api/_events.auto.tfvars
git commit -m "Adding events git variables for tag ${{ inputs.image_tag }}"
- name: Push changes
uses: ad-m/github-push-action@v0.8.0
with:
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
repository: "datacite/mastino"
branch: "refs/heads/master"
tags: false
23 changes: 23 additions & 0 deletions .github/workflows/branch_to_staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build/Deploy Branch to Staging
on:
workflow_dispatch:
jobs:
lint:
uses: ./.github/workflows/rubocop.yml
test:
uses: ./.github/workflows/parallel_ci.yml
secrets: inherit
call_build_and_push:
needs: test
uses: ./.github/workflows/build.yml
with:
image_name: ${{ github.repository }}
image_tag: ${{ github.ref_name }}
secrets: inherit
deploy:
needs: [test, call_build_and_push]
uses: ./.github/workflows/_update_terraform.yml
with:
image_tag: ${{ github.ref_name }}
deployment_environment: staging
secrets: inherit
54 changes: 54 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build and Tag
on:
workflow_call:
secrets:
DOCKERHUB_USERNAME:
required: true
DOCKERHUB_TOKEN:
required: true
inputs:
image_name:
description: The name of the image for docker/ghcr registries
required: true
type: string
image_tag:
description: Tag for the image for docker/ghcr registries
required: true
type: string
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: |
${{ inputs.image_name }}:${{ inputs.image_tag }}
ghcr.io/${{ inputs.image_name }}:${{ inputs.image_tag }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
25 changes: 25 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Deploy Main to Staging
on:
push:
branches:
- main
jobs:
lint:
uses: ./.github/workflows/rubocop.yml
test:
uses: ./.github/workflows/parallel_ci.yml
secrets: inherit
call_build_and_push:
needs: test
uses: ./.github/workflows/build.yml
with:
image_name: ${{ github.repository }}
image_tag: main
secrets: inherit
deploy:
needs: [test, call_build_and_push]
uses: ./.github/workflows/_update_terraform.yml
with:
image_tag: main
deployment_environment: staging
secrets: inherit
32 changes: 32 additions & 0 deletions .github/workflows/parallel_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Parallel CI
on:
workflow_call:
jobs:
parallel-test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
services:
memcached:
image: memcached:1.4.31
ports:
- 11211/udp
env:
LOG_LEVEL: "error"
MYSQL_HOST: "127.0.0.1"
MYSQL_DATABASE: datacite
MYSQL_USER: root
ES_HOST: "localhost:9200"
ELASTIC_PASSWORD: "AnUnsecurePassword123"
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Set up Ruby 3.1.6
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1.6"
bundler-cache: true

- name: Run Specs
run: bundle exec rspec
13 changes: 13 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Lint and Test Pull Request
on:
pull_request:
branches:
- main
workflow_dispatch:
jobs:
lint:
uses: ./.github/workflows/rubocop.yml
parallel-test:
needs: lint
uses: ./.github/workflows/parallel_ci.yml
secrets: inherit
24 changes: 24 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Release to Production
on:
release:
types: [published]
jobs:
lint:
uses: ./.github/workflows/rubocop.yml
test:
uses: ./.github/workflows/parallel_ci.yml
secrets: inherit
call_build_and_push:
needs: test
uses: ./.github/workflows/build.yml
with:
image_name: ${{ github.repository }}
image_tag: ${{ github.ref_name }}
secrets: inherit
deploy:
needs: [test, call_build_and_push]
uses: ./.github/workflows/_update_terraform.yml
with:
image_tag: ${{ github.ref_name }}
deployment_environment: production
secrets: inherit
29 changes: 29 additions & 0 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: RuboCop

on:
workflow_call:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Ruby 3.0
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.6
- name: Cache gems
uses: actions/cache@v4
with:
path: vendor/bundle
key: ${{ runner.os }}-rubocop-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-rubocop-
- name: Install gems
run: |
bundle config path vendor/bundle
bundle config set without 'default doc job cable storage ujs test db'
bundle install --jobs 4 --retry 3
- name: Run RuboCop
run: bundle exec rubocop --parallel
58 changes: 58 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'

# Ignore bundler config.
/.bundle

# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

.byebug_history
.DS_Store
.svn
*.rbc
*.sassc
.sass-cache
capybara-*.html
.rspec
/.bundle
/.capistrano
/vendor/node_modules/*
/vendor/bower_components/*
/vendor/npm-debug.log
/vendor/bundle/*
/log/*
/tmp/*
/data/*
/db/*.sqlite3
/public/*
!/public/.keep
/coverage/
/spec/tmp/
/config/data_bags/*
**.orig
rerun.txt
pickle-email-*.html
.idea/*
erl_crash.dump
optimise-db.txt
doc/dependencies*
.env
.env.*
!.env.example
!.env.travis
!.env.build
docker-compose.override.yml
.vscode
.solargraph.yml
.devspace
31 changes: 31 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
inherit_gem:
rubocop-shopify: rubocop.yml

plugins:
- rubocop-performance
- rubocop-rails
- rubocop-rspec

require:
- rubocop-factory_bot

AllCops:
TargetRubyVersion: 3.0
Exclude:
- "bin/**/*"
- "log/**/*"
- "tmp/**/*"
- "vendor/**/*"
- "db/schema.rb"

Style/MethodCallWithArgsParentheses:
EnforcedStyle: require_parentheses

Style/StringLiterals:
EnforcedStyle: double_quotes

Style/StringLiteralsInInterpolation:
EnforcedStyle: double_quotes

Layout/SpaceInsideHashLiteralBraces:
Enabled: true
Loading