Skip to content

Commit

Permalink
add ci template
Browse files Browse the repository at this point in the history
  • Loading branch information
k0va1 committed Aug 18, 2024
1 parent d738e3c commit b1b337a
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 0 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Verify
on: [push]

jobs:
tests:
name: Tests
runs-on: ubuntu-latest
container:
image: ruby:3.2.2

services:
postgres:
image: postgres:15.0
env:
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:7.0
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Gem cache
id: cache-bundle
uses: actions/cache@v1
with:
path: vendor/bundle
key: bundle-${{ hashFiles('**/Gemfile.lock') }}

- name: Bundle install
env:
RAILS_ENV: test
run: |
gem install bundler
bundle config set --local path 'vendor/bundle'
bundle install --jobs 4 --retry 3
- name: Run linters
run: bundle exec rake standard

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 20

- name: Install yarn
run: npm install -g yarn

# NOTE: Yarn cache doesn't seem to be working quite yet
- name: Get yarn cache dir
id: yarn-cache-dir
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Yarn cache
id: cache-yarn
uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache-dir.outputs.dir }}
key: yarn-${{ hashFiles('**/yarn.lock') }}

- name: Yarn install
run: yarn install --pure-lockfile

- name: Run tests
run: |
bundle exec rails db:setup
bundle exec rake assets:precompile
bundle exec rspec
env:
RAILS_ENV: test
2 changes: 2 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ prepare_for_deploy () {
sed -i '' "s/<prod_ip>/$prod_ip/g" config/deploy.yml
sed -i '' "s/hetsketch/$dockerhub_username/g" config/deploy.yml
sed -i '' "s/lightning_rails/$project_name/g" config/deploy.yml
echo "Copying templates/ci.yml"
mv templates/ci.yml .github/workflows/ci.yml
}

rename_dependencies () {
Expand Down
File renamed without changes.

0 comments on commit b1b337a

Please sign in to comment.