Skip to content

Commit

Permalink
Added tests for published gem
Browse files Browse the repository at this point in the history
  • Loading branch information
maxirmx committed Dec 13, 2023
1 parent 0d7c263 commit 2e4a25b
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 7 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/rake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: rake

on:
push:
branches: [ master, main ]
branches: [ main ]
paths-ignore:
- 'docs/**'
- '**.adoc'
Expand Down Expand Up @@ -278,8 +278,6 @@ jobs:
runs-on: windows-latest
strategy:
fail-fast: false
# Ruby 3.1 fails
# https://github.com/lutaml/expressir/issues/103
matrix:
ruby: [ '3.2', '3.1', '3.0', '2.7' ]
steps:
Expand Down
71 changes: 67 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,23 @@ jobs:

- run: bundle install --jobs 4 --retry 3

# build gem WITHOUT pre-built native extension
- run: gem build expressir.gemspec
- name: Build gem and save version
if: matrix.platform == 'linux-gnu'
run: |
gem build expressir.gemspec | grep -o 'Version: .*' | awk '{print $2}' > version
- if: matrix.platform == 'linux-gnu'
uses: actions/upload-artifact@v3
with:
name: pkg-ruby
path: expressir-*.gem

- if: matrix.platform == 'linux-gnu'
uses: actions/upload-artifact@v3
with:
name: version
path: version

- name: Enable swap
run: |
sudo fallocate -l 15g /compile.swap
Expand Down Expand Up @@ -108,12 +116,11 @@ jobs:
with:
ruby-version: '3.1'

- run: ls -l pkg/

- name: Publish to rubygems.org
env:
RUBYGEMS_API_KEY: ${{ secrets.LUTAML_CI_RUBYGEMS_API_KEY }}
run: |
ls -l pkg/
mkdir -p ~/.gem
cat > ~/.gem/credentials << EOF
---
Expand All @@ -122,3 +129,59 @@ jobs:
chmod 0600 ~/.gem/credentials
gem signin
for gem in pkg/*.gem; do gem push $gem -V; done
verify:
name: Verify published gem on ${{ matrix.os }}
needs: publish
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
steps:
- name: Install Ruby
uses: ruby/setup-ruby@master
with:
ruby-version: 3.1
bundler-cache: true
bundler: ${{ env.BUNDLER_VER }}

- name: Download version
uses: actions/download-artifact@v3
with:
name: version
path: version

- name: Install gem
run: gem install expressir -v $(cat version)

- name: Verify
run: |
cd $(ruby -e "puts RbConfig::TOPDIR + '\/lib\/ruby\/gems\/' + RbConfig::CONFIG['ruby_version'] + '\/gems\/expressir*'")
ruby bin/rspec
cat .rspec_status || echo ".rspec_status was not found"
verify-alpine:
name: Verify published gem on Alpine
needs: publish
runs-on: ubuntu-latest
container:
image: alpine:3.17
steps:
- name: Install packages
run: apk --no-cache add bash build-base git ruby-dev gcc g++ automake

- name: Download version
uses: actions/download-artifact@v3
with:
name: version
path: version

- name: Install gem
run: gem install expressir -v $(cat version)

- name: Verify
run: |
cd $(ruby -e "puts RbConfig::TOPDIR + '\/lib\/ruby\/gems\/' + RbConfig::CONFIG['ruby_version'] + '\/gems\/expressir*'")
ruby bin/rspec
cat .rspec_status || echo ".rspec_status was not found"

0 comments on commit 2e4a25b

Please sign in to comment.