Repository navigation
66 lines (63 loc) · 1.99 KB
/
Copy pathgem.yml
File metadata and controls
66 lines (63 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Release Ruby Gem
on:
push:
tags:
- "v*"
permissions:
contents: write
id-token: write
jobs:
release:
name: Release gem to RubyGems.org
runs-on: ubuntu-latest
environment:
name: release
url: https://rubygems.org/gems/mammoth
services:
postgres:
image: postgres:17
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: mammoth_e2e
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres -d mammoth_e2e"
--health-interval 5s
--health-timeout 5s
--health-retries 10
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- name: Install native extension headers
run: |
sudo apt-get update
sudo apt-get install -y libsqlite3-dev
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "4.0.5"
bundler-cache: true
- name: Check tag matches gem version
run: |
version="$(ruby -Ilib -rmammoth/version -e 'puts Mammoth::VERSION')"
tag="${GITHUB_REF_NAME#v}"
if [ "$tag" != "$version" ]; then
echo "Tag v$tag does not match gem version $version"
exit 1
fi
- name: Run quality gates
run: bundle exec rake
- name: Enable PostgreSQL logical replication
run: |
docker exec "${{ job.services.postgres.id }}" psql -U postgres -d mammoth_e2e -c "ALTER SYSTEM SET wal_level = 'logical'"
docker restart "${{ job.services.postgres.id }}"
until docker exec "${{ job.services.postgres.id }}" pg_isready -U postgres -d mammoth_e2e; do sleep 1; done
- name: Run E2E tests
run: bundle exec rake test:e2e
env:
MAMMOTH_E2E_POSTGRES_URL: postgres://postgres:postgres@127.0.0.1:5432/mammoth_e2e
- name: Release gem to RubyGems.org
uses: rubygems/release-gem@v1