Skip to content
This repository was archived by the owner on Jan 27, 2023. It is now read-only.

Commit 29290dc

Browse files
authored
Merge pull request #18 from cipherstash/add-tests-to-ci
Add CI workflow for running tests
2 parents 9dc9260 + b2bb9f6 commit 29290dc

3 files changed

Lines changed: 79 additions & 0 deletions

File tree

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: "ActiveStash: Smoke Test"
2+
on:
3+
pull_request:
4+
branches: [ main ]
5+
push:
6+
branches: [ main ]
7+
jobs:
8+
active-stash-smoke-test:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
fail-fast: false
12+
env:
13+
BUNDLE_GEMFILE: active_stash_smoke_test.gemfile
14+
RSPEC_FULL_BACKTRACE: yes
15+
CS_IDP_CLIENT_SECRET: ${{ secrets.CS_IDP_CLIENT_SECRET }}
16+
CS_WORKSPACE: ${{ secrets.CS_WORKSPACE }}
17+
CS_KMS_KEY_ARN: ${{ secrets.CS_KMS_KEY_ARN }}
18+
CS_NAMING_KEY: ${{ secrets.CS_NAMING_KEY }}
19+
RAILS_VERSION: 6
20+
ACTIVE_STASH_TEST_COLLECTION_PREFIX: run_${{ github.run_number }}.${{ github.run_attempt }}
21+
PGDATABASE: test
22+
steps:
23+
- uses: actions/checkout@v2
24+
with:
25+
repository: cipherstash/activestash
26+
- name: "Create gemfile"
27+
# github.head_ref is used for pull_request events and pushes to draft PRs.
28+
# github.ref_name is used for pushes to open pull requests.
29+
# https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
30+
run: |
31+
cat <<EOF > active_stash_smoke_test.gemfile
32+
source "https://rubygems.org"
33+
gemspec
34+
gem "rails", "~> 6.0.0"
35+
gem "cipherstash-client", git: "https://github.com/cipherstash/ruby-client", branch: "${{ github.head_ref || github.ref_name }}"
36+
EOF
37+
- uses: ruby/setup-ruby@v1
38+
with:
39+
ruby-version: 2.7
40+
bundler-cache: false # don't use bundler-cache because we need to run bundle install manually in a later step
41+
- uses: ankane/setup-postgres@v1
42+
with:
43+
database: ${{ env.PGDATABASE }}
44+
# Installs GVB so that bundler can resolve the version of cipherstash-client when specified as a Git dependency
45+
- name: "Install GVB"
46+
run: gem install git-version-bump
47+
# Run bundle install now that git-version-bump is available. Normally this is handled by ruby/setup-ruby@v1
48+
# with bundler-cache=true
49+
- name: "Install dependencies"
50+
run: bundle install
51+
- name: "Install default uri gem version"
52+
run: gem install --default -v0.11.0 uri
53+
- name: Run the tests
54+
run: bundle exec rake spec

.github/workflows/test.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: "StashRB: Test"
2+
on:
3+
pull_request:
4+
branches: [ main ]
5+
push:
6+
branches: [ main ]
7+
jobs:
8+
run-specs:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
# Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
13+
ruby-version: ['2.7', '3.0', '3.1']
14+
env:
15+
RSPEC_FULL_BACKTRACE: yes
16+
steps:
17+
- uses: actions/checkout@v2
18+
- uses: ruby/setup-ruby@v1
19+
with:
20+
ruby-version: ${{ matrix.ruby-version }}
21+
bundler-cache: true
22+
- name: Run the tests
23+
run: bundle exec rake test

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ source 'https://rubygems.org/'
33
# Work around hideousness of FakeFS
44
require "pp"
55
gemspec
6+
7+
gem 'ox', '~> 2.4', '>= 2.4.1'

0 commit comments

Comments
 (0)