decidim/decidim

View on GitHub
.github/workflows/build_app.yml

Summary

Maintainability
Test Coverage
on:
  workflow_call:
    inputs:
      ruby_version:
        description: 'Ruby Version'
        default: "3.2.2"
        type: string
        required: false
      node_version:
        description: 'Node version'
        default: '18.17.1'
        required: false
        type: string
jobs:
  build_app:
    name: Build app
    runs-on: ubuntu-latest
    if: "!startsWith(github.head_ref, 'chore/l10n')"
    timeout-minutes: 60
    env:
      DATABASE_USERNAME: postgres
      DATABASE_PASSWORD: postgres
      DATABASE_HOST: localhost
      RUBYOPT: '-W:no-deprecated'
    services:
      postgres:
        image: postgres:14
        ports: ["5432:5432"]
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5
        env:
          POSTGRES_PASSWORD: postgres
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 1
      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: ${{ inputs.ruby_version }}
          bundler-cache: true
      - uses: actions/setup-node@v3
        with:
          node-version: ${{ inputs.node_version }}
          cache: 'npm'
          cache-dependency-path: ./package-lock.json
      - uses: actions/cache@v3
        id: app-cache
        with:
          path: ./spec/decidim_dummy_app/
          key: app-${{ github.sha }}
          restore-keys: app-${{ github.sha }}
      - run: bundle exec rake test_app
        name: Create test app
        shell: "bash"
      - run: mkdir -p ./spec/decidim_dummy_app/tmp/screenshots
        name: Create the screenshots folder
        shell: "bash"
      - run: RAILS_ENV=test bundle exec rails shakapacker:compile
        name: Precompile assets
        working-directory: ./spec/decidim_dummy_app/
        shell: "bash"
        env:
          NODE_ENV: "test"