Update sass to version 1.83.0 #212
Workflow file for this run
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
name: Rails boilerplate CI/CD Pipeline | |
# This workflow is triggered on pushes to the repository | |
on: push | |
env: | |
RUBY_VERSION: 3.1.2 | |
NODE_VERSION: 18.8.0 | |
PGHOST: localhost | |
PGUSER: postgres | |
RAILS_ENV: test | |
REDIS_HOST: localhost | |
REDIS_PORT: 6379 | |
jobs: | |
ci: | |
runs-on: ubuntu-latest | |
# Service containers to run with container-job | |
services: | |
# Label used to access the service container | |
postgres: | |
# Docker Hub image | |
image: postgres:11.5 | |
ports: ["5432:5432"] | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
redis: | |
image: redis | |
ports: ['6379:6379'] | |
options: --entrypoint redis-server | |
steps: | |
# Downloads a copy of the code in your repository before running CI tests | |
- uses: actions/checkout@v3 | |
- name: Setup ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ env.RUBY_VERSION }} | |
bundler-cache: true | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{env.NODE_VERSION}} | |
# Note: It is not recommended to cache node_modules, as it can break across Node versions and won't work with npm ci | |
- name: Cache node_modules | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: yarn-packages-{{ checksum "yarn.lock" }} | |
restore-keys: yarn-packages- | |
# installation and build then run test | |
- name: Install yarn packages | |
run: yarn install | |
- name: Build test env | |
run: | | |
gem install bundler | |
bundle install --jobs=4 --retry=3 --path vendor/bundle | |
bundle exec rails db:create | |
bundle exec rails db:migrate | |
- name: Run backend test | |
id: rspec | |
run: bundle exec rspec | |
continue-on-error: true | |
- name: Set message if success | |
if: steps.rspec.outcome == 'success' | |
run: echo "ci_message=Success" >> $GITHUB_ENV | |
- name: Set message if code backend fail | |
if: steps.rspec.outcome == 'failure' | |
run: echo "ci_message= Some test in backend fail" >> $GITHUB_ENV | |
- name: send telegram message on push | |
uses: appleboy/telegram-action@master | |
with: | |
to: ${{ secrets.TELEGRAM_TO }} | |
token: ${{ secrets.TELEGRAM_TOKEN }} | |
message: | | |
${{ github.actor }} created commit: | |
Commit message: ${{ github.event.commits[0].message }} | |
CI state: ${{ env.ci_message }} | |
Repository: ${{ github.repository }} | |
See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}} | |
# Break CI pipeline when error occur | |
- name: Exit if fail | |
if: steps.rspec.outcome == 'failure' || steps.jest.outcome == 'failure' | |
run: exit 1 | |
cd: | |
runs-on: ubuntu-latest | |
needs: ci | |
if: github.ref == 'refs/heads/develop' && success() | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ env.RUBY_VERSION }} | |
bundler-cache: true | |
- name: Setup file | |
run: | | |
echo ${{ secrets.MASTER_KEY }} > config/master.key | |
# scan all keyscan in github | |
- name: Setup known_hosts | |
run: | | |
mkdir -p ~/.ssh | |
ssh-keyscan github.com >> ~/.ssh/known_hosts | |
- name: Bundle install | |
run: bundle install --jobs=4 --retry=3 --path vendor/bundle | |
# More information, please visit here: https://github.com/marketplace/actions/capistrano-deploy | |
- name: Cap production deploy | |
uses: miloserdow/capistrano-deploy@master | |
with: | |
target: production | |
deploy_key: ${{ secrets.PASSWORD }} | |
enc_rsa_key_val: ${{ secrets.ENC_RSA_KEY_VAL }} | |
# Set message env for success or failure | |
- if: success() | |
run: echo "message=Congratulations on your successful release for staging" >> $GITHUB_ENV | |
- if: failure() | |
run: echo "message=Deploy failed, Please try again or deploy manually" >> $GITHUB_ENV | |
# Noti to slack for success or failure | |
- name: send telegram message on deploy | |
uses: appleboy/telegram-action@master | |
with: | |
to: ${{ secrets.TELEGRAM_TO }} | |
token: ${{ secrets.TELEGRAM_TOKEN }} | |
message: | | |
${{ github.actor }} created commit: | |
Commit message: ${{ github.event.commits[0].message }} | |
Repository: ${{ github.repository }} | |
CD State: ${{ env.message }} | |
See changes: https://github.com/${{ github.repository }}/commit/${{github.sha}} |