From 620d672794602c2a79aa3acbb08a49bff4fbbd69 Mon Sep 17 00:00:00 2001 From: Jason Corum Date: Tue, 28 Sep 2021 11:46:19 -0700 Subject: [PATCH] Sets up Github Actions for CI * Adds ams-ci.yml workflwo config for Github actions. * Removes travis.yml. Also removes authentication from all API endpoints, limiting it to the most recent endpoint for asset data. Closes #636. --- .github/workflows/ams-ci.yml | 50 ++++++++++++++++++++++++++ .travis.yml | 59 ------------------------------- app/controllers/api_controller.rb | 10 ------ 3 files changed, 50 insertions(+), 69 deletions(-) create mode 100644 .github/workflows/ams-ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ams-ci.yml b/.github/workflows/ams-ci.yml new file mode 100644 index 000000000..5154297d5 --- /dev/null +++ b/.github/workflows/ams-ci.yml @@ -0,0 +1,50 @@ +name: CI RSpec Tests + +on: [push, pull_request] + +jobs: + tests: + name: CI + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install Redis + run: sudo apt-get install -y redis-tools redis-server + + - name: Install libcurl4-openssl-dev for Curb Gem + run: sudo apt-get install libcurl4-openssl-dev + + - name: Setup Ruby and Install RubyGems + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.5.3 + bundler-cache: true + + - name: Install JDK + uses: actions/setup-java@v2 + with: + distribution: 'temurin' + java-version: '11' + + - name: Install Node + shell: bash -l -eo pipefail {0} + run: nvm install 12.9.0 + + - name: Install Chrome Browser + run: google-chrome-stable --headless --disable-gpu --no-sandbox --remote-debugging-port=9222 http://localhost & + + - name: Prepare Test Environment + run: | + cp config/travis/solr_wrapper_test.yml config/solr_wrapper_test.yml + cp config/travis/fcrepo_wrapper_test.yml config/fcrepo_wrapper_test.yml + export DISPLAY=:99.0 + RAILS_ENV=test bundle exec rake db:environment:set db:create db:migrate --trace + RAILS_ENV=test npm install yarn + RAILS_ENV=test yarn --ignore-engines install + RAILS_ENV=test bundle exec rake webpacker:compile + + - name: Run Rspec specs using CI config + run: bundle exec rake ci diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b531be476..000000000 --- a/.travis.yml +++ /dev/null @@ -1,59 +0,0 @@ -dist: xenial -language: ruby -services: -- redis-server -- xvfb -jdk: -- openjdk11 -rvm: -- 2.5.3 -addons: - chrome: stable -cache: - bundler: true - directories: - - dep_cache -before_install: -- google-chrome-stable --headless --disable-gpu --no-sandbox --remote-debugging-port=9222 - http://localhost & -- mkdir -p dep_cache -- ls -l dep_cache -- cp config/travis/solr_wrapper_test.yml config/solr_wrapper_test.yml -- cp config/travis/fcrepo_wrapper_test.yml config/fcrepo_wrapper_test.yml -- gem update bundler -- gem update --system 3.0.6 -- nvm install 12.9.0 -before_script: -- export DISPLAY=:99.0 -- RAILS_ENV=test bundle exec rake db:environment:set db:create db:migrate --trace -- RAILS_ENV=test npm install yarn -- RAILS_ENV=test yarn --ignore-engines install -- RAILS_ENV=test bundle exec rake webpacker:compile -script: -- bundle exec rake ci -deploy: -- provider: codedeploy - access_key_id: AKIAR3SRUQECDKWELTGU - secret_access_key: - secure: "vAmLUYYon/glBfFog8+xyChUMidy+5GciyNSfuNpkF+dWH+r5FYmMpA9hbfcTZhNrM9XSZxjf+heVltkz/nTNwb+U7Q35e1k1KR4NO/juf8+VNk+jwK9oQESoSeEU+Pplkl7sUCCZikqPO07aYtIPzCJy8pt2hUsA9EzxPny6vWPSZiGxghxcCqZIHmuiJJFg39Pnl8P4R8MM3EqGr3qExCEtapO4ca4s+JVr8dvhiJCUac7e0rWHSTTzGh1qTyOk1d4T6tU4edJZXc8BFzsZ4O/GETzGfA8bYiaHfizAQNcwpcQ9cP66k+XQkQ+CYRUlHlNbq6JGItkJTUGkY/MHhs3jIy58iWKVEg1dyPsOsjWs6aL4UA52Uo/uV3TPsB/GHbC52gVonzz7pqNeNPoS46RHO2ekqlerkeE488uuM0fGwamQ3JhfDwKBklZcGjzo/sxFD8IKEAieGikcuO3fYIhijhuCBUuOyGt/bCMfMh3rStKGeDRVfzCFHi+WNQY1FtSqqh6P+PNfrR0Y5j2cwKF/6cUFN0iFMZ+LWeEmduTtRDaG1tCyZ1UKRetG69zpWgVn4tmMrVdDOTyyHoE2BrD8D4qft1+690Lvji+6y5g3vqM9sl1aPZO4t21BxKSwwcNLmS/fZo114YpU9Eu9xA3ly7h36OYaei5gh1Z4jc=" - revision_type: github - application: ams-production-restored - deployment_group: ams-production-restored-DG - region: us-east-1 - on: - branch: main - ruby: 2.5.3 -- provider: codedeploy - access_key_id: AKIAR3SRUQECDKWELTGU - secret_access_key: - secure: "vAmLUYYon/glBfFog8+xyChUMidy+5GciyNSfuNpkF+dWH+r5FYmMpA9hbfcTZhNrM9XSZxjf+heVltkz/nTNwb+U7Q35e1k1KR4NO/juf8+VNk+jwK9oQESoSeEU+Pplkl7sUCCZikqPO07aYtIPzCJy8pt2hUsA9EzxPny6vWPSZiGxghxcCqZIHmuiJJFg39Pnl8P4R8MM3EqGr3qExCEtapO4ca4s+JVr8dvhiJCUac7e0rWHSTTzGh1qTyOk1d4T6tU4edJZXc8BFzsZ4O/GETzGfA8bYiaHfizAQNcwpcQ9cP66k+XQkQ+CYRUlHlNbq6JGItkJTUGkY/MHhs3jIy58iWKVEg1dyPsOsjWs6aL4UA52Uo/uV3TPsB/GHbC52gVonzz7pqNeNPoS46RHO2ekqlerkeE488uuM0fGwamQ3JhfDwKBklZcGjzo/sxFD8IKEAieGikcuO3fYIhijhuCBUuOyGt/bCMfMh3rStKGeDRVfzCFHi+WNQY1FtSqqh6P+PNfrR0Y5j2cwKF/6cUFN0iFMZ+LWeEmduTtRDaG1tCyZ1UKRetG69zpWgVn4tmMrVdDOTyyHoE2BrD8D4qft1+690Lvji+6y5g3vqM9sl1aPZO4t21BxKSwwcNLmS/fZo114YpU9Eu9xA3ly7h36OYaei5gh1Z4jc=" - revision_type: github - application: ams-demo-restore1 - deployment_group: ams-demo-restore1-DG - region: us-east-1 - on: - branch: develop - ruby: 2.5.3 -env: - matrix: - secure: bhFHxEHJJKvXc1rXvhx6ip9anTD9vEZSUO+rkXDN3M2HOV3wco2Dt8HH+7gy1fS3A8l/5+VB1LQ0vwRzykQlGARuGIFFd9y9VaPsdAdjqJbTeD6Neb4SHFu7pOEbhfCfdkU/wOLTn1HQ46bl0u33E3fFeVLRyN1vyIuvYW3o9ZHpfhni8enGC9UbQt65DHUVSUCgynutKIWK/lIiiIzxrOhySjQN3u05/W38o1nwsQLi3pWjj20SLD7U42VPK72TzIqkfs4LPcOSb9we/EMdWhIcrfqRZrC/bbVXB/56Un4ZUF/83y0dQJoglcHB7S+rRCGSx48b2ZtojG6B2vdJ96fNuDePf1YhTkolt9VxDL70AZdIiszADSPYJY4OgI4bUInl2BQvxueXQqoZjLkXSxLdHTD5ImZwfYioV3qgmdWXKdmxc6+MRlOznKXE1oHJqCtnwFC47BN4gq7VZoQHiQdpx4BMOWF13b6qGtO8pJK59bGDQPSO+eskBpZfghad3aMJ9c8+FESkDN9la8HXxlwyZDVNpysVLFFZqFcQlWQ/NG3r/e/NhmAfs3uyqi+bC4dsgg4MInfNQnzErshpfbvTXFJ29cKYnWCY9cWD0zLau2VehXHUxdaBoPaBONM8K73i3aqv/2YMZwSYAy/1egDslliOdyDb9ACKkKt/g9w= diff --git a/app/controllers/api_controller.rb b/app/controllers/api_controller.rb index 74d22f961..748eba396 100644 --- a/app/controllers/api_controller.rb +++ b/app/controllers/api_controller.rb @@ -3,16 +3,6 @@ class APIController < ActionController::API # JSON or PBCore XML. include ActionController::MimeResponds - # Authenticate user before all actions. - # NOTE: For Basic HTTP auth to work: - # * the `http_authenticatable` config option for Devise must be set to true - # (see config/initializers/devise.rb). - # * The Authorization request header must be set to "Basic {cred}" where - # {cred} is the base64 encoded username:password. - before_action do - authenticate_user! - end - # Common API features here, e.g. auth. rescue_from ActiveFedora::ObjectNotFoundError, with: :not_found