|
| 1 | +name: Go CI |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: [ "main" ] |
| 7 | + paths: |
| 8 | + - glide-core/** |
| 9 | + - submodules/** |
| 10 | + - go/** |
| 11 | + - .github/workflows/go.yml |
| 12 | + pull_request: |
| 13 | + paths: |
| 14 | + - glide-core/** |
| 15 | + - submodules/** |
| 16 | + - go/** |
| 17 | + - .github/workflows/go.yml |
| 18 | + |
| 19 | +# Run only the latest job on a branch and cancel previous ones |
| 20 | +concurrency: |
| 21 | + group: ${{ github.head_ref || github.ref }} |
| 22 | + cancel-in-progress: true |
| 23 | + |
| 24 | +jobs: |
| 25 | + build-and-test-go-client: |
| 26 | + timeout-minutes: 20 |
| 27 | + strategy: |
| 28 | + # Run all jobs |
| 29 | + fail-fast: false |
| 30 | + matrix: |
| 31 | + go: |
| 32 | + - '1.18' |
| 33 | + - '1.21' |
| 34 | + redis: |
| 35 | + - 6.2.14 |
| 36 | + - 7.2.3 |
| 37 | + os: |
| 38 | + - ubuntu-latest |
| 39 | + - macos-latest |
| 40 | + |
| 41 | + runs-on: ${{ matrix.os }} |
| 42 | + |
| 43 | + steps: |
| 44 | + - uses: actions/checkout@v4 |
| 45 | + with: |
| 46 | + submodules: recursive |
| 47 | + |
| 48 | + - name: Set up Go ${{ matrix.go }} |
| 49 | + uses: actions/setup-go@v5 |
| 50 | + with: |
| 51 | + go-version: ${{ matrix.go }} |
| 52 | + cache-dependency-path: go/go.sum |
| 53 | + |
| 54 | + - name: Install shared software dependencies |
| 55 | + uses: ./.github/workflows/install-shared-dependencies |
| 56 | + with: |
| 57 | + os: ${{ matrix.os }} |
| 58 | + target: ${{ matrix.os == 'ubuntu-latest' && 'x86_64-unknown-linux-gnu' || 'x86_64-apple-darwin' }} |
| 59 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 60 | + |
| 61 | + - name: Install redis |
| 62 | + # TODO: make this step macos compatible: https://github.com/aws/glide-for-redis/issues/781 |
| 63 | + if: ${{ matrix.os == 'ubuntu-latest' }} |
| 64 | + uses: ./.github/workflows/install-redis |
| 65 | + with: |
| 66 | + redis-version: ${{ matrix.redis }} |
| 67 | + |
| 68 | + - name: Install client dependencies |
| 69 | + working-directory: ./go |
| 70 | + run: make install-tools |
| 71 | + |
| 72 | + - name: Build client |
| 73 | + working-directory: ./go |
| 74 | + run: make build |
| 75 | + |
| 76 | + - name: Run linters |
| 77 | + working-directory: ./go |
| 78 | + run: make lint |
| 79 | + |
| 80 | + - name: Run unit tests |
| 81 | + working-directory: ./go |
| 82 | + run: make unit-test-report |
| 83 | + |
| 84 | + - name: Upload test reports |
| 85 | + if: always() |
| 86 | + continue-on-error: true |
| 87 | + uses: actions/upload-artifact@v4 |
| 88 | + with: |
| 89 | + name: test-reports-go-${{ matrix.go }}-redis-${{ matrix.redis }}-${{ matrix.os }} |
| 90 | + path: | |
| 91 | + go/reports/unit-test-report.html |
| 92 | +
|
| 93 | + build-amazonlinux-latest: |
| 94 | + if: github.repository_owner == 'aws' |
| 95 | + strategy: |
| 96 | + # Run all jobs |
| 97 | + fail-fast: false |
| 98 | + matrix: |
| 99 | + go: |
| 100 | + - 1.18.10 |
| 101 | + - 1.21.6 |
| 102 | + runs-on: ubuntu-latest |
| 103 | + container: amazonlinux:latest |
| 104 | + timeout-minutes: 15 |
| 105 | + steps: |
| 106 | + - name: Install git |
| 107 | + run: | |
| 108 | + yum -y remove git |
| 109 | + yum -y remove git-* |
| 110 | + yum -y install https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm |
| 111 | + yum update |
| 112 | + yum install -y git |
| 113 | + git --version |
| 114 | +
|
| 115 | + - uses: actions/checkout@v4 |
| 116 | + |
| 117 | + - name: Checkout submodules |
| 118 | + run: | |
| 119 | + git config --global --add safe.directory "$GITHUB_WORKSPACE" |
| 120 | + git submodule update --init --recursive |
| 121 | +
|
| 122 | + - name: Install shared software dependencies |
| 123 | + uses: ./.github/workflows/install-shared-dependencies |
| 124 | + with: |
| 125 | + os: "amazon-linux" |
| 126 | + target: "x86_64-unknown-linux-gnu" |
| 127 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 128 | + |
| 129 | + - name: Create a symbolic Link for redis6 binaries |
| 130 | + run: | |
| 131 | + ln -s /usr/bin/redis6-server /usr/bin/redis-server |
| 132 | + ln -s /usr/bin/redis6-cli /usr/bin/redis-cli |
| 133 | +
|
| 134 | + - name: Install Go |
| 135 | + run: | |
| 136 | + yum -y install wget |
| 137 | + yum -y install tar |
| 138 | + wget https://go.dev/dl/go${{ matrix.go }}.linux-amd64.tar.gz |
| 139 | + tar -C /usr/local -xzf go${{ matrix.go }}.linux-amd64.tar.gz |
| 140 | + echo "/usr/local/go/bin" >> $GITHUB_PATH |
| 141 | + echo "$HOME/go/bin" >> $GITHUB_PATH |
| 142 | +
|
| 143 | + - name: Install client dependencies |
| 144 | + working-directory: ./go |
| 145 | + run: make install-tools |
| 146 | + |
| 147 | + - name: Build client |
| 148 | + working-directory: ./go |
| 149 | + run: make build |
| 150 | + |
| 151 | + - name: Run linters |
| 152 | + working-directory: ./go |
| 153 | + run: make lint |
| 154 | + |
| 155 | + - name: Run unit tests |
| 156 | + working-directory: ./go |
| 157 | + run: make unit-test-report |
| 158 | + |
| 159 | + - name: Upload test reports |
| 160 | + if: always() |
| 161 | + continue-on-error: true |
| 162 | + uses: actions/upload-artifact@v4 |
| 163 | + with: |
| 164 | + name: test-reports-go-${{ matrix.go }}-amazon-linux-latest |
| 165 | + path: go/reports/unit-test-report.html |
| 166 | + |
| 167 | + lint-rust: |
| 168 | + timeout-minutes: 15 |
| 169 | + runs-on: ubuntu-latest |
| 170 | + steps: |
| 171 | + - uses: actions/checkout@v4 |
| 172 | + with: |
| 173 | + submodules: recursive |
| 174 | + |
| 175 | + - uses: ./.github/workflows/lint-rust |
| 176 | + with: |
| 177 | + cargo-toml-folder: ./go |
| 178 | + name: lint go rust |
0 commit comments