Skip to content

Commit e909040

Browse files
committed
chore(ci): Migrate from Travis to GH actions
1 parent 235992e commit e909040

5 files changed

Lines changed: 105 additions & 53 deletions

File tree

.github/workflows/ci.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-22.04
11+
12+
services:
13+
postgres:
14+
image: postgres:14
15+
env:
16+
POSTGRES_USER: travis
17+
POSTGRES_HOST_AUTH_METHOD: trust
18+
options: >-
19+
--health-cmd pg_isready
20+
--health-interval 10s
21+
--health-timeout 5s
22+
--health-retries 5
23+
ports:
24+
- 5432:5432
25+
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
ruby: ['3.0', '3.1', '3.2', '3.3']
30+
31+
env:
32+
PGPORT: 5432
33+
PGUSER: travis
34+
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- uses: ruby/setup-ruby@v1
39+
with:
40+
ruby-version: ${{ matrix.ruby }}
41+
bundler-cache: true
42+
43+
- name: Install yarn dependencies
44+
run: yarn install
45+
46+
- name: Run tests
47+
run: bundle exec rake test
48+
49+
release:
50+
needs: test
51+
runs-on: ubuntu-22.04
52+
if: github.ref == 'refs/heads/master'
53+
54+
permissions:
55+
contents: write
56+
id-token: write # required for RubyGems trusted publishing
57+
58+
steps:
59+
- name: Generate GitHub App token
60+
id: app-token
61+
uses: actions/create-github-app-token@v1
62+
with:
63+
app-id: ${{ secrets.RELEASE_BOT_APP_ID }}
64+
private-key: ${{ secrets.RELEASE_BOT_PRIVATE_KEY }}
65+
66+
- uses: actions/checkout@v4
67+
with:
68+
fetch-depth: 0
69+
token: ${{ steps.app-token.outputs.token }}
70+
71+
- uses: ruby/setup-ruby@v1
72+
with:
73+
ruby-version: '3.0'
74+
bundler-cache: true
75+
76+
- uses: actions/setup-node@v4
77+
with:
78+
node-version: lts/*
79+
80+
- name: Install semantic-release
81+
run: |
82+
npm i -g \
83+
semantic-release \
84+
@semantic-release/git \
85+
@semantic-release/changelog \
86+
semantic-release-rubygem
87+
88+
- name: Configure RubyGems credentials
89+
uses: rubygems/configure-rubygems-credentials@v1
90+
91+
- name: Release
92+
env:
93+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
94+
run: ./release.sh

.travis.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

README.md

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

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

2727
## Internal architecture
2828

README_CI.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# Configuration variables:
22

3-
* `GH_TOKEN`: used by `semantic-release` to push changes to Github and manage releases
4-
* `GEM_HOST_API_KEY`: rubygems API key
5-
* `GEM_ALTERNATIVE_NAME` (optional): used for testing of CI flows,
3+
* `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
4+
* RubyGems publishing uses OIDC trusted publishing — no API key required
5+
* `GEM_ALTERNATIVE_NAME` (optional): used for testing of CI flows,
66
to avoid publication of test releases under official package name
77

88
# Release command
99

10-
`./release.sh`
10+
`./release.sh`
1111

12-
Bash wrapper script is used merely as a launcher of `semantic-release`
13-
with extra logic to explicitly determine git url from `TRAVIS_REPO_SLUG` \
14-
variable if its defined (otherwise git url is taken from `package.json`,
12+
Bash wrapper script is used merely as a launcher of `semantic-release`
13+
with extra logic to explicitly determine git url from `GITHUB_REPOSITORY` \
14+
variable if its defined (otherwise git url is taken from `package.json`,
1515
which breaks CI on forked repos).
1616

1717
# CI flow

release.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# using bash wrapper as Rake blows up in `require/extentiontask` (line 10)
33

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

99
if [ ! -z "$GEM_ALTERNATIVE_NAME" ]; then
1010
echo "Release: GEM_ALTERNATIVE_NAME=$GEM_ALTERNATIVE_NAME"

0 commit comments

Comments
 (0)