59 lines
1.4 KiB
YAML
59 lines
1.4 KiB
YAML
|
name: Minimal CI
|
||
|
|
||
|
on: [push]
|
||
|
|
||
|
jobs:
|
||
|
test:
|
||
|
runs-on: docker
|
||
|
container:
|
||
|
image: ruby:3.3-alpine
|
||
|
|
||
|
steps:
|
||
|
- name: Setup environment
|
||
|
run: |
|
||
|
apk add --no-cache git build-base libffi-dev linux-headers postgresql-dev
|
||
|
|
||
|
- name: Clone repository
|
||
|
run: |
|
||
|
git clone ${{ github.server_url }}/${{ github.repository }}.git /workspace
|
||
|
cd /workspace
|
||
|
git checkout ${{ github.sha }}
|
||
|
|
||
|
- name: Install dependencies
|
||
|
run: |
|
||
|
cd /workspace/app
|
||
|
gem install bundler -v 2.6.7
|
||
|
bundle config path vendor/bundle
|
||
|
bundle install
|
||
|
|
||
|
- name: Run tests
|
||
|
run: |
|
||
|
cd /workspace/app
|
||
|
bundle exec rspec
|
||
|
|
||
|
- name: Success
|
||
|
run: echo "✅ Tests completed successfully"
|
||
|
|
||
|
build:
|
||
|
needs: test
|
||
|
runs-on: docker
|
||
|
if: github.ref == 'refs/heads/main'
|
||
|
|
||
|
steps:
|
||
|
- name: Setup environment
|
||
|
run: |
|
||
|
apk add --no-cache git docker
|
||
|
|
||
|
- name: Clone repository
|
||
|
run: |
|
||
|
git clone ${{ github.server_url }}/${{ github.repository }}.git /workspace
|
||
|
cd /workspace
|
||
|
git checkout ${{ github.sha }}
|
||
|
|
||
|
- name: Build image
|
||
|
run: |
|
||
|
cd /workspace
|
||
|
docker build -t test-image .
|
||
|
|
||
|
- name: Success
|
||
|
run: echo "✅ Build completed successfully"
|