Fix responsive text #16867
This file contains hidden or 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: Tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| jobs: | |
| setup_env: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 | |
| with: | |
| sparse-checkout: | | |
| .dockerimages.json | |
| sparse-checkout-cone-mode: false | |
| - name: Authenticate with private NPM package | |
| run: echo -e "//npm.pkg.github.com/:_authToken=${{ secrets.NPM_TOKEN }}\n@juliangarnierorg:registry=https://npm.pkg.github.com" > ~/.npmrc | |
| - name: Define Docker images | |
| run: | | |
| echo "localstack_image=$(jq -r '.localstack' .dockerimages.json)" >> "$GITHUB_ENV" | |
| echo "opensearch_image=$(jq -r '.opensearch' .dockerimages.json)" >> "$GITHUB_ENV" | |
| outputs: | |
| localstack_image: ${{ env.localstack_image }} | |
| opensearch_image: ${{ env.opensearch_image }} | |
| ################## | |
| ##### RUBOCOP #### | |
| ################## | |
| rubocop: | |
| if: github.repository == 'exercism/website' | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab | |
| - name: Authenticate with private NPM package | |
| run: echo -e "//npm.pkg.github.com/:_authToken=${{ secrets.NPM_TOKEN }}\n@juliangarnierorg:registry=https://npm.pkg.github.com" > ~/.npmrc | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb | |
| with: | |
| ruby-version: .ruby-version | |
| - name: Install gems | |
| run: | | |
| # Extract the exact versions of the rubocop gems from Gemfile.lock | |
| rubocop_version=$(sed -n -E 's/^ rubocop \((.+)\)/\1/p' Gemfile.lock) | |
| rubocop_minitest_version=$(sed -n -E 's/^ rubocop-minitest \((.+)\)/\1/p' Gemfile.lock) | |
| rubocop_performance_version=$(sed -n -E 's/^ rubocop-performance \((.+)\)/\1/p' Gemfile.lock) | |
| rubocop_rails_version=$(sed -n -E 's/^ rubocop-rails \((.+)\)/\1/p' Gemfile.lock) | |
| activesupport_version=$(sed -n -E 's/^ activesupport \((.+)\)/\1/p' Gemfile.lock) | |
| gem install activesupport -v $activesupport_version | |
| gem install rubocop -v $rubocop_version | |
| gem install rubocop-minitest -v $rubocop_minitest_version | |
| gem install rubocop-performance -v $rubocop_performance_version | |
| gem install rubocop-rails -v $rubocop_rails_version | |
| - name: Run Rubocop | |
| run: rubocop --except Metrics | |
| ################### | |
| ##### JS TESTS #### | |
| ################### | |
| js-tests: | |
| if: github.repository == 'exercism/website' | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 30 | |
| steps: | |
| ### | |
| # Checkout using GitHub's checkout action | |
| - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab | |
| ### | |
| - name: Authenticate with private NPM package | |
| run: echo -e "//npm.pkg.github.com/:_authToken=${{ secrets.NPM_TOKEN }}\n@juliangarnierorg:registry=https://npm.pkg.github.com" > ~/.npmrc | |
| # Caching using GitHub's caching action | |
| # https://github.com/actions/cache/blob/main/examples.md#node---yarn | |
| - name: Get yarn cache directory path | |
| id: yarn-cache-dir-path | |
| run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | |
| - name: Cache yarn | |
| uses: actions/cache@0c907a75c2c80ebcb7f088228285e798b750cf8f | |
| id: yarn-cache | |
| with: | |
| path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
| key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-yarn- | |
| ### | |
| # Install yarn dependencies | |
| - name: Install dependencies | |
| run: yarn install | |
| ### | |
| # Run the tests | |
| - name: Run JS tests | |
| run: yarn test | |
| ##################### | |
| ##### RUBY TESTS #### | |
| ##################### | |
| ruby-test-files: | |
| if: github.repository == 'exercism/website' | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 30 | |
| outputs: | |
| matrix: ${{ steps.test-files.outputs.matrix }} | |
| steps: | |
| - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab | |
| - id: test-files | |
| env: | |
| FILES_PER_BATCH: 50 | |
| run: | | |
| tests=$(find test -name '*_test.rb' -not -path 'test/system/*' -not -path 'test/visual/*' | xargs -n ${{ env.FILES_PER_BATCH }} | xargs -I {} echo '"{}"' | tr '\n' ',') | |
| echo "matrix={\"tests\":[${tests}]}" >> $GITHUB_OUTPUT | |
| ruby-tests: | |
| if: github.repository == 'exercism/website' | |
| needs: | |
| - ruby-test-files | |
| - setup_env | |
| strategy: | |
| fail-fast: false | |
| max-parallel: 15 | |
| matrix: ${{ fromJson(needs.ruby-test-files.outputs.matrix) }} | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 30 | |
| services: | |
| mysql: | |
| image: mysql:5.7 | |
| env: | |
| MYSQL_USER: exercism | |
| MYSQL_PASSWORD: exercism | |
| MYSQL_DATABASE: exercism_test | |
| MYSQL_ROOT_PASSWORD: password | |
| ports: | |
| - 3306 | |
| #options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 10 | |
| redis: | |
| image: redis | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 1s | |
| --health-timeout 2s | |
| --health-retries 10 | |
| aws: | |
| image: ${{ needs.setup_env.outputs.localstack_image }} | |
| ports: | |
| - 4566 | |
| opensearch: | |
| image: ${{ needs.setup_env.outputs.opensearch_image }} | |
| env: | |
| discovery.type: single-node | |
| ports: | |
| - 9200 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab | |
| - name: Authenticate with private NPM package | |
| run: echo -e "//npm.pkg.github.com/:_authToken=${{ secrets.NPM_TOKEN }}\n@juliangarnierorg:registry=https://npm.pkg.github.com" > ~/.npmrc | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb | |
| with: | |
| ruby-version: .ruby-version | |
| bundler-cache: true | |
| - name: Update package lists | |
| run: sudo apt-get update | |
| - name: Install packages | |
| run: sudo apt-get install graphicsmagick libvips | |
| ### | |
| # Caching using GitHub's caching action | |
| # https://github.com/actions/cache/blob/main/examples.md#node---yarn | |
| - name: Get yarn cache directory path | |
| id: yarn-cache-dir-path | |
| run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | |
| - name: Cache yarn | |
| uses: actions/cache@0c907a75c2c80ebcb7f088228285e798b750cf8f | |
| id: yarn-cache | |
| with: | |
| path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
| key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-yarn- | |
| - name: Install yarn dependencies | |
| run: yarn install | |
| - name: Setup Exercism services | |
| env: | |
| EXERCISM_ENV: test | |
| EXERCISM_CI: true | |
| AWS_PORT: ${{ job.services.aws.ports['4566'] }} | |
| MYSQL_PORT: ${{ job.services.mysql.ports['3306'] }} | |
| run: | | |
| bundle exec setup_exercism_config | |
| bundle exec setup_exercism_local_aws | |
| ### | |
| # Precompile JS | |
| - name: Precompile JS | |
| env: | |
| RAILS_ENV: test | |
| NODE_ENV: development | |
| EXERCISM_CI: true | |
| AWS_PORT: ${{ job.services.aws.ports['4566'] }} | |
| MYSQL_PORT: ${{ job.services.mysql.ports['3306'] }} | |
| run: | | |
| bundle exec rails r bin/monitor-manifest | |
| bundle exec rails test:prepare | |
| ### | |
| # Wait for everything to be ready | |
| - name: Wait for open search to become ready | |
| env: | |
| OPENSEARCH_HOST: https://127.0.0.1:${{ job.services.opensearch.ports['9200'] }} | |
| run: ./bin/wait_for_opensearch | |
| ### | |
| # Run the tests | |
| - name: Run Ruby tests | |
| env: | |
| RAILS_ENV: test | |
| EXERCISM_CI: true | |
| AWS_PORT: ${{ job.services.aws.ports['4566'] }} | |
| MYSQL_PORT: ${{ job.services.mysql.ports['3306'] }} | |
| OPENSEARCH_PORT: ${{ job.services.opensearch.ports['9200'] }} | |
| OPENSEARCH_HOST: https://127.0.0.1:${{ job.services.opensearch.ports['9200'] }} | |
| OPENSEARCH_VERIFY_SSL: false | |
| run: | | |
| bundle exec rails test:zeitwerk | |
| bundle exec rails test ${{ matrix.tests }} | |
| ruby-tests-completed: | |
| runs-on: ubuntu-22.04 | |
| needs: ruby-tests | |
| steps: | |
| - run: echo "Ruby tests completed" | |
| ####################### | |
| ##### SYSTEM TESTS #### | |
| ####################### | |
| system-test-files: | |
| if: github.repository == 'exercism/website' | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 30 | |
| outputs: | |
| matrix: ${{ steps.test-files.outputs.matrix }} | |
| steps: | |
| - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab | |
| - id: test-files | |
| env: | |
| FILES_PER_BATCH: 12 | |
| run: | | |
| tests=$(find test/system -name *_test.rb | xargs -n ${{ env.FILES_PER_BATCH }} | xargs -I {} echo '"{}"' | tr '\n' ',') | |
| echo "matrix={\"tests\":[${tests}]}" >> $GITHUB_OUTPUT | |
| system-tests: | |
| if: github.repository == 'exercism/website' | |
| needs: | |
| - system-test-files | |
| - setup_env | |
| strategy: | |
| fail-fast: false | |
| max-parallel: 15 | |
| matrix: ${{ fromJson(needs.system-test-files.outputs.matrix) }} | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 30 | |
| services: | |
| mysql: | |
| image: mysql:5.7 | |
| env: | |
| MYSQL_USER: exercism | |
| MYSQL_PASSWORD: exercism | |
| MYSQL_DATABASE: exercism_test | |
| MYSQL_ROOT_PASSWORD: password | |
| ports: | |
| - 3306 | |
| redis: | |
| image: redis | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 1s | |
| --health-timeout 2s | |
| --health-retries 10 | |
| aws: | |
| image: ${{ needs.setup_env.outputs.localstack_image }} | |
| ports: | |
| - 4566 | |
| opensearch: | |
| image: ${{ needs.setup_env.outputs.opensearch_image }} | |
| env: | |
| discovery.type: single-node | |
| ports: | |
| - 9200 | |
| steps: | |
| ### | |
| # Checkout using GitHub's checkout action | |
| - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab | |
| - name: Authenticate with private NPM package | |
| run: echo -e "//npm.pkg.github.com/:_authToken=${{ secrets.NPM_TOKEN }}\n@juliangarnierorg:registry=https://npm.pkg.github.com" > ~/.npmrc | |
| ### | |
| # Setup Ruby - this needs to match the version in the Gemfile | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb | |
| with: | |
| ruby-version: .ruby-version | |
| bundler-cache: true | |
| - name: Update package lists | |
| run: sudo apt-get update | |
| - name: Install packages | |
| run: sudo apt-get install libvips | |
| ### | |
| # Caching using GitHub's caching action | |
| # https://github.com/actions/cache/blob/main/examples.md#node---yarn | |
| - name: Get yarn cache directory path | |
| id: yarn-cache-dir-path | |
| run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | |
| - name: Cache yarn | |
| uses: actions/cache@0c907a75c2c80ebcb7f088228285e798b750cf8f | |
| id: yarn-cache | |
| with: | |
| path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
| key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-yarn- | |
| - name: Install yarn dependencies | |
| run: yarn install | |
| - name: Setup Exercism services | |
| env: | |
| EXERCISM_ENV: test | |
| EXERCISM_CI: true | |
| AWS_PORT: ${{ job.services.aws.ports['4566'] }} | |
| MYSQL_PORT: ${{ job.services.mysql.ports['3306'] }} | |
| run: | | |
| bundle exec setup_exercism_config | |
| bundle exec setup_exercism_local_aws | |
| - name: Install Chrome | |
| run: | | |
| # Install latest stable Chrome | |
| wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - | |
| sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' | |
| sudo apt-get update | |
| sudo apt-get install -y google-chrome-stable | |
| - uses: nanasess/setup-chromedriver@v2 | |
| - name: Start chromedriver | |
| run: | | |
| set -x | |
| chromedriver --url-base=/wd/hub & | |
| # sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional | |
| ### | |
| # Precompile JS | |
| - name: Precompile JS | |
| env: | |
| RAILS_ENV: test | |
| NODE_ENV: development | |
| EXERCISM_CI: true | |
| AWS_PORT: ${{ job.services.aws.ports['4566'] }} | |
| MYSQL_PORT: ${{ job.services.mysql.ports['3306'] }} | |
| run: | | |
| bundle exec rails r bin/monitor-manifest | |
| bundle exec rails test:prepare | |
| ### | |
| # Wait for everything to be ready | |
| - name: Wait for open search to become ready | |
| env: | |
| OPENSEARCH_HOST: https://127.0.0.1:${{ job.services.opensearch.ports['9200'] }} | |
| run: ./bin/wait_for_opensearch | |
| ### | |
| # Run the tests | |
| - name: Run Ruby system tests | |
| env: | |
| RAILS_ENV: test | |
| EXERCISM_CI: true | |
| AWS_PORT: ${{ job.services.aws.ports['4566'] }} | |
| MYSQL_PORT: ${{ job.services.mysql.ports['3306'] }} | |
| OPENSEARCH_PORT: ${{ job.services.opensearch.ports['9200'] }} | |
| OPENSEARCH_HOST: https://127.0.0.1:${{ job.services.opensearch.ports['9200'] }} | |
| OPENSEARCH_VERIFY_SSL: false | |
| run: bundle exec rails test ${{ matrix.tests }} | |
| system-tests-completed: | |
| runs-on: ubuntu-22.04 | |
| needs: system-tests | |
| steps: | |
| - run: echo "System tests completed" | |
| ###################### | |
| ##### ASSET TESTS #### | |
| ###################### | |
| asset-tests: | |
| if: github.repository == 'exercism/website' | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 30 | |
| steps: | |
| ### | |
| # Checkout using GitHub's checkout action | |
| - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab | |
| - name: Authenticate with private NPM package | |
| run: echo -e "//npm.pkg.github.com/:_authToken=${{ secrets.NPM_TOKEN }}\n@juliangarnierorg:registry=https://npm.pkg.github.com" > ~/.npmrc | |
| ### | |
| # Setup Ruby - this needs to match the version in the Gemfile | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb | |
| with: | |
| ruby-version: .ruby-version | |
| bundler-cache: true | |
| ### | |
| # Caching using GitHub's caching action | |
| # https://github.com/actions/cache/blob/main/examples.md#node---yarn | |
| - name: Get yarn cache directory path | |
| id: yarn-cache-dir-path | |
| run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | |
| - name: Cache yarn | |
| uses: actions/cache@0c907a75c2c80ebcb7f088228285e798b750cf8f | |
| id: yarn-cache | |
| with: | |
| path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
| key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-yarn- | |
| ### | |
| # Install bundler and yarn dependencies | |
| - name: Install dependencies | |
| env: | |
| EXERCISM_ENV: test | |
| EXERCISM_CI: true | |
| AWS_PORT: ${{ job.services.aws.ports['4566'] }} | |
| MYSQL_PORT: ${{ job.services.mysql.ports['3306'] }} | |
| OPENSEARCH_PORT: ${{ job.services.opensearch.ports['9200'] }} | |
| run: | | |
| yarn install | |
| - name: Run asset tests | |
| env: | |
| RAILS_ENV: test | |
| EXERCISM_CI: true | |
| run: | | |
| bundle exec rails r bin/monitor-manifest | |
| bundle exec rails test:prepare |