diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 00000000..60673785 --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,12 @@ +name: setup +description: Setup the repository +runs: + using: composite + steps: + - uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + - uses: actions/setup-node@v4 + with: + node-version: 'lts/*' + cache: yarn diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..8b2e111d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +name: ci +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + rspec: + runs-on: ubuntu-latest + services: + mariadb: + image: mariadb:10.4 + env: + MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: true + ports: + - 3306:3306 + env: + RAILS_ENV: test + DATABASE_URL: mysql2://root@127.0.0.1:3306/incidents_test + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup + - run: bin/setup + - run: bundle exec rspec + - name: Archive failed system test screenshots + if: failure() + uses: actions/upload-artifact@v4 + with: + name: failed-test-screenshots + path: tmp/capybara/*.png + if-no-files-found: ignore diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b3029544..00000000 --- a/.travis.yml +++ /dev/null @@ -1,33 +0,0 @@ -dist: focal -language: ruby -cache: bundler -env: - global: - - CC_TEST_REPORTER_ID=611cda7a6df35c4ca4df08319797b6eba033ca5f61068f90072cb148f71714c8 -addons: - chrome: stable -services: - - mysql -before_install: - - nvm install 'lts/*' - - nvm use 'lts/*' - - npm install --global yarn -install: - - bundle config set --local deployment 'true' - - bundle install --jobs=3 --retry=3 - - yarn install -before_script: - - cp config/database.travis.yml config/database.yml - - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter - - chmod +x ./cc-test-reporter - - ./cc-test-reporter before-build - - bundle exec rake db:create db:schema:load -script: - - bundle exec rspec -after_script: - - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT -branches: - only: - - main -notifications: - email: false diff --git a/db/seeds.rb b/db/seeds.rb index b95878d5..92c733bc 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -5,6 +5,8 @@ require 'paper_trail' require 'timecop' +exit if Rails.env.test? + divisions = %w[SPFLD NOHO SMECH].map do |n| FactoryBot.create :division, name: n end