Skip to content

Merge pull request #2530 from MindLeaps/2486-student-reports #6384

Merge pull request #2530 from MindLeaps/2486-student-reports

Merge pull request #2530 from MindLeaps/2486-student-reports #6384

Workflow file for this run

name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
services:
db:
image: postgres:13
ports: ['5432:5432']
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3.1
bundler-cache: true
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get -yqq install libpq-dev
sudo apt-get install -y postgresql-client
gem install bundler
bundle install --jobs 4 --retry 3
- name: Cache assets
uses: actions/cache@v4
with:
path: public/assets
key: ${{ runner.os }}-assets-${{ github.sha }}
restore-keys: |
${{ runner.os }}-assets
- name: Cleanup tmp dirs
run: |
rm -rf tmp/storage
rm -rf tmp/screenshots
rm -rf tmp/capybara
- name: Migrate Database
env:
RAILS_ENV: test
DATABASE_USER: postgres
DATABASE_PASSWORD: postgres
DATABASE_URL: postgres://postgres:@localhost:5432
run: |
bundle exec rake db:create
bundle exec rake db:migrate
- name: Precompile Assets
env:
RAILS_ENV: test
DATABASE_USER: postgres
DATABASE_PASSWORD: postgres
DATABASE_URL: postgres://postgres:@localhost:5432
run: |
bundle exec rake assets:clobber
bundle exec rake assets:precompile
- name: Run Tests
env:
RAILS_ENV: test
DATABASE_USER: postgres
DATABASE_PASSWORD: postgres
DATABASE_URL: postgres://postgres:@localhost:5432
CI: true
run: |
bundle exec rake test
- name: Save assets back to cache
uses: actions/cache@v4
with:
path: public/assets
key: ${{ runner.os }}-assets-${{ github.sha }}
build_image:
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/master'
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name == 'release' }}
build-args: |
APP_ENV=prod
tags: |
ghcr.io/mindleaps/tracker/mindleaps-tracker:latest
ghcr.io/mindleaps/tracker/mindleaps-tracker:${{ github.event.release.tag_name }}