added slipping end tests for offer #2435
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: Github Testing | |
on: [push] | |
jobs: | |
test: | |
services: | |
postgres: | |
image: postgres:15 | |
ports: ["5432:5432"] | |
env: | |
POSTGRES_PASSWORD: password | |
POSTGRES_USERNAME: postgres | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04] | |
ruby: [ '3.2.2' ] | |
runs-on: ${{ matrix.os }} | |
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby }} | |
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | |
- name: Hack sources.list | |
run: sudo sed -i 's|http://azure.archive.ubuntu.com/ubuntu/|http://mirror.arizona.edu/ubuntu/|g' /etc/apt/sources.list | |
- name: config bundler | |
run: | | |
bundle config set without 'development staging production' | |
bundle config set deployment '[secure]' | |
bundle env | |
head -n1 $(which bundle) | |
- name: Install wkhtmlpdf (push) | |
run: | | |
sudo apt-get update | |
wget http://ppa.launchpad.net/linuxuprising/libpng12/ubuntu/pool/main/libp/libpng/libpng12-0_1.2.54-1ubuntu1.1+1~ppa0~eoan_amd64.deb | |
sudo dpkg -i libpng12-0_1.2.54-1ubuntu1.1+1~ppa0~eoan_amd64.deb | |
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb | |
sudo apt-get install -y gdebi | |
sudo gdebi --non-interactive wkhtmltox_0.12.6-1.focal_amd64.deb | |
if: github.event_name == 'push' | |
- name: Set ENV for codeclimate (pull_request) | |
run: | | |
git fetch --no-tags --prune --depth=1 origin +refs/heads/$GITHUB_HEAD_REF:refs/remotes/origin/$GITHUB_HEAD_REF | |
echo "GIT_BRANCH=$GITHUB_HEAD_REF" >> $GITHUB_ENV | |
echo "GIT_COMMIT_SHA=$(git rev-parse origin/$GITHUB_HEAD_REF)" >> $GITHUB_ENV | |
if: github.event_name == 'pull_request' | |
- name: Set ENV for codeclimate (push) | |
run: | | |
echo "GIT_BRANCH=$GITHUB_REF" >> $GITHUB_ENV | |
echo "GIT_COMMIT_SHA=$GITHUB_SHA" >> $GITHUB_ENV | |
if: github.event_name == 'push' | |
- name: Prepare CodeClimate | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
run: | | |
curl -LSs 'https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64' >./cc-test-reporter; | |
chmod +x ./cc-test-reporter | |
./cc-test-reporter before-build | |
- name: Run Tests | |
env: | |
PG_DATABASE: postgres | |
PG_HOST: localhost | |
PG_USER: postgres | |
PG_PASSWORD: password | |
PG_PORT: ${{ job.services.postgres.ports[5432] }} | |
RAILS_ENV: test | |
COVERAGE: true | |
DISABLE_SPRING: 1 | |
run: | | |
cp config/database.yml.sample config/database.yml | |
cp config/customization.yml.sample config/customization.yml | |
yarn install --check-files | |
bundle exec rake db:setup | |
bundle exec rake data:migrate | |
bundle exec rails assets:precompile | |
bundle exec rails test test/* | |
- name: Save coverage | |
run: ./cc-test-reporter format-coverage --output coverage/codeclimate.${{ matrix.ruby }}.json | |
- uses: actions/[email protected] | |
with: | |
name: coverage-${{ matrix.ruby }} | |
path: coverage/codeclimate.${{ matrix.ruby }}.json | |
upload_coverage: | |
strategy: | |
matrix: | |
os: [ ubuntu-20.04 ] | |
ruby: [ '3.2.2' ] | |
runs-on: ubuntu-22.04 | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
CC_TEST_REPORTER_URL: https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 | |
needs: test | |
steps: | |
- name: Download test coverage reporter | |
run: curl -L $CC_TEST_REPORTER_URL > cc-test-reporter | |
- name: Give test coverage reporter executable permissions | |
run: chmod +x cc-test-reporter | |
- uses: actions/[email protected] | |
with: | |
name: coverage-${{ matrix.ruby }} | |
path: coverage | |
- name: Aggregate & upload results to Code Climate | |
run: | | |
./cc-test-reporter sum-coverage coverage/codeclimate.*.json | |
./cc-test-reporter upload-coverage |