Skip to content

CORE-978: Indicate first & last names are required #2320

CORE-978: Indicate first & last names are required

CORE-978: Indicate first & last names are required #2320

Workflow file for this run

name: Tests
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
OXA_DB_USER: accounts
OXA_DB_PASS: accounts
OXA_TEST_DB: ci_test
RAILS_ENV: test
HEADLESS: true
on:
pull_request:
push:
branches:
- main
schedule:
- cron: '0 0 * * 0' # weekly
# Add concurrency to cancel outdated workflow runs
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
tests:
timeout-minutes: 30
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['3.1']
postgres-version: ['16']
services:
postgres:
image: postgres:${{ matrix.postgres-version }}
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
env:
POSTGRES_USER: ${{ env.OXA_DB_USER }}
POSTGRES_DB: ${{ env.OXA_TEST_DB }}
POSTGRES_PASSWORD: ${{ env.OXA_DB_PASS }}
steps:
- uses: actions/checkout@v4
- name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
- name: Cache PostgreSQL data
uses: actions/cache@v4
with:
path: /tmp/postgres-data
key: postgres-${{ matrix.postgres-version }}-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
postgres-${{ matrix.postgres-version }}-
- name: Cache test results
uses: actions/cache@v4
with:
path: |
tmp/cache
tmp/parallel_*
key: test-results-${{ matrix.ruby-version }}-${{ github.sha }}
restore-keys: |
test-results-${{ matrix.ruby-version }}-
- name: Test
id: test
run: |
bin/rake parallel:create parallel:load_schema parallel:seed --trace
WORKERS=4 bin/rake parallel:spec
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.ruby-version }}
path: |
tmp/parallel_*
log/test.log
retention-days: 14
- name: Generate Test Report
if: always()
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const path = require('path');
// Read test results
const testLog = fs.readFileSync('log/test.log', 'utf8');
const parallelLogs = fs.readdirSync('tmp')
.filter(file => file.startsWith('parallel_'))
.map(file => fs.readFileSync(`tmp/${file}`, 'utf8'));
// Parse test results
const failures = [];
const errors = [];
// Parse test.log
const testLogLines = testLog.split('\n');
for (const line of testLogLines) {
if (line.includes('FAILED') || line.includes('Error:')) {
failures.push(line.trim());
}
}
// Parse parallel logs
for (const log of parallelLogs) {
const lines = log.split('\n');
for (const line of lines) {
if (line.includes('FAILED') || line.includes('Error:')) {
failures.push(line.trim());
}
}
}
// Generate report
const report = `# Test Results Report
## Summary
- Ruby Version: ${{ matrix.ruby-version }}
- PostgreSQL Version: ${{ matrix.postgres-version }}
- Status: ${{ steps.test.outcome }}
## Failures (${failures.length})
${failures.map(f => `- ${f}`).join('\n')}
## Test Log Excerpt
\`\`\`
${testLogLines.slice(-50).join('\n')}
\`\`\`
`;
// Save report
fs.writeFileSync('test-report.md', report);
- name: Upload Test Report
if: always()
uses: actions/upload-artifact@v4
with:
name: test-report-${{ matrix.ruby-version }}
path: test-report.md
retention-days: 14
- name: Notify on failure
if: failure()
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const report = fs.readFileSync('test-report.md', 'utf8');
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `❌ Tests failed for Ruby ${{ matrix.ruby-version }}.\n\n${report}\n\nCheck the [workflow run](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}) for more details.`
});