mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-21 23:06:22 +00:00
128 lines
3 KiB
YAML
128 lines
3 KiB
YAML
stages:
|
|
- "test"
|
|
- "deploy"
|
|
.apk-add: &apk-add
|
|
- "apk add go-task diffutils gitlab_ci_log_section"
|
|
.disable-hainish: &disable-hainish
|
|
- "rm -f .env.development"
|
|
.cache-ruby: &cache-ruby
|
|
- paths:
|
|
- "vendor/ruby"
|
|
- ".bundle"
|
|
key:
|
|
files:
|
|
- "Gemfile.lock"
|
|
.cache-node: &cache-node
|
|
- paths:
|
|
- "node_modules"
|
|
key:
|
|
files:
|
|
- "yarn.lock"
|
|
.cache-task: &cache-task
|
|
- paths:
|
|
- ".task"
|
|
image: "registry.0xacab.org/sutty/sutty:3.17.3-3.1.4-rails"
|
|
variables:
|
|
RAILS_ENV: "production"
|
|
LC_ALL: "C.UTF-8"
|
|
HAINISH: ""
|
|
cache:
|
|
push:
|
|
stage: "test"
|
|
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}"
|
|
assets:
|
|
stage: "deploy"
|
|
only:
|
|
- "rails"
|
|
- "production.panel.sutty.nl"
|
|
- "panel.sutty.nl"
|
|
- "panel.testing.sutty.nl"
|
|
except:
|
|
- "schedules"
|
|
cache:
|
|
- *cache-ruby
|
|
- *cache-node
|
|
- *cache-task
|
|
before_script:
|
|
- *apk-add
|
|
- "gitlab_ci_log_section --name git --header=\"Configuring git\""
|
|
- "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\""
|
|
- "gitlab_ci_log_section --name git --end"
|
|
- "gitlab_ci_log_section --name apk --header=\"Installing dependencies\""
|
|
- "apk add brotli"
|
|
- *disable-hainish
|
|
- "gitlab_ci_log_section --name apk --end"
|
|
script:
|
|
- "gitlab_ci_log_section --name assets --header=\"Building\""
|
|
- "go-task assets"
|
|
after_script:
|
|
- "git add public && git commit -m \"ci: assets [skip ci]\""
|
|
- "git push -o ci.skip origin HEAD:${CI_COMMIT_BRANCH}"
|
|
gem-audit:
|
|
stage: "test"
|
|
only:
|
|
- "schedules"
|
|
cache:
|
|
- *cache-ruby
|
|
before_script:
|
|
- *apk-add
|
|
- *disable-hainish
|
|
script:
|
|
- "go-task gem-audit"
|
|
node-audit:
|
|
stage: "test"
|
|
only:
|
|
- "schedules"
|
|
cache:
|
|
- *cache-node
|
|
before_script:
|
|
- *apk-add
|
|
- *disable-hainish
|
|
script:
|
|
- "apk add go-task"
|
|
- "go-task node-audit"
|
|
brakeman:
|
|
stage: "test"
|
|
cache:
|
|
- *cache-ruby
|
|
rules:
|
|
- if: "$CI_PIPELINE_SOURCE == 'merge_request_event'"
|
|
before_script:
|
|
- *apk-add
|
|
- *disable-hainish
|
|
script:
|
|
- "go-task bundle -- exec brakeman"
|
|
rubocop:
|
|
stage: "test"
|
|
cache:
|
|
- *cache-ruby
|
|
rules:
|
|
- if: "$CI_PIPELINE_SOURCE == 'merge_request_event'"
|
|
before_script:
|
|
- *apk-add
|
|
- *disable-hainish
|
|
script:
|
|
- "go-task rubocop"
|
|
haml:
|
|
stage: "test"
|
|
cache:
|
|
- *cache-ruby
|
|
rules:
|
|
- if: "$CI_PIPELINE_SOURCE == 'merge_request_event'"
|
|
before_script:
|
|
- *apk-add
|
|
- *disable-hainish
|
|
script:
|
|
- "go-task haml-lint"
|