github.1485827954.workers.dev/newrelic/newrelic-client-go@v1.1.0/.github/workflows/test.yml (about)

     1  name: Testing
     2  
     3  on:
     4    push:
     5      branches: [main]
     6    pull_request:
     7      branches: [main]
     8  
     9  jobs:
    10    lint:
    11      runs-on: ubuntu-latest
    12      steps:
    13        - name: Install Go
    14          uses: actions/setup-go@v3
    15          with:
    16            go-version: 1.18.x
    17  
    18        - name: Add GOBIN to PATH
    19          run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
    20          shell: bash
    21  
    22        - name: Checkout code
    23          uses: actions/checkout@v3
    24          with:
    25            fetch-depth: 0
    26  
    27        - name: Cache deps
    28          uses: actions/cache@v3
    29          with:
    30            path: ~/go/pkg/mod
    31            key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
    32            restore-keys: |
    33              ${{ runner.os }}-go-
    34  
    35        - name: Lint
    36          run: make lint
    37  
    38    test-unit:
    39      runs-on: ubuntu-latest
    40      steps:
    41        - name: Install Go
    42          uses: actions/setup-go@v3
    43          with:
    44            go-version: 1.18.x
    45  
    46        - name: Add GOBIN to PATH
    47          run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
    48          shell: bash
    49  
    50        - name: Checkout code
    51          uses: actions/checkout@v3
    52  
    53        - name: Cache deps
    54          uses: actions/cache@v3
    55          with:
    56            path: ~/go/pkg/mod
    57            key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
    58            restore-keys: |
    59              ${{ runner.os }}-go-
    60  
    61        - name: Unit Tests
    62          run: make test-unit
    63  
    64        # - name: New Relic JUnit Reporter
    65        #   if: github.event.pull_request.head.repo.full_name == github.repository
    66        #   uses: newrelic/junit-reporter-action@v0.1.1
    67        #   with:
    68        #     accountId: ${{ secrets.NEW_RELIC_ACCOUNT_ID }}
    69        #     insertApiKey: ${{ secrets.NEW_RELIC_INSIGHTS_INSERT_KEY }}
    70        #     testOutputPath: coverage/unit.xml
    71  
    72    test-integration:
    73      runs-on: ubuntu-latest
    74      steps:
    75        - name: Install Go
    76          uses: actions/setup-go@v3
    77          with:
    78            go-version: 1.18.x
    79  
    80        - name: Add GOBIN to PATH
    81          run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
    82          shell: bash
    83  
    84        - name: Checkout code
    85          uses: actions/checkout@v3
    86  
    87        - name: Cache deps
    88          uses: actions/cache@v3
    89          with:
    90            path: ~/go/pkg/mod
    91            key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
    92            restore-keys: |
    93              ${{ runner.os }}-go-
    94  
    95        - name: Integration Tests
    96          if: github.event.pull_request.head.repo.full_name == github.repository
    97          run: make test-integration
    98          env:
    99            NEW_RELIC_ACCOUNT_ID: ${{ secrets.NEW_RELIC_ACCOUNT_ID }}
   100            NEW_RELIC_ADMIN_API_KEY: ${{ secrets.NEW_RELIC_ADMIN_API_KEY }}
   101            NEW_RELIC_API_KEY: ${{ secrets.NEW_RELIC_API_KEY }}
   102            NEW_RELIC_INSIGHTS_INSERT_KEY: ${{ secrets.NEW_RELIC_INSIGHTS_INSERT_KEY }}
   103            NEW_RELIC_LICENSE_KEY: ${{ secrets.NEW_RELIC_LICENSE_KEY }}
   104            NEW_RELIC_REGION: ${{ secrets.NEW_RELIC_REGION }}
   105            INTEGRATION_TESTING_AWS_ARN: ${{ secrets.INTEGRATION_TESTING_AWS_ARN }}
   106  
   107        # - name: New Relic JUnit Reporter
   108        #   if: github.event.pull_request.head.repo.full_name == github.repository
   109        #   uses: newrelic/junit-reporter-action@v0.1.1
   110        #   with:
   111        #     accountId: ${{ secrets.NEW_RELIC_ACCOUNT_ID }}
   112        #     insertApiKey: ${{ secrets.NEW_RELIC_INSIGHTS_INSERT_KEY }}
   113        #     testOutputPath: coverage/integration.xml