testing the progress report generation #86
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: | |
pull_request: | |
push: | |
branches: [ main ] | |
jobs: | |
scan_ruby: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: .ruby-version | |
bundler-cache: true | |
- name: Scan for common Rails security vulnerabilities using static analysis | |
run: bin/brakeman --no-pager | |
scan_js: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: .ruby-version | |
bundler-cache: true | |
- name: Scan for security vulnerabilities in JavaScript dependencies | |
run: bin/importmap audit | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: .ruby-version | |
bundler-cache: true | |
- name: Lint code for consistent style | |
run: bin/rubocop -f github | |
test: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write # To post comments on PR | |
# services: | |
# redis: | |
# image: redis | |
# ports: | |
# - 6379:6379 | |
# options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- name: Install packages | |
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y google-chrome-stable curl libjemalloc2 libsqlite3-0 libvips | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: .ruby-version | |
bundler-cache: true | |
- name: Run tests | |
env: | |
RAILS_ENV: test | |
# REDIS_URL: redis://localhost:6379/0 | |
run: | | |
bin/rails db:test:prepare | |
# bin/rails test:system | |
bin/rails test test/** | |
# - name: Open SSH session for debugging action | |
# uses: lhotari/action-upterm@v1 | |
- name: Send SimpleCov to flaky.xyz | |
id: flaky-xyz-upload | |
if: always() | |
run: | | |
find config app lib -name '*.rb' -print0 | rsync -av --files-from=- --from0 ./ coverage/code; | |
zip -r simplecov.zip coverage; | |
RESPONSE=$(curl -X POST https://flaky.xyz/api/reports/simplecov \ | |
-F "[email protected]" \ | |
-F "branch=${{ github.head_ref || github.ref_name }}" \ | |
-H "Authorization: Bearer ${{ secrets.FLAKY_XYZ_TOKEN }}"); | |
echo $RESPONSE; | |
echo "MARKDOWN=$(echo $RESPONSE | jq -r '.markdown')" >> $GITHUB_OUTPUT; | |
- name: Comment PR with flaky.xyz results | |
uses: thollander/actions-comment-pull-request@v3 | |
if: ${{ github.event_name == 'pull_request' }} | |
with: | |
message: | | |
${{ steps.flaky-xyz-upload.outputs.MARKDOWN }} | |
comment-tag: flaky-xyx-simplecov | |
mode: recreate | |
- name: Keep screenshots from failed system tests | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: screenshots | |
path: ${{ github.workspace }}/tmp/screenshots | |
if-no-files-found: ignore |