|
1 |
| -name: Test on all Linux |
| 1 | +# Copyright (c) 2021 SolarWinds, LLC. |
| 2 | +# All rights reserved. |
| 3 | + |
| 4 | +name: Run Ruby Tests on 4 Linux |
2 | 5 |
|
3 | 6 | on:
|
4 | 7 | push:
|
5 |
| - # Allows you to run this workflow manually from the Actions tab |
| 8 | + paths-ignore: |
| 9 | + - 'test/run_tests/Dockerfile_*' |
| 10 | +# Allows you to run this workflow manually from the Actions tab |
6 | 11 | workflow_dispatch:
|
7 | 12 |
|
| 13 | +env: |
| 14 | + GHRC: ghcr.io/appoptics/appoptics-apm-ruby/apm_ruby |
| 15 | + DOCKERFILE: test/run_tests/Dockerfile |
| 16 | + |
8 | 17 | jobs:
|
9 | 18 |
|
| 19 | +#------------------------------------------------------------------------------- |
| 20 | +# TODO: figure out how to build images first if necessary |
| 21 | +# |
| 22 | +# ********* this is not working because we don't have a ************* |
| 23 | +# ********* reference to the commit of the previous GH run ************* |
| 24 | +# |
| 25 | +# build_images: |
| 26 | +# name: Build docker images if necessary |
| 27 | +# runs-on: ubuntu-latest |
| 28 | +# |
| 29 | +# strategy: |
| 30 | +# fail-fast: true |
| 31 | +# matrix: |
| 32 | +# os: [ ubuntu, debian, centos, alpine ] |
| 33 | +# |
| 34 | +# steps: |
| 35 | +# - name: Checkout |
| 36 | +# uses: actions/checkout@v2 |
| 37 | +# |
| 38 | +# |
| 39 | +# ## comment out to get a debug session |
| 40 | +# ## only works with ubuntu and debian, because it uses apt: |
| 41 | +## - name: tmate debugging session |
| 42 | +## uses: mxschmitt/action-tmate@v3 |
| 43 | +## with: |
| 44 | +## sudo: false |
| 45 | +# |
| 46 | +# - name: check modified files |
| 47 | +# id: check_files |
| 48 | +# run: | |
| 49 | +# git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep Dockerfile_ |
| 50 | +# echo ::set-output name=check_dockerfiles::$? |
| 51 | +## git diff --name-only HEAD^ HEAD | grep [D]ockerfile_ |
| 52 | +## echo ::set-output name=check_dockerfiles::$? |
| 53 | +# |
| 54 | +# - name: ghcr.io login ... build and publish images if needed |
| 55 | +# uses: docker/login-action@v1 |
| 56 | +# if: ${{ steps.check_files.outputs.check_dockerfiles == 0}} |
| 57 | +# with: |
| 58 | +# registry: ghcr.io |
| 59 | +# username: ${{ github.actor }} |
| 60 | +# password: ${{ secrets.GITHUB_TOKEN }} |
| 61 | +# |
| 62 | +# - name: Build and publish new Docker image |
| 63 | +# if: ${{ steps.check_files.outputs.check_dockerfiles == 0 }} |
| 64 | +# run: | |
| 65 | +# docker build -f ${{ env.DOCKERFILE }}_${{ matrix.os }} -t ${{ env.GHRC }}_${{ matrix.os }} . |
| 66 | +# docker push ${{ env.GHRC }}_${{ matrix.os }} |
| 67 | + |
| 68 | +#------------------------------------------------------------------------------- |
10 | 69 | all_linux_test:
|
11 |
| - name: Test on all Linux |
| 70 | + name: ${{ matrix.os }} - ruby ${{ matrix.ruby }} |
12 | 71 | runs-on: ubuntu-latest
|
| 72 | +# needs: build_images |
13 | 73 |
|
14 | 74 | strategy:
|
15 | 75 | fail-fast: false
|
16 | 76 | matrix:
|
17 | 77 | os: [ubuntu, debian, centos, alpine]
|
| 78 | + ruby: ['3.0', '2.7', '2.6', '2.5', '2.4'] |
18 | 79 |
|
19 | 80 | container:
|
20 |
| - image: ghcr.io/appoptics/appoptics-apm-ruby/ao_${{ matrix.os }} |
| 81 | +# maybe github.repository works |
| 82 | + image: ghcr.io/${{ github.repository }}/apm_ruby_${{ matrix.os }} |
| 83 | + |
| 84 | + env: |
| 85 | + APPOPTICS_GEM_TEST: true |
| 86 | + APPOPTICS_REPORTER: file |
| 87 | + APPOPTICS_COLLECTOR: /tmp/appoptics_traces.bson |
| 88 | + APPOPTICS_MONGO_SERVER: "mongo" |
| 89 | + APPOPTICS_RABBITMQ_SERVER: "rabbitmq" |
| 90 | + APPOPTICS_MEMCACHED_SERVER: "memcached" |
| 91 | + APPOPTICS_REPORTER_FILE_SINGLE: false |
| 92 | + APPOPTICS_FROM_S3: true |
| 93 | + MYSQL_ALLOW_EMPTY_PASSWORD: "yes" |
| 94 | + MYSQL_ROOT_PASSWORD: "admin" |
| 95 | + MYSQL_HOST: "mysql" |
| 96 | + MYSQL_DATABASE: "travis_ci_test" |
| 97 | + POSTGRES_DB: "travis_ci_test" |
| 98 | + DOCKER_MYSQL_PASS: "admin" |
| 99 | + DOCKER_PSQL_PASS: "postgres" |
| 100 | + POSTGRES_USER: "postgres" |
| 101 | + POSTGRES_PASSWORD: "postgres" |
| 102 | + POSTGRES_HOST: "postgres" |
| 103 | + REDIS_PASSWORD: "redis_pass" |
| 104 | + TEST_RUNS_TO_FILE: "true" |
| 105 | + |
| 106 | + services: |
| 107 | + memcached: |
| 108 | + image: memcached:latest |
| 109 | + ports: |
| 110 | + - 11211:11211 |
| 111 | + options: --health-cmd "timeout 5 bash -c 'cat < /dev/null > /dev/udp/127.0.0.1/11211'" --health-interval 10s --health-timeout 5s --health-retries 5 |
| 112 | + rabbitmq: |
| 113 | + image: rabbitmq:latest |
| 114 | + ports: |
| 115 | + - 5672:5672 |
| 116 | + options: --health-cmd "rabbitmqctl node_health_check" --health-interval 10s --health-timeout 5s --health-retries 5 |
| 117 | + mongo: |
| 118 | + image: mongo:latest |
| 119 | + ports: |
| 120 | + - 27017:27017 |
| 121 | + options: "--health-cmd \"mongo --quiet --eval 'quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)'\" --health-interval 10s --health-timeout 5s --health-retries 5" |
| 122 | + postgres: |
| 123 | + image: postgres:10.8 |
| 124 | + env: |
| 125 | + POSTGRES_DB: travis_ci_test |
| 126 | + ports: |
| 127 | + - 5432:5432 |
| 128 | + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 |
| 129 | + mysql: |
| 130 | + image: mariadb:latest |
| 131 | + env: |
| 132 | + MYSQL_USER: user |
| 133 | + MYSQL_PASSWORD: password |
| 134 | + MYSQL_DATABASE: travis_ci_test |
| 135 | + MYSQL_ROOT_PASSWORD: admin |
| 136 | + ports: |
| 137 | + - 3306:3306 |
| 138 | + options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3 |
21 | 139 |
|
22 | 140 | steps:
|
23 |
| - - name: Checkout |
24 |
| - uses: actions/checkout@v1 |
| 141 | + - name: Checkout ${{ github.ref }} |
| 142 | + uses: actions/checkout@v2 |
| 143 | + |
| 144 | + - name: print some info |
| 145 | + run: | |
| 146 | + user=`whoami` |
| 147 | + pwd=`pwd` |
| 148 | + echo "User: $user" |
| 149 | + echo "Current dir: $pwd" |
| 150 | + echo "Home dir: $HOME" |
| 151 | + echo "Branch: ${GITHUB_REF#refs/*/}" |
25 | 152 |
|
26 |
| - - name: just a shell command |
27 |
| - run: echo "I am fine!" |
| 153 | + - name: ruby tests |
| 154 | + run: | |
| 155 | + export HOME=/root |
| 156 | + test/run_tests/ruby_setup.sh |
| 157 | + version=`rbenv versions --bare | grep ${{ matrix.ruby }}` |
| 158 | + echo "testing with ruby version: $version" |
| 159 | + test/run_tests/run_tests.sh -r $version |
0 commit comments