Test new asherah-ffi #314
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: | |
| pull_request: | |
| branches: | |
| - "*" | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| specs: | |
| runs-on: ${{ matrix.os }} | |
| name: specs ruby-${{ matrix.ruby }} ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ ubuntu-latest, macos-latest ] | |
| ruby: [ 2.7, 3.0, 3.1, 3.2 ] | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby }} | |
| bundler: default | |
| bundler-cache: true | |
| - name: Run specs | |
| run: | | |
| COVERAGE=true bundle exec rake spec | |
| - name: Run rubocop | |
| run: | | |
| bundle exec rubocop | |
| smoke: | |
| runs-on: ${{ matrix.os }} | |
| name: smoke ruby-${{ matrix.ruby }} ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - { os: ubuntu-latest , platform: x86_64-linux , ruby: 3.0 } | |
| - { os: macos-latest , platform: x86_64-darwin , ruby: 3.0 } | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby }} | |
| bundler: default | |
| bundler-cache: true | |
| - name: Smoke test gem | |
| run: | | |
| bundle exec rake build | |
| gem install pkg/asherah-$(bundle exec rake version).gem | |
| ruby spec/smoke_test.rb # Don't use `bundle exec` to load the installed gem. | |
| gem uninstall asherah | |
| - name: Smoke test platform gem | |
| run: | | |
| bundle exec rake native:build:${{ matrix.platform }} | |
| gem install pkg/asherah-$(bundle exec rake version)-${{ matrix.platform }}.gem | |
| ruby spec/smoke_test.rb # Don't use `bundle exec` to load the installed gem. | |
| gem uninstall asherah | |
| smoke_arm64: | |
| runs-on: ${{ matrix.os }} | |
| name: smoke arm32 ruby-${{ matrix.ruby }} ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - { os: ubuntu-latest , platform: aarch64-linux , ruby: 3.0 } | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby }} | |
| bundler: default | |
| bundler-cache: true | |
| - name: Smoke test gems | |
| run: | | |
| bundle exec rake build | |
| bundle exec rake native:build:${{ matrix.platform }} | |
| GEM_NAME=asherah-$(bundle exec rake version).gem | |
| GEM_PLATFORM_NAME=asherah-$(bundle exec rake version)-${{ matrix.platform }}.gem | |
| docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | |
| docker run --rm --volume "$(pwd):/asherah" \ | |
| --platform linux/arm64/v8 \ | |
| --workdir /asherah \ | |
| ruby:${{matrix.ruby}}-bullseye \ | |
| /bin/sh -c " | |
| gem install pkg/$GEM_NAME | |
| ruby spec/smoke_test.rb | |
| gem uninstall asherah | |
| gem install pkg/$GEM_PLATFORM_NAME | |
| ruby spec/smoke_test.rb | |
| gem uninstall asherah | |
| " | |
| cross_language_tests: | |
| runs-on: ubuntu-latest | |
| name: cross-language-tests | |
| env: | |
| MYSQL_HOSTNAME: 127.0.0.1 | |
| MYSQL_DATABASE: testdb | |
| MYSQL_USERNAME: root | |
| MYSQL_PASSWORD: password | |
| services: | |
| mysql: | |
| image: mysql:8.0 | |
| env: | |
| MYSQL_DATABASE: ${{ env.MYSQL_DATABASE }} | |
| MYSQL_ROOT_PASSWORD: ${{ env.MYSQL_PASSWORD }} | |
| ports: | |
| - 3306:3306 | |
| options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 10 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: 3.2 | |
| bundler: default | |
| bundler-cache: true | |
| - name: Download binary for current platform | |
| run: | | |
| bundle exec rake download | |
| - name: Set up Go | |
| uses: actions/setup-go@v6.3.0 | |
| with: | |
| go-version: 1.24 | |
| - name: Test Cross-Language | |
| env: | |
| TEST_DB_NAME: ${{ env.MYSQL_DATABASE }} | |
| TEST_DB_PASSWORD: ${{ env.MYSQL_PASSWORD }} | |
| TEST_DB_HOSTNAME: ${{ env.MYSQL_HOSTNAME }} | |
| TEST_DB_USER: ${{ env.MYSQL_USERNAME }} | |
| TEST_DB_PORT: ${{ job.services.mysql.ports[3306] }} | |
| ASHERAH_SERVICE_NAME: service | |
| ASHERAH_PRODUCT_NAME: product | |
| ASHERAH_KMS_MODE: static | |
| CUCUMBER_PUBLISH_QUIET: true | |
| run: bin/cross-language-test.sh | |
| cross_language_tests_macos: | |
| runs-on: macos-latest | |
| name: cross-language-tests-macos | |
| env: | |
| MYSQL_HOSTNAME: 127.0.0.1 | |
| MYSQL_DATABASE: testdb | |
| MYSQL_USERNAME: root | |
| MYSQL_PASSWORD: password | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: 3.2 | |
| bundler: default | |
| bundler-cache: true | |
| - name: Install and start MySQL | |
| run: | | |
| brew install mysql | |
| brew services start mysql | |
| # Wait for MySQL to be ready | |
| for i in {1..30}; do | |
| if mysqladmin ping -h127.0.0.1 --silent 2>/dev/null; then | |
| echo "MySQL is up" | |
| break | |
| fi | |
| echo "Waiting for MySQL... ($i/30)" | |
| sleep 2 | |
| done | |
| # Set root password and create database | |
| mysql -u root -h 127.0.0.1 -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '${{ env.MYSQL_PASSWORD }}';" | |
| mysql -u root -h 127.0.0.1 -p${{ env.MYSQL_PASSWORD }} -e "CREATE DATABASE IF NOT EXISTS ${{ env.MYSQL_DATABASE }};" | |
| - name: Download binary for current platform | |
| run: | | |
| bundle exec rake download | |
| - name: Set up Go | |
| uses: actions/setup-go@v6.3.0 | |
| with: | |
| go-version: 1.24 | |
| - name: Test Cross-Language | |
| env: | |
| TEST_DB_NAME: ${{ env.MYSQL_DATABASE }} | |
| TEST_DB_PASSWORD: ${{ env.MYSQL_PASSWORD }} | |
| TEST_DB_HOSTNAME: ${{ env.MYSQL_HOSTNAME }} | |
| TEST_DB_USER: ${{ env.MYSQL_USERNAME }} | |
| TEST_DB_PORT: 3306 | |
| ASHERAH_SERVICE_NAME: service | |
| ASHERAH_PRODUCT_NAME: product | |
| ASHERAH_KMS_MODE: static | |
| CUCUMBER_PUBLISH_QUIET: true | |
| run: bin/cross-language-test.sh |