quick fix #55
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: CI | |
on: | |
push: | |
branches: | |
- main | |
- 'feature/**' | |
- 'hotfix/**' | |
pull_request: | |
branches: | |
- main | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.3.0 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: | | |
gem install bundler | |
bundle install | |
npm install | |
- name: Build Vite assets | |
run: bundle exec rake vite:build | |
- name: Compile Tailwind CSS | |
run: bundle exec rails tailwindcss:build | |
- name: Set up database | |
run: | | |
bundle exec rails db:create | |
bundle exec rails db:schema:load | |
bundle exec rails db:seed | |
env: | |
RAILS_ENV: test | |
- name: Run tests | |
run: bundle exec rspec | |
env: | |
RAILS_ENV: test | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GH_PAT }} | |
- name: Prepare Docker metadata | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ghcr.io/loftwah/linkarooie | |
tags: | | |
type=ref,event=branch | |
type=sha,format=long | |
type=raw,value=latest,enable={{is_default_branch}} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |