5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-24 07:16:22 +00:00
panel/.gitlab-ci.yml

128 lines
2.9 KiB
YAML
Raw Permalink Normal View History

stages:
- "test"
- "deploy"
2024-01-08 21:18:15 +00:00
.apk-add: &apk-add
- "apk add go-task diffutils gitlab_ci_log_section"
2024-01-08 21:15:36 +00:00
.disable-hainish: &disable-hainish
2024-01-08 21:32:33 +00:00
- "rm -f .env.development"
2024-01-08 21:30:22 +00:00
.cache-ruby: &cache-ruby
- paths:
- "vendor/ruby"
- ".bundle"
key:
files:
- "Gemfile.lock"
2024-01-08 21:30:22 +00:00
.cache-node: &cache-node
- paths:
- "node_modules"
key:
files:
- "yarn.lock"
2024-01-08 21:30:22 +00:00
.cache-task: &cache-task
- paths:
- ".task"
2024-01-11 14:22:13 +00:00
image: "registry.0xacab.org/sutty/sutty:3.17.3-3.1.4-rails"
2023-04-15 15:23:43 +00:00
variables:
RAILS_ENV: "production"
LC_ALL: "C.UTF-8"
HAINISH: ""
2023-04-15 15:23:43 +00:00
cache:
2024-05-09 15:18:25 +00:00
push:
stage: "test"
2024-05-09 15:18:25 +00:00
only:
- "rails"
except:
- "schedules"
before_script:
- "git config --global user.email \"${GIT_USER_EMAIL:-$GITLAB_USER_EMAIL}\""
- "git config --global user.name \"${GIT_USER_NAME:-$GITLAB_USER_NAME}\""
- "git remote set-url --push origin \"https://GITLAB_CI_PUSH_TOKEN:${GITLAB_CI_PUSH_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git\""
script:
- "git commit --allow-empty -m \"ci: test [skip ci]\""
- "git push -o ci.skip origin HEAD:${CI_COMMIT_BRANCH}"
2023-04-15 15:23:43 +00:00
assets:
2024-01-08 21:00:52 +00:00
stage: "deploy"
2024-01-08 21:55:49 +00:00
only:
- "rails"
- "production.panel.sutty.nl"
- "panel.sutty.nl"
2024-01-12 13:25:58 +00:00
except:
- "schedules"
2024-01-08 21:30:22 +00:00
cache:
- *cache-ruby
- *cache-node
- *cache-task
2023-04-15 15:23:43 +00:00
before_script:
- *apk-add
- "gitlab_ci_log_section --name git --header=\"Configuring git\""
2023-04-15 15:23:43 +00:00
- "git config --global user.email \"${GIT_USER_EMAIL:-$GITLAB_USER_EMAIL}\""
- "git config --global user.name \"${GIT_USER_NAME:-$GITLAB_USER_NAME}\""
2024-05-09 15:03:38 +00:00
- "git remote set-url --push origin \"https://GITLAB_CI_PUSH_TOKEN:${GITLAB_CI_PUSH_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git\""
- "gitlab_ci_log_section --name git --end"
- "gitlab_ci_log_section --name apk --header=\"Installing dependencies\""
2024-01-08 21:18:15 +00:00
- "apk add brotli"
2024-01-08 21:15:36 +00:00
- *disable-hainish
- "gitlab_ci_log_section --name apk --end"
2023-04-15 15:23:43 +00:00
script:
- "gitlab_ci_log_section --name assets --header=\"Building\""
2024-01-08 18:07:59 +00:00
- "go-task assets"
2023-04-15 15:23:43 +00:00
after_script:
- "git add public && git commit -m \"ci: assets [skip ci]\""
2024-05-02 19:34:54 +00:00
- "git push -o ci.skip origin HEAD:${CI_COMMIT_BRANCH}"
2024-01-08 20:36:39 +00:00
gem-audit:
2024-01-08 20:59:27 +00:00
stage: "test"
2024-01-08 21:55:49 +00:00
only:
- "schedules"
2024-01-08 21:30:22 +00:00
cache:
- *cache-ruby
2024-01-08 20:36:39 +00:00
before_script:
2024-01-08 21:18:15 +00:00
- *apk-add
2024-01-08 21:15:36 +00:00
- *disable-hainish
2024-01-08 20:36:39 +00:00
script:
- "go-task gem-audit"
node-audit:
2024-01-08 20:59:27 +00:00
stage: "test"
2024-01-08 21:55:49 +00:00
only:
- "schedules"
2024-01-08 21:30:22 +00:00
cache:
- *cache-node
2024-01-08 21:15:36 +00:00
before_script:
2024-01-08 21:18:15 +00:00
- *apk-add
2024-01-08 21:15:36 +00:00
- *disable-hainish
2024-01-08 20:36:39 +00:00
script:
2024-01-08 20:52:00 +00:00
- "apk add go-task"
2024-01-08 20:36:39 +00:00
- "go-task node-audit"
2024-01-08 20:52:00 +00:00
brakeman:
2024-01-08 20:59:27 +00:00
stage: "test"
2024-01-08 21:30:22 +00:00
cache:
- *cache-ruby
2024-01-08 20:52:00 +00:00
rules:
2024-01-08 21:15:36 +00:00
- if: "$CI_PIPELINE_SOURCE == 'merge_request_event'"
2024-01-08 20:52:00 +00:00
before_script:
2024-01-08 21:18:15 +00:00
- *apk-add
2024-01-08 21:15:36 +00:00
- *disable-hainish
2024-01-08 20:52:00 +00:00
script:
- "go-task bundle -- exec brakeman"
rubocop:
2024-01-08 20:59:27 +00:00
stage: "test"
2024-01-08 21:30:22 +00:00
cache:
- *cache-ruby
2024-01-08 20:52:00 +00:00
rules:
2024-01-08 21:15:36 +00:00
- if: "$CI_PIPELINE_SOURCE == 'merge_request_event'"
2024-01-08 20:52:00 +00:00
before_script:
2024-01-08 21:18:15 +00:00
- *apk-add
2024-01-08 21:15:36 +00:00
- *disable-hainish
2024-01-08 20:52:00 +00:00
script:
- "go-task rubocop"
2024-01-08 20:52:00 +00:00
haml:
2024-01-08 20:59:27 +00:00
stage: "test"
2024-01-08 21:30:22 +00:00
cache:
- *cache-ruby
2024-01-08 20:52:00 +00:00
rules:
2024-01-08 21:15:36 +00:00
- if: "$CI_PIPELINE_SOURCE == 'merge_request_event'"
2024-01-08 20:52:00 +00:00
before_script:
2024-01-08 21:18:15 +00:00
- *apk-add
2024-01-08 21:15:36 +00:00
- *disable-hainish
2024-01-08 20:52:00 +00:00
script:
- "go-task haml-lint"