feat(datasource-pylon): Pylon datasource for the Ruby agent (EXT-4) #1858
Workflow file for this run
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: Lint, Test, Coverage and Deploy | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - beta | |
| pull_request: | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| env: | |
| BUNDLE_PATH: /tmp/bundle | |
| strategy: | |
| matrix: | |
| ruby-version: ["3.4", "4.0"] | |
| packages: | |
| - forest_admin_agent | |
| - forest_admin_datasource_active_record | |
| - forest_admin_datasource_customizer | |
| - forest_admin_datasource_toolkit | |
| - forest_admin_test_toolkit | |
| - forest_admin_rails | |
| - forest_admin_datasource_mongoid | |
| - forest_admin_rpc_agent | |
| - forest_admin_datasource_rpc | |
| - forest_admin_datasource_zendesk | |
| - forest_admin_datasource_snowflake | |
| - forest_admin_datasource_mambu_payments | |
| - forest_admin_datasource_graphql_hasura | |
| - forest_admin_datasource_pylon | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # The Azure mirror the runner image points at stalls intermittently, and apt's | |
| # own Acquire timeouts bound a single connection, not a whole fetch. | |
| - name: Install unixODBC headers for ruby-odbc | |
| if: ${{ matrix.packages == 'forest_admin_datasource_snowflake' }} | |
| timeout-minutes: 8 | |
| run: | | |
| sudo timeout -k 30 90 apt-get update -o Acquire::Retries=1 -o Acquire::http::Timeout=10 || | |
| echo 'apt-get update incomplete; continuing with the lists on the image' | |
| sudo DEBIAN_FRONTEND=noninteractive timeout -k 30 240 apt-get install -y \ | |
| --no-install-recommends -o Acquire::Retries=1 -o Acquire::http::Timeout=10 unixodbc-dev | |
| - name: Set up Ruby ${{ matrix.ruby-version }} | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby-version }} | |
| - name: Install dependencies on main repo | |
| run: bundle install | |
| - name: Install dependencies on packages | |
| run: cd packages/${{ matrix.packages }} && bundle install && cd - | |
| - name: Run RuboCop | |
| run: bundle exec rubocop | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| needs: [lint] | |
| env: | |
| BUNDLE_PATH: /tmp/bundle | |
| strategy: | |
| matrix: | |
| ruby-version: ["3.4", "4.0"] | |
| packages: | |
| - forest_admin_agent | |
| - forest_admin_datasource_active_record | |
| - forest_admin_datasource_customizer | |
| - forest_admin_datasource_toolkit | |
| - forest_admin_rails | |
| - forest_admin_datasource_mongoid | |
| - forest_admin_rpc_agent | |
| - forest_admin_datasource_rpc | |
| - forest_admin_datasource_zendesk | |
| - forest_admin_datasource_snowflake | |
| - forest_admin_datasource_mambu_payments | |
| - forest_admin_datasource_graphql_hasura | |
| - forest_admin_datasource_pylon | |
| services: | |
| mongodb: | |
| image: mongo:latest | |
| ports: | |
| - 27017:27017 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # The Azure mirror the runner image points at stalls intermittently, and apt's | |
| # own Acquire timeouts bound a single connection, not a whole fetch. | |
| - name: Install unixODBC headers for ruby-odbc | |
| if: ${{ matrix.packages == 'forest_admin_datasource_snowflake' }} | |
| timeout-minutes: 8 | |
| run: | | |
| sudo timeout -k 30 90 apt-get update -o Acquire::Retries=1 -o Acquire::http::Timeout=10 || | |
| echo 'apt-get update incomplete; continuing with the lists on the image' | |
| sudo DEBIAN_FRONTEND=noninteractive timeout -k 30 240 apt-get install -y \ | |
| --no-install-recommends -o Acquire::Retries=1 -o Acquire::http::Timeout=10 unixodbc-dev | |
| - name: Set up Ruby ${{ matrix.ruby-version }} | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby-version }} | |
| - name: Install dependencies on main repo | |
| run: bundle install | |
| - name: Wait for MongoDB | |
| if: ${{ matrix.packages == 'forest_admin_datasource_mongoid' }} | |
| run: | | |
| for i in {1..30}; do | |
| nc -z localhost 27017 && echo "MongoDB is up" && exit 0 | |
| echo "Waiting for MongoDB..." | |
| sleep 1 | |
| done | |
| exit 1 | |
| - name: Test | |
| run: | | |
| cd packages/${{ matrix.packages }} && \ | |
| BUNDLE_GEMFILE=Gemfile-test bundle install && \ | |
| BUNDLE_GEMFILE=Gemfile-test bundle exec rspec --color --format doc && \ | |
| cd - | |
| - name: Upload coverage | |
| if: ${{ matrix.ruby-version == '4.0' }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.ruby-version }}-${{ matrix.packages }} | |
| path: packages/${{ matrix.packages }}/coverage/* | |
| retention-days: 1 | |
| coverage: | |
| name: Send Coverage | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| needs: [test] | |
| strategy: | |
| matrix: | |
| # Must match the ruby-version the test job uploads artifacts for | |
| # (the `if` on its "Upload coverage" step), or every file path below | |
| # resolves to nothing and qlty silently sends zero coverage. | |
| ruby-version: ["4.0"] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download coverage reports | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: reports | |
| - name: Send coverage | |
| uses: qltysh/qlty-action/coverage@8d5c844f32f80364ccc135534671640466e7f610 #v1.1 | |
| with: | |
| verbose: true | |
| oidc: true | |
| files: ${{ github.workspace }}/reports/${{ matrix.ruby-version }}-forest_admin_agent/coverage.json,${{ github.workspace }}/reports/${{ matrix.ruby-version }}-forest_admin_datasource_active_record/coverage.json,${{ github.workspace }}/reports/${{ matrix.ruby-version }}-forest_admin_datasource_customizer/coverage.json,${{ github.workspace }}/reports/${{ matrix.ruby-version }}-forest_admin_datasource_toolkit/coverage.json,${{ github.workspace }}/reports/${{ matrix.ruby-version }}-forest_admin_rails/coverage.json,${{ github.workspace }}/reports/${{ matrix.ruby-version }}-forest_admin_datasource_mongoid/coverage.json,${{ github.workspace }}/reports/${{ matrix.ruby-version }}-forest_admin_rpc_agent/coverage.json,${{ github.workspace }}/reports/${{ matrix.ruby-version }}-forest_admin_datasource_rpc/coverage.json,${{ github.workspace }}/reports/${{ matrix.ruby-version }}-forest_admin_datasource_zendesk/coverage.json,${{ github.workspace }}/reports/${{ matrix.ruby-version }}-forest_admin_datasource_snowflake/coverage.json,${{ github.workspace }}/reports/${{ matrix.ruby-version }}-forest_admin_datasource_mambu_payments/coverage.json,${{ github.workspace }}/reports/${{ matrix.ruby-version }}-forest_admin_datasource_graphql_hasura/coverage.json,${{ github.workspace }}/reports/${{ matrix.ruby-version }}-forest_admin_datasource_pylon/coverage.json | |
| deploy: | |
| name: Release package | |
| runs-on: ubuntu-latest | |
| needs: [coverage] | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta') | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false # GITHUB_TOKEN must not be set for the semantic release | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22.14.0 | |
| - uses: actions/cache@v4 | |
| with: | |
| path: "**/node_modules" | |
| key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | |
| - name: Install semantic release dependencies | |
| run: yarn | |
| - name: Setup credentials | |
| run: | | |
| mkdir -p $HOME/.gem | |
| touch $HOME/.gem/credentials | |
| chmod 0600 $HOME/.gem/credentials | |
| printf -- "---\n:rubygems_api_key: ${{secrets.GEM_HOST_API_KEY}}\n" > $HOME/.gem/credentials | |
| - name: Semantic Release | |
| uses: cycjimmy/semantic-release-action@v4 | |
| id: semantic | |
| env: | |
| GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }} | |
| GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
| GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }} | |
| GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }} | |
| GIT_COMMITTER_EMAIL: ${{ secrets.GIT_COMMITTER_EMAIL }} | |
| GIT_COMMITTER_NAME: ${{ secrets.GIT_COMMITTER_NAME }} | |
| SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} |