cyberark/secretless-broker

View on GitHub
.github/workflows/ci.yml

Summary

Maintainability
Test Coverage
name: CI

on:
  # Run once daily at 12 AM UTC, 8 PM EST
  schedule:
    - cron: '0 0 * * *'

  # Run this on pushes to any branch
  push:

jobs:
  unit_test:
    name: Unit Tests
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: recursive
      - uses: actions/setup-go@v3
        with:
          go-version: '~1.21.0'
      - name: Generate Version
        run: grep -m 1 -P "## \[\d+\.\d+\.\d+\] -" CHANGELOG.md | grep -o -P "\d+\.\d+\.\d+" > VERSION
      - name: go mod tidy
        run: ./bin/go_mod_tidy
      - name: Unit tests
        run: ./bin/test_unit

  build_and_test:
    name: Build and Functional Tests on Linux
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: recursive
      - uses: actions/setup-go@v3
        with:
          go-version: '~1.21.0'
      - name: Generate Version
        run: grep -m 1 -P "## \[\d+\.\d+\.\d+\] -" CHANGELOG.md | grep -o -P "\d+\.\d+\.\d+" > VERSION
      - name: go mod tidy
        run: ./bin/go_mod_tidy
      - name: Build
        run: ./bin/build
      - name: Integration tests
        run: ./bin/test

  osx_test:
    name: Functional Tests on macOS
    runs-on: macOS-latest
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: recursive
      # Cache go module dependencies based on go.sum to improve workflow execution time.
      - uses: actions/cache@v2
        with:
          path: ~/go/pkg/mod
          key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
          restore-keys: |
            ${{ runner.os }}-go-
      # Install go1.21
      - uses: actions/setup-go@v3
        with:
          go-version: '~1.21.0'
      # Get go version
      - run: go version
      # Download go modules
      - run: go mod download
      - run: go mod tidy -compat=$(grep -E "^go\s\d+\.\d+" go.mod | grep -oE "\d+\.\d+")
      # Run keychain tests
      - run: cd test/providers/keychain && ./start && ./test && ./stop