|
| 1 | +name: Go |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: {} |
| 5 | + pull_request: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + |
| 9 | +env: |
| 10 | + # Common versions |
| 11 | + GO_VERSION: '1.20' |
| 12 | + GO_REQUIRED_MIN_VERSION: '' |
| 13 | + GOPATH: '/home/runner/work/cluster-permission/cluster-permission/go' |
| 14 | +defaults: |
| 15 | + run: |
| 16 | + working-directory: go/src/github.com/open-cluster-management/cluster-permission |
| 17 | + |
| 18 | +jobs: |
| 19 | + build: |
| 20 | + name: build |
| 21 | + runs-on: ubuntu-latest |
| 22 | + steps: |
| 23 | + - name: checkout code |
| 24 | + uses: actions/checkout@v3 |
| 25 | + with: |
| 26 | + fetch-depth: 1 |
| 27 | + path: go/src/github.com/open-cluster-management/cluster-permission |
| 28 | + - name: install Go |
| 29 | + uses: actions/setup-go@v3 |
| 30 | + with: |
| 31 | + go-version: ${{ env.GO_VERSION }} |
| 32 | + - name: build |
| 33 | + run: make build |
| 34 | + |
| 35 | + images: |
| 36 | + name: images |
| 37 | + runs-on: ubuntu-latest |
| 38 | + steps: |
| 39 | + - name: checkout code |
| 40 | + uses: actions/checkout@v3 |
| 41 | + with: |
| 42 | + fetch-depth: 1 |
| 43 | + path: go/src/github.com/open-cluster-management/cluster-permission |
| 44 | + - name: install Go |
| 45 | + uses: actions/setup-go@v3 |
| 46 | + with: |
| 47 | + go-version: ${{ env.GO_VERSION }} |
| 48 | + - name: install imagebuilder |
| 49 | + run: go install github.com/openshift/imagebuilder/cmd/imagebuilder@v1.2.3 |
| 50 | + - name: images |
| 51 | + run: make docker-build |
| 52 | + |
| 53 | + test: |
| 54 | + name: test |
| 55 | + runs-on: ubuntu-latest |
| 56 | + steps: |
| 57 | + - name: checkout code |
| 58 | + uses: actions/checkout@v3 |
| 59 | + with: |
| 60 | + fetch-depth: 1 |
| 61 | + path: go/src/github.com/open-cluster-management/cluster-permission |
| 62 | + - name: install Go |
| 63 | + uses: actions/setup-go@v3 |
| 64 | + with: |
| 65 | + go-version: ${{ env.GO_VERSION }} |
| 66 | + - name: test |
| 67 | + run: make test |
| 68 | + |
| 69 | + e2e: |
| 70 | + name: e2e |
| 71 | + runs-on: ubuntu-latest |
| 72 | + steps: |
| 73 | + - name: checkout code |
| 74 | + uses: actions/checkout@v3 |
| 75 | + with: |
| 76 | + fetch-depth: 1 |
| 77 | + path: go/src/github.com/open-cluster-management/cluster-permission |
| 78 | + - name: install Go |
| 79 | + uses: actions/setup-go@v3 |
| 80 | + with: |
| 81 | + go-version: ${{ env.GO_VERSION }} |
| 82 | + - name: install imagebuilder |
| 83 | + run: go install github.com/openshift/imagebuilder/cmd/imagebuilder@v1.2.3 |
| 84 | + - name: images |
| 85 | + run: make docker-build |
| 86 | + - name: setup kind |
| 87 | + uses: engineerd/setup-kind@v0.5.0 |
| 88 | + with: |
| 89 | + version: v0.14.0 |
| 90 | + name: cluster1 |
| 91 | + - name: setup kind |
| 92 | + uses: engineerd/setup-kind@v0.5.0 |
| 93 | + with: |
| 94 | + version: v0.14.0 |
| 95 | + name: hub |
| 96 | + - name: Load image on the nodes of the cluster |
| 97 | + run: | |
| 98 | + kind load docker-image --name=hub quay.io/open-cluster-management/cluster-permission:latest |
| 99 | + - name: Run e2e test |
| 100 | + run: | |
| 101 | + make test-e2e |
| 102 | + env: |
| 103 | + KUBECONFIG: /home/runner/.kube/config |
0 commit comments