jelhan/croodle

View on GitHub
.github/workflows/ci.yml

Summary

Maintainability
Test Coverage
name: Test Frontend and backend
# This workflow is triggered on pushes to the repository.
on:
  push:
    branches:
      - master
      - renovate/*
  pull_request:

jobs:
  lint:
    name: lint
    runs-on: ubuntu-latest
    timeout-minutes: 10

    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: npm
      - name: Install Dependencies
        run: npm ci
      - name: Lint
        run: npm run lint

  test-bundlesize:
    name: test bundlesize
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install php
        uses: shivammathur/setup-php@v2
        with:
          php-version: '7.4'
          extensions: mbstring, zip
      - uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: npm
      - name: Install node modules
        run: npm ci
      - name: Run tests
        run: npm run test:bundlesize

  test-csp-header:
    name: test CSP in .htaccess
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: npm
      - name: Install node modules
        run: npm ci
      - name: Run tests
        run: npm run test:csp-header

  test-chrome:
    name: test against Chrome
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: npm
      - name: Install node modules
        run: npm ci
      - name: Install chrome browser
        run: |
          wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
          sudo apt install ./google-chrome-stable_current_amd64.deb
      - name: Build with test environment
        env:
          CI: true
        run: npm run build --environment test
      - name: run tests in chrome
        run: npm run test:ember --launch Chrome --path dist

  test-firefox:
    name: test against Firefox
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: npm
      - name: Install node modules
        run: npm ci
      - name: Setup firefox
        uses: browser-actions/setup-firefox@latest
        with:
          firefox-version: 102.0.1
      - name: Build with test environment
        env:
          CI: true
        run: npm run build --environment test
      - name: run tests in firefox
        run: npm run test:ember --launch Firefox --path dist

  test-browserstack:
    name: test against additional browser in BrowserStack
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: npm
      - name: Install node modules
        run: npm ci
      - name: Build with test environment
        env:
          CI: true
        run: npm run build --environment test
      - name: 'BrowserStack Env Setup'
        uses: 'browserstack/github-actions/setup-env@master'
        with:
          username: 'jeldrikhanschke1'
          access-key: 'xaM9Uxurv2GyxFLKQXgj'
      - name: 'Start BrowserStackLocal Tunnel'
        uses: 'browserstack/github-actions/setup-local@master'
        with:
          local-testing: 'start'
          local-logging-level: 'all-logs'
          local-identifier: 'random'
      - name: 'Running test on BrowserStack'
        run: npm run test:ember --config-file testem.browserstack.js --path dist
      - name: 'BrowserStackLocal Stop'
        uses: browserstack/github-actions/setup-local@master
        with:
          local-testing: stop

  test-backend:
    name: Test php backend
    runs-on: ubuntu-latest
    strategy:
      matrix:
        php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
    steps:
      - name: Checkout repository files
        uses: actions/checkout@v4
      - name: Install php
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php-versions }}
          extensions: mbstring, zip
      - name: Install php dependencies
        run: composer install
        working-directory: ./api
      - name: Run backend tests
        run: ./vendor/bin/codecept run
        working-directory: ./api