Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: CI

on:
push:
branches: [master]
pull_request:

jobs:
test:
runs-on: ubuntu-22.04

services:
postgres:
image: postgres:14
env:
POSTGRES_USER: travis
POSTGRES_HOST_AUTH_METHOD: trust
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

strategy:
fail-fast: false
matrix:
ruby: ['3.0', '3.1', '3.2', '3.3']

env:
PGPORT: 5432
PGUSER: travis
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Rails fixture apps' config/database.yml doesn't specify a host, so libpq will default to a local Unix socket when DATABASE_URL is unset. In GitHub Actions the Postgres service runs in a container, so connections must go over TCP; please set PGHOST=localhost (or set DATABASE_URL to include localhost and the mapped port) so tests can actually reach the service container.

Suggested change
PGUSER: travis
PGUSER: travis
PGHOST: localhost

Copilot uses AI. Check for mistakes.
PGHOST: localhost

steps:
- uses: actions/checkout@v4

- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Install yarn dependencies
run: yarn install

- name: Run tests
run: bundle exec rake test

release:
needs: test
runs-on: ubuntu-22.04
if: github.ref == 'refs/heads/master'

permissions:
contents: write
id-token: write # required for RubyGems trusted publishing

steps:
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.RELEASE_BOT_APP_ID }}
private-key: ${{ secrets.RELEASE_BOT_PRIVATE_KEY }}

- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}

- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true

- uses: actions/setup-node@v4
with:
node-version: lts/*

- name: Install semantic-release
run: |
npm i -g \
semantic-release \
@semantic-release/git \
@semantic-release/changelog \
semantic-release-rubygem

- name: Configure RubyGems credentials
uses: rubygems/configure-rubygems-credentials@v1

- name: Release
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
run: ./release.sh
42 changes: 0 additions & 42 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ granular than a full debug trace. It's designed to be optimal for understanding
Visit the [AppMap for Ruby](https://appland.com/docs/reference/appmap-ruby.html) reference page on AppLand.com for a complete reference guide.

# Development
[![Build Status](https://travis-ci.com/getappmap/appmap-ruby.svg?branch=master)](https://travis-ci.com/getappmap/appmap-ruby)
[![CI](https://github.com/getappmap/appmap-ruby/actions/workflows/ci.yml/badge.svg)](https://github.com/getappmap/appmap-ruby/actions/workflows/ci.yml)

## Internal architecture

Expand Down
14 changes: 7 additions & 7 deletions README_CI.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Configuration variables:

* `GH_TOKEN`: used by `semantic-release` to push changes to Github and manage releases
* `GEM_HOST_API_KEY`: rubygems API key
* `GEM_ALTERNATIVE_NAME` (optional): used for testing of CI flows,
* `RELEASE_BOT_APP_ID`, `RELEASE_BOT_PRIVATE_KEY`: GitHub App credentials used to generate a token for `semantic-release` to push changes to GitHub and manage releases
* RubyGems publishing uses OIDC trusted publishing — no API key required
* `GEM_ALTERNATIVE_NAME` (optional): used for testing of CI flows,
to avoid publication of test releases under official package name

# Release command

`./release.sh`
`./release.sh`

Bash wrapper script is used merely as a launcher of `semantic-release`
with extra logic to explicitly determine git url from `TRAVIS_REPO_SLUG` \
variable if its defined (otherwise git url is taken from `package.json`,
Bash wrapper script is used merely as a launcher of `semantic-release`
with extra logic to explicitly determine git url from `GITHUB_REPOSITORY` \
variable if its defined (otherwise git url is taken from `package.json`,
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grammar: its should be it's in "variable if its defined".

Suggested change
variable if its defined (otherwise git url is taken from `package.json`,
variable if it’s defined (otherwise git url is taken from `package.json`,

Copilot uses AI. Check for mistakes.
which breaks CI on forked repos).

# CI flow
Expand Down
6 changes: 3 additions & 3 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# using bash wrapper as Rake blows up in `require/extentiontask` (line 10)

RELEASE_FLAGS=""
if [ ! -z "$TRAVIS_REPO_SLUG" ]; then
RELEASE_FLAGS="-r git+https://github.com/${TRAVIS_REPO_SLUG}.git"
fi
if [ ! -z "$GITHUB_REPOSITORY" ]; then
RELEASE_FLAGS="-r git+https://github.com/${GITHUB_REPOSITORY}.git"
fi

if [ ! -z "$GEM_ALTERNATIVE_NAME" ]; then
Comment on lines +5 to 9
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using a more robust/idiomatic env var check here, e.g. -n "${GITHUB_REPOSITORY:-}", to avoid edge cases with unset variables and to satisfy common shell linters (ShellCheck warns about ! -z).

Suggested change
if [ ! -z "$GITHUB_REPOSITORY" ]; then
RELEASE_FLAGS="-r git+https://github.com/${GITHUB_REPOSITORY}.git"
fi
if [ ! -z "$GEM_ALTERNATIVE_NAME" ]; then
if [ -n "${GITHUB_REPOSITORY:-}" ]; then
RELEASE_FLAGS="-r git+https://github.com/${GITHUB_REPOSITORY}.git"
fi
if [ -n "${GEM_ALTERNATIVE_NAME:-}" ]; then

Copilot uses AI. Check for mistakes.
echo "Release: GEM_ALTERNATIVE_NAME=$GEM_ALTERNATIVE_NAME"
Expand Down
5 changes: 5 additions & 0 deletions spec/fixtures/rails6_users_app/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ gem 'sequel', '>= 5.43.0', require: false
gem 'sequel-rails', require: false
gem 'sequel_secure_password', require: false

# pin to avoid uninitialized constant ActiveSupport::LoggerThreadSafeLevel::Logger
gem 'concurrent-ruby', '1.3.4'

gem 'mutex_m'

group :development, :test do
gem 'appmap', path: '../../..'
gem 'cucumber-rails', require: false
Expand Down
20 changes: 13 additions & 7 deletions spec/record_sql_rails_pg_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,21 @@ def self.check_queries(cases)
context 'with ActiveRecord' do
before(:context) { run_specs 'activerecord' }

expected_query = if rails_version == 7
%(INSERT INTO "users" ("login", "password_digest") VALUES ($1, $2) RETURNING "id")
else
%(INSERT INTO "users" ("login") VALUES ($1) RETURNING "id")
end
expected_insert = if rails_version == 7
%(INSERT INTO "users" ("login", "password_digest") VALUES ($1, $2) RETURNING "id")
else
%(INSERT INTO "users" ("login") VALUES ($1) RETURNING "id")
end

expected_select = if rails_version >= 6
%(SELECT * FROM "users")
else
%(SELECT "users".* FROM "users")
end

check_queries(
'Api_UsersController_POST_api_users_with_required_parameters_creates_a_user' => expected_query,
'Api_UsersController_GET_api_users_lists_the_users' => %(SELECT "users".* FROM "users")
'Api_UsersController_POST_api_users_with_required_parameters_creates_a_user' => expected_insert,
'Api_UsersController_GET_api_users_lists_the_users' => expected_select
)
end

Expand Down
Loading