|
| 1 | +name: Ruby CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "main" ] |
| 6 | + pull_request: |
| 7 | + branches: [ "main" ] |
| 8 | + schedule: |
| 9 | + - cron: '10 0 * * *' |
| 10 | + |
| 11 | +env: |
| 12 | + SECRET_DETECTION_JSON_REPORT_FILE: "gitleaks.json" |
| 13 | + |
| 14 | +jobs: |
| 15 | + package: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + ruby_version: ['2.7', '3.2', '3.3'] |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v4 |
| 22 | + - name: Set up Ruby |
| 23 | + uses: ruby/setup-ruby@v1 |
| 24 | + with: |
| 25 | + ruby-version: {{ matrix.ruby_version }} |
| 26 | + bundler-cache: true |
| 27 | + - name: Build package |
| 28 | + run: bundle exec rake build |
| 29 | + - name: Upload Artifacts |
| 30 | + uses: actions/upload-artifact@v4 |
| 31 | + with: |
| 32 | + name: pkg |
| 33 | + path: pkg/ |
| 34 | + |
| 35 | + package: |
| 36 | + runs-on: ubuntu-latest |
| 37 | + strategy: |
| 38 | + matrix: |
| 39 | + ruby_version: ['2.7', '3.2', '3.3'] |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v4 |
| 42 | + - name: Set up Ruby |
| 43 | + uses: ruby/setup-ruby@v1 |
| 44 | + with: |
| 45 | + ruby-version: {{ matrix.ruby_version }} |
| 46 | + bundler-cache: true |
| 47 | + - name: Run rubocop |
| 48 | + run: bundle exec rubocop |
| 49 | + |
| 50 | + secret_detection: |
| 51 | + runs-on: ubuntu-latest |
| 52 | + steps: |
| 53 | + - name: Checkout |
| 54 | + uses: actions/checkout@v4 |
| 55 | + with: |
| 56 | + fetch-depth: 0 |
| 57 | + - name: Install and run secret detection |
| 58 | + run: | |
| 59 | + wget https://github.com/gitleaks/gitleaks/releases/download/v8.18.4/gitleaks_8.18.4_linux_x64.tar.gz |
| 60 | + tar -xzf gitleaks_8.18.4_linux_x64.tar.gz |
| 61 | + EXITCODE=0 |
| 62 | + ./gitleaks detect -r ${SECRET_DETECTION_JSON_REPORT_FILE} --source . --log-opts="--all --full-history" || EXITCODE=$? |
| 63 | + if [[ $EXITCODE -ne 0 ]]; then |
| 64 | + exit $EXITCODE |
| 65 | + fi |
| 66 | + - name: Upload secret detection artifact |
| 67 | + uses: actions/upload-artifact@v4 |
| 68 | + with: |
| 69 | + name: secret-detection-results |
| 70 | + path: gitleaks.json |
| 71 | + |
| 72 | + license_check: |
| 73 | + runs-on: ubuntu-latest |
| 74 | + steps: |
| 75 | + - name: Checkout |
| 76 | + uses: actions/checkout@v4 |
| 77 | + - name: Run license check |
| 78 | + run: | |
| 79 | + ./license_checker.sh '*.rb' | tee license_check_output.txt |
| 80 | + '[ ! -s license_check_output.txt ]' |
| 81 | +
|
| 82 | +
|
| 83 | +# Test and gem publishing stage are disabled/missing for now. Code needs to be tested |
| 84 | + |
| 85 | +####################################################### |
| 86 | +# test: |
| 87 | +# runs-on: ubuntu-latest |
| 88 | +# strategy: |
| 89 | +# matrix: |
| 90 | +# include: |
| 91 | +# - ruby_version: '2.7' |
| 92 | +# use_mock_server: '' |
| 93 | +# - ruby_version: '3.2' |
| 94 | +# use_mock_server: '' |
| 95 | +# - ruby_version: '3.3' |
| 96 | +# use_mock_server: '' |
| 97 | +# - ruby_version: '2.7' |
| 98 | +# use_mock_server: 'use mock server' |
| 99 | +# - ruby_version: '3.2' |
| 100 | +# use_mock_server: 'use mock server' |
| 101 | +# - ruby_version: '3.3' |
| 102 | +# use_mock_server: 'use mock server' |
| 103 | +# steps: |
| 104 | +# - uses: actions/checkout@v4 |
| 105 | +# - name: Set up Ruby |
| 106 | +# uses: ruby/setup-ruby@v1 |
| 107 | +# with: |
| 108 | +# ruby-version: {{ matrix.ruby_version }} |
| 109 | +# bundler-cache: true |
| 110 | +# - name: Configure Mock Server |
| 111 | +# if: matrix.use_mock_server != '' |
| 112 | +# run: | |
| 113 | +# echo "Using mock server" |
| 114 | +# export DEEPL_SERVER_URL=http://deepl-mock:3000 |
| 115 | +# export DEEPL_MOCK_SERVER_PORT=3000 |
| 116 | +# export DEEPL_PROXY_URL=http://deepl-mock:3001 |
| 117 | +# export DEEPL_MOCK_PROXY_SERVER_PORT=3001 |
| 118 | +# - name: Run Tests |
| 119 | +# run: bundle exec rake test |
| 120 | +# - name: Run RSpec Tests |
| 121 | +# run: bundle exec rspec --format RspecJunitFormatter --out rspec.xml |
| 122 | +# - name: Upload Test Results |
| 123 | +# uses: actions/upload-artifact@v4 |
| 124 | +# with: |
| 125 | +# name: test-results |
| 126 | +# path: rspec.xml |
0 commit comments