Merge pull request #484 from mugijiru/dependabot/bundler/main/bullet-… #1099
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: CI | |
on: | |
push: | |
permissions: | |
contents: read | |
pull-requests: write | |
jobs: | |
rspec: | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql:5.7 | |
ports: ["3306:3306"] | |
options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 10 | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: use-chromedriver | |
uses: nanasess/setup-chromedriver@v2 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: "ember/todo-app/package.json" | |
- name: Setup Rails | |
env: | |
RAILS_ENV: test | |
run: | | |
gem install bundler --no-document | |
bundle config path vendor/bundle | |
bundle install --jobs 4 --retry 3 | |
cp config/.ci.database.yml config/database.yml | |
bin/rails db:setup | |
- name: Setup Ember.js App | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
run: | | |
cd ember/todo-app | |
yarn | |
yarn run ember build | |
- name: Setup Code Climate test-reporter | |
run: | | |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter | |
chmod +x ./cc-test-reporter | |
- name: CodeClimate prebuild | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.CODE_CLIMATE_REPORTER_ID }} | |
run: ./cc-test-reporter before-build | |
- name: Run RSpec | |
env: | |
RAILS_ENV: test | |
TZ: Asia/Tokyo | |
CI: true | |
CC_TEST_REPORTER_ID: ${{ secrets.CODE_CLIMATE_REPORTER_ID }} | |
DISPLAY: ':99' | |
run: | | |
bundle exec rspec -f j -o tmp/rspec_results.json -f p | |
- name: Format rspec result | |
run: ./cc-test-reporter format-coverage -o tmp/cc.rspec.json | |
- name: 'Upload cc.rspec.json' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cc-rspec | |
path: tmp/cc.rspec.json | |
retention-days: 1 | |
- name: Report RSpec result | |
uses: SonicGarden/rspec-report-action@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
json-path: tmp/rspec_results.json | |
if: always() | |
ember-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: "ember/todo-app/package.json" | |
- name: Setup Ember.js App | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
run: | | |
cd ember/todo-app | |
yarn | |
yarn run ember build | |
- name: Setup Code Climate test-reporter | |
run: | | |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter | |
chmod +x ./cc-test-reporter | |
- name: CodeClimate prebuild | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.CODE_CLIMATE_REPORTER_ID }} | |
run: ./cc-test-reporter before-build | |
- name: Run Ember test | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
run: | | |
cd ember/todo-app && COVERAGE=true yarn run ember test | |
sleep 3 | |
- name: Format ember test result | |
run: cd ember/todo-app && ../../cc-test-reporter format-coverage -o ../../tmp/cc.ember.json --add-prefix ember/todo-app -t lcov | |
- name: 'Upload cc.ember.json' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cc-ember | |
path: tmp/cc.ember.json | |
retention-days: 1 | |
after-build: | |
needs: [rspec, ember-test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download rspec artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: cc-rspec | |
path: tmp | |
- name: Download ember artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: cc-ember | |
path: tmp | |
- name: Setup Code Climate test-reporter | |
run: | | |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter | |
chmod +x ./cc-test-reporter | |
- name: Upload test results to CodeClimate | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.CODE_CLIMATE_REPORTER_ID }} | |
run: | | |
./cc-test-reporter sum-coverage tmp/cc.*.json -p 2 -o tmp/cc.total.json | |
./cc-test-reporter upload-coverage -i tmp/cc.total.json | |
- name: Notify slack build result | |
uses: lazy-actions/slatify@master | |
if: always() | |
with: | |
type: ${{ job.status }} | |
job_name: '*after-build*' | |
mention: 'here' | |
username: 'GitHub Actions' | |
mention_if: 'failure' | |
channel: '#ember-rails-todo-app' | |
url: ${{ secrets.SLACK_WEBHOOK }} | |
commit: true | |
token: ${{ secrets.GITHUB_TOKEN }} |