# .github/workflows/main.yaml name: Main on: [push] jobs: vm-job: runs-on: ubuntu-latest # If you need DB like PostgreSQL then define service below. # Example for Redis can be found here: # https://github.com/actions/example-services/tree/master/.github/workflows services: postgres: image: postgres:10.8 env: POSTGRES_USER: postgres POSTGRES_PASSWORD: "" POSTGRES_DB: postgres ports: # will assign a random free host port - 5432/tcp # needed because the postgres container does not provide a healthcheck options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 # https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix strategy: matrix: # Set N number of parallel jobs you want to run tests on. # Use higher number if you have slow tests to split them on more parallel jobs. # Remember to update ci_node_index below to 0..N-1 ci_node_total: [2] # set N-1 indexes for parallel jobs # When you run 2 parallel jobs then first job will have index 0, the second job will have index 1 etc ci_node_index: [0, 1] steps: - uses: actions/checkout@v1 - name: Set up Ruby 2.6 uses: actions/setup-ruby@v1 with: ruby-version: 2.6.3 # required to compile pg ruby gem - name: install PostgreSQL client run: sudo apt-get install libpq-dev - name: Build and create DB env: # use localhost for the host here because we have specified a container for the job. # If we were running the job on the VM this would be postgres PGHOST: localhost PGUSER: postgres PGPORT: ${{ job.services.postgres.ports[5432] }} # get randomly assigned published port RAILS_ENV: test run: | gem install bundler bundle install --jobs 4 --retry 3 bin/rails db:setup - name: Run tests env: PGHOST: localhost PGUSER: postgres PGPORT: ${{ job.services.postgres.ports[5432] }} # get randomly assigned published port RAILS_ENV: test KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC }} KNAPSACK_PRO_TEST_SUITE_TOKEN_CUCUMBER: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_CUCUMBER }} KNAPSACK_PRO_TEST_SUITE_TOKEN_MINITEST: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_MINITEST }} KNAPSACK_PRO_TEST_SUITE_TEST_UNIT: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_TEST_UNIT }} KNAPSACK_PRO_TEST_SUITE_TOKEN_SPINACH: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_SPINACH }} KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }} KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }} run: | # run tests in Knapsack Pro Regular Mode bundle exec rake knapsack_pro:rspec bundle exec rake knapsack_pro:cucumber bundle exec rake knapsack_pro:minitest bundle exec rake knapsack_pro:test_unit bundle exec rake knapsack_pro:spinach # you can use Knapsack Pro in Queue Mode once recorded first CI build with Regular Mode bundle exec rake knapsack_pro:queue:rspec bundle exec rake knapsack_pro:queue:cucumber bundle exec rake knapsack_pro:queue:minitest