Add versions to error reports #439
Workflow file for this run
This file contains hidden or 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-cd | |
on: | |
push: | |
branches: | |
- develop | |
pull_request: | |
branches: | |
- develop | |
env: | |
RAILS_ENV: test | |
RUBY_VERSION: 3.2 | |
permissions: | |
actions: write | |
contents: read | |
issues: read | |
pull-requests: read | |
jobs: | |
rubocop: | |
name: Rubocop checking | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Setup dependencies | |
run: | | |
sudo apt-get update -qq | |
sudo apt-get install -yqq libmagickwand-dev | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ env.RUBY_VERSION }} | |
bundler-cache: true | |
- run: bundle exec rubocop | |
typescript: | |
name: TypeScript type checking | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Install Node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 22 | |
- run: npm install | |
- run: tsc | |
tests: | |
name: Ruby on Rails tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
ruby_version: [3.1, 3.2] | |
test_type: [test, test:system] | |
services: | |
mysql: | |
image: mysql:8.0 | |
env: | |
MYSQL_ROOT_HOST: '%' | |
MYSQL_ROOT_PASSWORD: 'root' | |
MYSQL_DATABASE: 'qpixel_test' | |
ports: | |
- 3306:3306 | |
redis: | |
image: redis:8.0 | |
ports: | |
- 6379:6379 | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Setup dependencies | |
run: | | |
sudo apt-get -qq update | |
sudo apt-get -yqq install libmariadb-dev libmagickwand-dev | |
- name: Setup Firefox | |
if: ${{ matrix.test_type == 'test:system' }} | |
uses: browser-actions/[email protected] | |
- name: Check Firefox setup | |
if: ${{ matrix.test_type == 'test:system' }} | |
run: firefox --version | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby_version }} | |
bundler-cache: true | |
- name: Prepare for testing | |
run: | | |
cp config/database.sample.yml config/database.yml | |
cp config/storage.sample.yml config/storage.yml | |
bundle exec rails db:create | |
bundle exec rails db:schema:load | |
bundle exec rails db:migrate | |
bundle exec rails test:prepare | |
- run: bundle exec rails ${{ matrix.test_type }} | |
- name: Upload screenshots | |
if: ${{ matrix.test_type == 'test:system' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: screenshots-${{ matrix.ruby_version }} | |
path: tmp/screenshots | |
if-no-files-found: ignore | |
- uses: codecov/codecov-action@v5 | |
if: ${{ matrix.ruby_version == env.RUBY_VERSION && matrix.test_type == 'test' && github.actor != 'dependabot[bot]' }} | |
with: | |
directory: coverage | |
fail_ci_if_error: true | |
report_type: coverage | |
token: ${{ secrets.CODECOV_TOKEN }} | |
deploy: | |
name: Dev server deployment | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'push' && github.actor != 'dependabot[bot]' }} | |
needs: | |
- rubocop | |
- typescript | |
- tests | |
env: | |
SSH_IP: ${{ secrets.DEV_SSH_IP }} | |
SSH_KEY: ${{ secrets.DEV_SSH_KEY }} | |
SSH_PORT: ${{ secrets.DEV_SSH_PORT }} | |
SSH_USER: ${{ secrets.DEV_SSH_USER }} | |
steps: | |
- name: Check SSH version | |
run: ssh -V | |
- name: Import key | |
run: | | |
mkdir -p ~/.ssh | |
echo "$SSH_KEY" > ~/.ssh/deploy.key | |
chmod 0700 ~/.ssh/deploy.key | |
- name: Deploy | |
run: | | |
ssh -o 'StrictHostKeyChecking no' \ | |
-o 'KbdInteractiveAuthentication no' \ | |
-o 'PasswordAuthentication no' \ | |
-p "$SSH_PORT" \ | |
-i ~/.ssh/deploy.key \ | |
"$SSH_USER"@"$SSH_IP" \ | |
"sudo su -l qpixel /var/apps/deploy-dev" |