clean up #330
Workflow file for this run
This file contains 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: test | |
on: | |
push: | |
branches: [develop, main, master, "feature/**"] | |
pull_request: | |
branches: [develop, main, master, "feature/**"] | |
# Allows workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql | |
env: | |
MYSQL_ROOT_PASSWORD: root | |
ports: | |
- 3306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
env: | |
DB_HOST: 127.0.0.1 | |
DB_PORT: 3306 | |
DB_USERNAME: root | |
DB_PASSWORD: root | |
RAILS_ENV: test | |
steps: | |
- name: Verify mysql connection | |
run: | | |
mysql --host ${{ env.DB_HOST }} --port ${{ env.DB_PORT }} -u${{ env.DB_USERNAME}} -p${{ env.DB_PASSWORD }} -e "SHOW DATABASES" | |
- uses: actions/checkout@v3 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: Install dependencies | |
run: | | |
gem install bundler | |
bundle install | |
yarn install --frozen-lockfile | |
- name: Setup config files for CI | |
run: | | |
cp config/ldap_ci.yml config/ldap.yml | |
- name: Setup Database | |
run: | | |
cp config/database_ci.yml config/database.yml | |
./bin/rails db:create | |
./bin/rails db:migrate | |
- name: Run E2E tests with Cypress | |
uses: cypress-io/github-action@v5 | |
with: | |
start: bundle exec rails server -e test -p 5017 | |
wait-on: "http://localhost:5017" | |
browser: chrome | |
config: baseUrl=http://localhost:5017 | |
- name: Upload test screenshots if any | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: cypress-screenshots | |
path: cypress/screenshots | |
- name: Upload snapshots | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: cypress-snapshots | |
path: cypress/snapshots | |
- name: Run RSpec | |
run: bundle exec rspec |