voxpupuli/vox-pupuli-tasks

View on GitHub
.github/workflows/test-build.yml

Summary

Maintainability
Test Coverage
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
# For more information see:
# - https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
# - https://github.com/docker/build-push-action/blob/master/docs/advanced/test-before-push.md

name: test-build

on:
  pull_request:
    branches: master

jobs:
  rubocop:

    runs-on: ubuntu-latest
    env:
      BUNDLE_WITHOUT: development:release

    steps:
    - uses: actions/checkout@v4
    - name: Set up Ruby
      uses: ruby/setup-ruby@v1
      with:
        ruby-version: 3.3
        bundler-cache: true
    - name: Run tests
      run: bundle exec rake rubocop

  docker:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: create git version file
      run: git describe --always > VERSION
    - name: Set up Docker Buildx
      uses: docker/setup-buildx-action@v3
    - name: Build Docker image
      id: docker_build
      uses: docker/build-push-action@v5
      with:
        context: .
        push: false
        load: true
        tags: |
          voxpupuli/vox-pupuli-tasks:latest
    - name: List images
      run: docker image ls
    - name: Run Docker Image
      run: docker run --rm --env RAILS_ENV=development --env NODE_ENV=development voxpupuli/vox-pupuli-tasks:latest ruby -e "puts 'we can use Ruby in the container \o/'"

  tests:
    needs:
      - rubocop
      - docker
    runs-on: ubuntu-latest
    name: Test suite
    steps:
      - run: echo Test suite completed