From 51e9a0e4e3308f7731b826b4478d83beb17803a8 Mon Sep 17 00:00:00 2001 From: David T Harris Date: Wed, 21 Feb 2024 11:00:05 -0500 Subject: [PATCH] 2813587 Replace CircleCI with GitHub Actions Also: Remove old GitHub Actions ci.yml file from the original repository since we don't need it for our purposes at EVERFI. --- .circleci/config.yml | 43 ------------------- .github/workflows/ci.yml | 57 ------------------------- .github/workflows/test_and_build.yml | 63 ++++++++++++++++++++++++++++ Gemfile.lock | 1 + 4 files changed, 64 insertions(+), 100 deletions(-) delete mode 100644 .circleci/config.yml delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/test_and_build.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index efb4388..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,43 +0,0 @@ -references: - docker_auth: &docker_auth - auth: - username: $DOCKERHUB_USERNAME - password: $DOCKERHUB_PASSWORD - - docker_image_ruby: &docker_image_ruby - image: cimg/ruby:3.0.3 - <<: *docker_auth - - docker_container_ruby: &docker_container_ruby - docker: - - *docker_image_ruby - working_directory: ~/repo - -version: 2.1 - -jobs: - build: - <<: *docker_container_ruby - - steps: - - checkout - - run: - name: Configure Bundler - command: | - export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ") - gem install bundler -v $BUNDLER_VERSION - - - run: - name: Install gems - command: bundle install --jobs=4 --retry=3 - - - run: - name: Run Ruby tests - command: bundle exec rake test - - - store_test_results: - path: /tmp/test-results - - - store_artifacts: - path: /tmp/test-results - destination: test-results diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index ce4c592..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: ci - -on: [push, pull_request] - -jobs: - build: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - include: - - ruby: 1.9.3 - rubygems: 2.7.8 - - ruby: 2.0.0 - rubygems: 2.7.8 - - ruby: 2.1.10 - rubygems: 2.7.8 - - ruby: 2.2.7 - rubygems: 2.7.8 - - ruby: 2.3.4 - - ruby: 2.4.1 - - ruby: 2.5.1 - - ruby: 2.6.0 - - ruby: ruby-head - - ruby: jruby-d19 - - ruby: jruby-9.1.9.0 - - ruby: jruby-head - steps: - - uses: actions/checkout@v2 - - name: Install rvm - run: | - curl -sSL https://get.rvm.io | bash - - name: Install ruby - run: | - source $HOME/.rvm/scripts/rvm - rvm use ${{ matrix.ruby }} --default --install --binary --fuzzy --create - - name: Check ruby version - run: | - source $HOME/.rvm/scripts/rvm - ruby --version - - name: Update rubygems - run: | - source $HOME/.rvm/scripts/rvm - gem update --system ${{ matrix.rubygems }} - - name: Install bundler - run: | - source $HOME/.rvm/scripts/rvm - gem install bundler --no-document -v '~> 1.13' - - name: Install gems - run: | - source $HOME/.rvm/scripts/rvm - bundle install --jobs 4 - - run: unset JRUBY_OPTS - - name: Run rake - run: | - source $HOME/.rvm/scripts/rvm - bundle exec rake diff --git a/.github/workflows/test_and_build.yml b/.github/workflows/test_and_build.yml new file mode 100644 index 0000000..ff7e5c9 --- /dev/null +++ b/.github/workflows/test_and_build.yml @@ -0,0 +1,63 @@ +name: Test and Build +on: push + +jobs: + verify_gemfile_lock: + runs-on: ubuntu-latest + env: + BUNDLE_RUBYGEMS__PKG__GITHUB__COM: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: checkout + uses: actions/checkout@v4.1.0 + - name: setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.0.3 + bundler-cache: true # runs 'bundle install' and caches installed gems + - name: bundler + shell: bash + run: |- + gem install bundler -v $(grep 'BUNDLED WITH' Gemfile.lock -A 1|tail -1) + bundle config path vendor/bundle + bundle install --jobs 4 --retry 3 + - name: Verify Gemfile.lock + shell: bash + run: |- + if git diff-index --quiet HEAD -- Gemfile.lock + then + exit 0 + else + echo "Please ensure that you have bundled and committed any" + echo "resulting changes to the Gemfile.lock file in this repo." + git --no-pager diff -- Gemfile.lock + exit 128 + fi + + test_and_build: + runs-on: ubuntu-latest + env: + BUNDLE_RUBYGEMS__PKG__GITHUB__COM: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: checkout + uses: actions/checkout@v4.1.0 + + - name: setup ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + + - name: bundler + shell: bash + run: |- + gem install bundler -v $(grep 'BUNDLED WITH' Gemfile.lock -A 1|tail -1) + bundle config path vendor/bundle + bundle install --jobs 4 --retry 3 + + - name: specs + shell: bash + run: |- + # Run specs to ensure build is passing + bundle exec rake test + + # Run rake build to ensure gem will build + bundle exec rake build diff --git a/Gemfile.lock b/Gemfile.lock index d03db05..1c83aed 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -12,6 +12,7 @@ GEM PLATFORMS arm64-darwin-21 + x86_64-linux DEPENDENCIES benchmark-ips