2023-03-07 12:49:43 +09:00
|
|
|
name: Ruby Testing
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2023-03-08 15:12:57 +09:00
|
|
|
branches-ignore:
|
|
|
|
- 'dependabot/**'
|
2023-03-07 12:49:43 +09:00
|
|
|
pull_request:
|
|
|
|
|
|
|
|
env:
|
|
|
|
BUNDLE_CLEAN: true
|
|
|
|
BUNDLE_FROZEN: true
|
|
|
|
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
2023-05-05 16:06:51 +09:00
|
|
|
strategy:
|
|
|
|
fail-fast: true
|
|
|
|
matrix:
|
|
|
|
mode:
|
|
|
|
- production
|
|
|
|
- test
|
2023-03-07 12:49:43 +09:00
|
|
|
env:
|
2023-05-05 16:06:51 +09:00
|
|
|
RAILS_ENV: ${{ matrix.mode }}
|
|
|
|
BUNDLE_WITH: ${{ matrix.mode }}
|
|
|
|
OTP_SECRET: precompile_placeholder
|
|
|
|
SECRET_KEY_BASE: precompile_placeholder
|
2023-03-07 12:49:43 +09:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Set up Node.js
|
|
|
|
uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
cache: yarn
|
|
|
|
node-version-file: '.nvmrc'
|
|
|
|
|
|
|
|
- name: Install native Ruby dependencies
|
2023-03-30 21:19:33 +09:00
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y libicu-dev libidn11-dev
|
2023-03-07 12:49:43 +09:00
|
|
|
|
|
|
|
- name: Set up bundler cache
|
|
|
|
uses: ruby/setup-ruby@v1
|
|
|
|
with:
|
|
|
|
ruby-version: .ruby-version
|
|
|
|
bundler-cache: true
|
|
|
|
|
2023-03-24 06:49:47 +09:00
|
|
|
- run: yarn --frozen-lockfile --production
|
2023-03-07 12:49:43 +09:00
|
|
|
- name: Precompile assets
|
|
|
|
# Previously had set this, but it's not supported
|
|
|
|
# export NODE_OPTIONS=--openssl-legacy-provider
|
|
|
|
run: |-
|
|
|
|
./bin/rails assets:precompile
|
|
|
|
|
|
|
|
- uses: actions/upload-artifact@v3
|
2023-05-05 16:06:51 +09:00
|
|
|
if: matrix.mode == 'test'
|
2023-03-07 12:49:43 +09:00
|
|
|
with:
|
|
|
|
path: |-
|
|
|
|
./public/assets
|
|
|
|
./public/packs-test
|
|
|
|
name: ${{ github.sha }}
|
|
|
|
retention-days: 0
|
|
|
|
|
|
|
|
test:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
needs:
|
|
|
|
- build
|
|
|
|
|
|
|
|
services:
|
|
|
|
postgres:
|
2023-03-10 19:10:47 +09:00
|
|
|
image: postgres:14-alpine
|
2023-03-07 12:49:43 +09:00
|
|
|
env:
|
|
|
|
POSTGRES_PASSWORD: postgres
|
|
|
|
POSTGRES_USER: postgres
|
|
|
|
options: >-
|
|
|
|
--health-cmd pg_isready
|
|
|
|
--health-interval 10s
|
|
|
|
--health-timeout 5s
|
|
|
|
--health-retries 5
|
|
|
|
ports:
|
|
|
|
- 5432:5432
|
|
|
|
|
|
|
|
redis:
|
2023-03-10 19:10:47 +09:00
|
|
|
image: redis:7-alpine
|
2023-03-07 12:49:43 +09:00
|
|
|
options: >-
|
|
|
|
--health-cmd "redis-cli ping"
|
|
|
|
--health-interval 10s
|
|
|
|
--health-timeout 5s
|
|
|
|
--health-retries 5
|
|
|
|
ports:
|
|
|
|
- 6379:6379
|
|
|
|
|
|
|
|
env:
|
|
|
|
DB_HOST: localhost
|
|
|
|
DB_USER: postgres
|
|
|
|
DB_PASS: postgres
|
|
|
|
DISABLE_SIMPLECOV: true
|
|
|
|
RAILS_ENV: test
|
|
|
|
ALLOW_NOPAM: true
|
|
|
|
PAM_ENABLED: true
|
|
|
|
PAM_DEFAULT_SERVICE: pam_test
|
|
|
|
PAM_CONTROLLED_SERVICE: pam_test_controlled
|
2023-05-05 16:06:51 +09:00
|
|
|
BUNDLE_WITH: 'pam_authentication test'
|
2023-03-07 12:49:43 +09:00
|
|
|
CI_JOBS: ${{ matrix.ci_job }}/4
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
ruby-version:
|
|
|
|
- '3.0'
|
|
|
|
- '3.1'
|
|
|
|
- '.ruby-version'
|
|
|
|
ci_job:
|
|
|
|
- 1
|
|
|
|
- 2
|
|
|
|
- 3
|
|
|
|
- 4
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
path: './public'
|
|
|
|
name: ${{ github.sha }}
|
|
|
|
|
2023-03-30 21:19:33 +09:00
|
|
|
- name: Update package index
|
|
|
|
run: sudo apt-get update
|
|
|
|
|
2023-03-07 12:49:43 +09:00
|
|
|
- name: Install native Ruby dependencies
|
|
|
|
run: sudo apt-get install -y libicu-dev libidn11-dev
|
|
|
|
|
|
|
|
- name: Install additional system dependencies
|
|
|
|
run: sudo apt-get install -y ffmpeg imagemagick libpam-dev
|
|
|
|
|
|
|
|
- name: Set up bundler cache
|
|
|
|
uses: ruby/setup-ruby@v1
|
|
|
|
with:
|
|
|
|
ruby-version: ${{ matrix.ruby-version}}
|
|
|
|
bundler-cache: true
|
|
|
|
|
|
|
|
- name: Load database schema
|
|
|
|
run: './bin/rails db:create db:schema:load db:seed'
|
|
|
|
|
|
|
|
- run: bundle exec rake rspec_chunked
|