Skip to content

Commit

Permalink
Merge pull request #100 from YOU54F/feat/ruby3_2_2_plus_arm64
Browse files Browse the repository at this point in the history
Feat/ruby3 2 2 plus arm64
  • Loading branch information
YOU54F authored Apr 28, 2023
2 parents ecf90e0 + 0634250 commit 57201f7
Show file tree
Hide file tree
Showing 19 changed files with 406 additions and 110 deletions.
59 changes: 59 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
BUILD_TEST_TASK_TEMPLATE: &BUILD_TEST_TASK_TEMPLATE
arch_check_script:
- uname -am
install_script: bundle install
build_script: bundle exec rake package
test_script: chmod +x ./script/test.sh && ./script/test.sh

linux_arm64_task:
env:
BINARY_OS: linux
BINARY_ARCH: arm64
PATH: "$HOME/.rbenv/bin:/root/.rbenv/shims:$PATH"
## *******************************
## Fails on Ruby:3.2.2 based image - fine on ubuntu latest, but installing ruby 3.2.2 from source takes a good while (few minutes)
## executing ./pact/bin/pactflow
## /tmp/cirrus-ci/working-dir/pkg/pact/lib/ruby/lib/ruby/3.2.0/bundler/definition.rb:524:in `materialize': Could not find pact-1.63.0, pact-message-0.11.1, pact-mock_service-3.11.0, pact-provider-verifier-1.36.1, pact_broker-client-1.66.1, webrick-1.8.1, rack-2.2.7, pact-support-1.19.0, rack-test-2.1.0, rspec-3.12.0, term-ansicolor-1.7.1, thor-1.2)
## from /tmp/cirrus-ci/working-dir/pkg/pact/lib/ruby/lib/ruby/3.2.0/bundler/definition.rb:197:in `specs'
## from /tmp/cirrus-ci/working-dir/pkg/pact/lib/ruby/lib/ruby/3.2.0/bundler/definition.rb:254:in `specs_for'
## from /tmp/cirrus-ci/working-dir/pkg/pact/lib/ruby/lib/ruby/3.2.0/bundler/runtime.rb:18:in `setup'
## from /tmp/cirrus-ci/working-dir/pkg/pact/lib/ruby/lib/ruby/3.2.0/bundler.rb:171:in `setup'
## from /tmp/cirrus-ci/working-dir/pkg/pact/lib/ruby/lib/ruby/3.2.0/bundler/setup.rb:23:in `block in <top (required)>'
## from /tmp/cirrus-ci/working-dir/pkg/pact/lib/ruby/lib/ruby/3.2.0/bundler/ui/shell.rb:159:in `with_level'
## from /tmp/cirrus-ci/working-dir/pkg/pact/lib/ruby/lib/ruby/3.2.0/bundler/ui/shell.rb:111:in `silence'
## from /tmp/cirrus-ci/working-dir/pkg/pact/lib/ruby/lib/ruby/3.2.0/bundler/setup.rb:23:in `<top (required)>'
## from <internal:/tmp/cirrus-ci/working-dir/pkg/pact/lib/ruby/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
## from <internal:/tmp/cirrus-ci/working-dir/pkg/pact/lib/ruby/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
## *******************************
# container:
# image: ruby:3.2.2
# architecture: arm64
# pre_req_script: |
# apt update --yes && apt install --yes git curl libssl-dev libreadline-dev zlib1g-dev autoconf bison build-essential libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev zip
# ruby --version
# bundler --version
arm_container:
image: ubuntu:latest
architecture: arm64
install_ruby_from_source_script: |
apt update --yes && apt install --yes git curl libssl-dev libreadline-dev zlib1g-dev autoconf bison build-essential libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev zip
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
rbenv install 3.2.2
rbenv global 3.2.2
ruby --version
bundler --version
<< : *BUILD_TEST_TASK_TEMPLATE

macosx_arm64_task:
macos_instance:
image: ghcr.io/cirruslabs/macos-ventura-base:latest
env:
BINARY_OS: osx
BINARY_ARCH: arm64
pre_req_script:
- brew install ruby
- ruby --version
<< : *BUILD_TEST_TASK_TEMPLATE

40 changes: 35 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,46 @@ on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3

- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.4.10

ruby-version: 3.2.2
- name: Set up environment
run: bundle install

- name: Build
run: bundle exec rake package
- name: Show standalone packages
run: ls pkg
- name: Upload standalone packages
uses: actions/upload-artifact@v3
with:
name: pkg
path: pkg
test:
defaults:
run:
shell: bash
needs: [build]
strategy:
fail-fast: false
matrix:
os: ["windows-latest","ubuntu-latest","macos-latest"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Download all workflow run artifacts
uses: actions/download-artifact@v3
- name: test ${{ matrix.os }} package
run: ./script/test.sh
- name: test x86 package
if: ${{ runner.os == 'Windows'}}
run: ./script/test.sh
env:
BINARY_OS: 'windows'
BINARY_ARCH: 'x86'
4 changes: 3 additions & 1 deletion .github/workflows/manual_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ on:
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.4.10
ruby-version: 3.2.2

- name: Set up environment
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.4.10
ruby-version: 3.2.2

- name: Set up environment
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.4.10
ruby-version: 3.2.2

- name: Set up environment
run: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ build

vendor/bundle/
pact
.DS_Store
4 changes: 2 additions & 2 deletions Dockerfile-bundle-base
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:2.2.10-alpine
FROM --platform=linux/amd64 ruby:3.2.2-alpine

# Installation path
ENV HOME=/app
Expand All @@ -9,6 +9,6 @@ RUN set -ex && \
chmod g+w $HOME && \
apk add --update --no-cache make gcc libc-dev

RUN gem install bundler -v 1.17.3
RUN gem install bundler -v "~> 2.4"
COPY packaging/Gemfile packaging/Gemfile.lock $HOME/
RUN bundle install --no-cache
20 changes: 20 additions & 0 deletions Dockerfile-package-base
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM --platform=linux/amd64 ruby:3.2.2-slim

RUN apt-get update && apt-get install -y \
curl \
zip \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

ENV HOME=/app
WORKDIR $HOME

RUN useradd --create-home --home-dir $HOME user \
&& mkdir -p $HOME \
&& chown -R user:user $HOME

RUN gem install bundler:2.4.0
RUN bundle install
COPY Rakefile README.md Gemfile Gemfile.lock VERSION $HOME/
COPY tasks $HOME/tasks
COPY packaging $HOME/packaging
RUN bundle exec rake package
4 changes: 2 additions & 2 deletions Dockerfile-release-base
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:2.2.10-alpine
FROM --platform=linux/amd64 ruby:3.2.2-alpine

# Installation path
ENV HOME=/app
Expand All @@ -9,6 +9,6 @@ RUN set -ex && \
chmod g+w $HOME && \
apk add --update --no-cache make gcc libc-dev git

RUN gem install bundler -v 1.15.4
RUN gem install bundler -v "~> 2.4"
COPY Gemfile Gemfile.lock $HOME/
RUN bundle install --no-cache
29 changes: 16 additions & 13 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
GEM
remote: http://rubygems.org/
specs:
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
bump (0.5.4)
addressable (2.8.3)
public_suffix (>= 2.0.2, < 6.0)
bump (0.10.0)
conventional-changelog (1.3.0)
faraday (0.13.1)
multipart-post (>= 1.2, < 3)
multipart-post (2.0.0)
octokit (4.7.0)
sawyer (~> 0.8.0, >= 0.5.3)
public_suffix (3.0.0)
faraday (2.7.4)
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-net_http (3.0.2)
octokit (4.25.1)
faraday (>= 1, < 3)
sawyer (~> 0.9)
public_suffix (5.0.1)
rake (12.3.3)
sawyer (0.8.1)
addressable (>= 2.3.5, < 2.6)
faraday (~> 0.8, < 1.0)
ruby2_keywords (0.0.5)
sawyer (0.9.2)
addressable (>= 2.3.5)
faraday (>= 0.17.3, < 3)

PLATFORMS
ruby
Expand All @@ -26,4 +29,4 @@ DEPENDENCIES
rake (~> 12.3)

BUNDLED WITH
1.15.4
2.4.10
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
# Pact Ruby Standalone

![Build](https://github.com/pact-foundation/pact-ruby-standalone/workflows/Build/badge.svg)
[![Build status](https://ci.appveyor.com/api/projects/status/32ci5o2kikr46kg9?svg=true)](https://ci.appveyor.com/project/MichelBoudreau/pact-ruby-standalone-windows-test)

Creates a standalone pact command line executable using the ruby pact implementation and Travelling Ruby

## Installation

See the [releases][releases] page for installation instructions.
See the [releases](https://github.com/pact-foundation/pact-ruby-standalone/releases) page for installation instructions.

## Usage

Download the appropriate package for your operating system from the [releases][releases] page and unzip it.
Download the appropriate package for your operating system from the [releases](https://github.com/pact-foundation/pact-ruby-standalone/releases) page and unzip it.

$ cd pact/bin
$ ./pact-mock-service --help start
$ ./pact-provider-verifier --help verify

[releases]: https://github.com/pact-foundation/pact-ruby-standalone/releases
## Supported Platforms

Ruby is not required on the host platform, Ruby 3.2.2 is provided in the distributable.


| OS | Ruby | Architecture | Supported |
| -------| ------- | ------------ | --------- |
| MacOS | 3.2.2 | x86_64 ||
| MacOS | 3.2.2 | aarch64 (arm64)||
| Linux | 3.2.2 | x86_64 ||
| Linux | 3.2.2 | aarch64 (arm64)||
| Windows| 3.2.2 | x86_64 ||
| Windows| 3.2.2 | x86 ||
| Windows| 3.2.2 | aarch64 (arm64)| 🚧 |
2 changes: 1 addition & 1 deletion RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

Run:

chruby 2.2 #or whatever your version manager is
chruby 3.2.2 #or whatever your version manager is
script/release.sh [major|minor|patch] # default is minor
10 changes: 8 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@ case $(uname -sm) in
'Linux x86_64')
os='linux-x86_64'
;;
'Darwin x86' | 'Darwin x86_64' | 'Darwin arm64')
os='osx'
'Linux aarch64')
os='linux-arm64'
;;
'Darwin arm64')
os='osx-arm64'
;;
'Darwin x86' | 'Darwin x86_64')
os='osx-x86_64'
;;
*)
echo "Sorry, you'll need to install the pact-ruby-standalone manually."
Expand Down
15 changes: 6 additions & 9 deletions packaging/Gemfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
source 'http://rubygems.org'

gem "pact", "1.62.0"
gem "pact", "1.63.0"
gem "pact-message", "0.11.1"
gem "pact-mock_service", "3.9.0"
gem "pact-mock_service", "3.11.0"
gem "pact-provider-verifier", "1.36.1"
gem "pact_broker-client", "1.65.0"
gem "webrick", "1.6.1" # Later versions require Ruby 2.3
gem "rack", "~>2.2.6"
gem "json", "2.0.4"

# Locking this until we have given rack-test 3.0 a good shake out in pure Ruby
gem "rack-test", ">= 0.6.3", "< 2.0.0"
gem "pact_broker-client", "1.66.1"
gem "webrick", "1.8.1"
gem 'rack', '>= 2.2.6'
gem "json", "2.6.3"
Loading

0 comments on commit 57201f7

Please sign in to comment.