KCLruby AWS credentials role change and dependabot auto-merge fix #27
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
| # This workflow uses actions that are not certified by GitHub. | |
| # They are provided by a third-party and are governed by | |
| # separate terms of service, privacy policy, and support | |
| # documentation. | |
| # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake | |
| # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby | |
| name: Sample Run and Dependabot Auto-merge | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request_target: | |
| branches: [ master ] | |
| workflow_dispatch: | |
| permissions: | |
| id-token: write | |
| contents: write | |
| pull-requests: write | |
| statuses: write | |
| jobs: | |
| sample-run: | |
| timeout-minutes: 8 | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| shell: bash | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| ruby-version: [ '3.0', '3.4' ] | |
| jdk-version: [ "8", "11", "17", "21", "24" ] | |
| os: [ ubuntu-latest, macOS-latest, windows-latest ] | |
| steps: | |
| - name: Checkout working directory | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Configure AWS Credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| aws-region: us-east-1 | |
| role-to-assume: arn:aws:iam::751999266872:role/GitHubRuby | |
| role-session-name: myGitHubActionsRuby | |
| - name: Set up JDK ${{ matrix.jdk-version }} | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: ${{ matrix.jdk-version }} | |
| distribution: 'corretto' | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby-version }} | |
| - name: Install Bundler and run tests | |
| run: | | |
| gem install bundler | |
| bundle install | |
| bundle update --bundler | |
| bundle exec rspec | |
| - name: Install Rake (ubuntu and macOS) | |
| if: ${{ matrix.os != 'windows-latest' }} | |
| run: | | |
| gem install rake | |
| - name: Install Kinesis SDK | |
| run: | | |
| gem install aws-sdk-kinesis | |
| - name: Running KCL producer | |
| run: | | |
| cd samples | |
| rake "run_producer[10]" | |
| - name: Running KCL consumer (windows or ubuntu) | |
| if: ${{ matrix.os != 'macOS-latest'}} | |
| run: | | |
| cd samples | |
| timeout 45 rake run properties_file=sample.properties || status="$?"; if (( status == 124 )); then exit 0; else exit 1; fi; exit "$status" | |
| - name: Running KCL consumer (macOS) | |
| if: ${{ matrix.os == 'macOS-latest'}} | |
| run: | | |
| brew install coreutils | |
| cd samples | |
| gtimeout 45 rake run properties_file=sample.properties || status="$?"; if (( status == 124 )); then exit 0; else exit 1; fi; exit "$status" | |
| auto-merge-dependabot: | |
| needs: [sample-run] | |
| runs-on: ubuntu-latest | |
| if: github.actor == 'dependabot[bot]' && github.event.pull_request.user.login == 'dependabot[bot]' | |
| steps: | |
| - name: Fetch Dependabot metadata | |
| id: metadata | |
| uses: dependabot/fetch-metadata@v2 | |
| with: | |
| alert-lookup: true | |
| github-token: "${{ secrets.GITHUB_TOKEN }}" | |
| - name: Approve PR | |
| if: steps.metadata.outputs.update-type != 'version-update:semver-major' | |
| run: gh pr review --approve "$PR_URL" | |
| env: | |
| PR_URL: ${{github.event.pull_request.html_url}} | |
| GH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
| - name: Enable auto-merge for Dependabot PRs | |
| if: steps.metadata.outputs.update-type != 'version-update:semver-major' | |
| run: gh pr merge --auto --merge "$PR_URL" | |
| env: | |
| PR_URL: ${{github.event.pull_request.html_url}} | |
| GH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |