|
| 1 | +name: |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - 'master' |
| 6 | + tags: |
| 7 | + - 'v*' |
| 8 | + pull_request: |
| 9 | + branches: |
| 10 | + - 'master' |
| 11 | + |
| 12 | +jobs: |
| 13 | + golangci: |
| 14 | + name: golangci-lint |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v2 |
| 18 | + - name: golangci-lint |
| 19 | + uses: golangci/golangci-lint-action@v1 |
| 20 | + with: |
| 21 | + # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. |
| 22 | + version: v1.29 |
| 23 | + |
| 24 | + # Optional: working directory, useful for monorepos |
| 25 | + # working-directory: somedir |
| 26 | + |
| 27 | + # Optional: golangci-lint command line arguments. |
| 28 | + # args: --issues-exit-code=0 |
| 29 | + |
| 30 | + # Optional: show only new issues if it's a pull request. The default value is `false`. |
| 31 | + # only-new-issues: true |
| 32 | + server-tests: |
| 33 | + needs: [tests-ui, golangci, build-backend, build-ui] |
| 34 | + name: Server tests |
| 35 | + runs-on: ubuntu-latest |
| 36 | + steps: |
| 37 | + - name: Check out code |
| 38 | + uses: actions/checkout@master |
| 39 | + with: |
| 40 | + fetch-depth: 1 |
| 41 | + - name: Setup Go |
| 42 | + uses: actions/setup-go@v1 |
| 43 | + with: |
| 44 | + go-version: ${{ secrets.GO_VERSION }} |
| 45 | + - name: Setup Cache |
| 46 | + uses: actions/cache@v1 |
| 47 | + with: |
| 48 | + path: ~/go/pkg/mod |
| 49 | + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} |
| 50 | + restore-keys: | |
| 51 | + ${{ runner.os }}-go- |
| 52 | + - run: GOPROXY=direct GOSUMDB=off GO111MODULE=on go test -tags draft ./... |
| 53 | + build-backend: |
| 54 | + name: Backend build |
| 55 | + runs-on: ubuntu-latest |
| 56 | + steps: |
| 57 | + - name: Check out code |
| 58 | + uses: actions/checkout@master |
| 59 | + with: |
| 60 | + fetch-depth: 1 |
| 61 | + - name: Setup Go |
| 62 | + uses: actions/setup-go@v1 |
| 63 | + with: |
| 64 | + go-version: ${{ secrets.GO_VERSION }} |
| 65 | + - name: Setup Cache |
| 66 | + uses: actions/cache@v1 |
| 67 | + with: |
| 68 | + path: ~/go/pkg/mod |
| 69 | + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} |
| 70 | + restore-keys: | |
| 71 | + ${{ runner.os }}-go- |
| 72 | + - run: GOPROXY=direct GOSUMDB=off GO111MODULE=on go build -tags draft ./cmd/main.go |
| 73 | + build-ui: |
| 74 | + name: UI build |
| 75 | + runs-on: ubuntu-latest |
| 76 | + steps: |
| 77 | + - name: Check out code |
| 78 | + uses: actions/checkout@master |
| 79 | + with: |
| 80 | + fetch-depth: 1 |
| 81 | + - uses: actions/setup-node@v1 |
| 82 | + with: |
| 83 | + node-version: ${{ secrets.NODE_VERSION }} |
| 84 | + - uses: actions/cache@v1 |
| 85 | + with: |
| 86 | + path: ~/.npm |
| 87 | + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |
| 88 | + restore-keys: | |
| 89 | + ${{ runner.os }}-node- |
| 90 | + - run: | |
| 91 | + cd ui |
| 92 | + npm i |
| 93 | + npm run build && npm run export |
| 94 | + cd .. |
| 95 | + cd provider-ui |
| 96 | + npm i |
| 97 | + npm run build && npm run export |
| 98 | + tests-ui: |
| 99 | + name: UI tests |
| 100 | + runs-on: ubuntu-latest |
| 101 | + steps: |
| 102 | + - name: Check out code |
| 103 | + uses: actions/checkout@master |
| 104 | + with: |
| 105 | + fetch-depth: 1 |
| 106 | + - uses: actions/setup-node@v1 |
| 107 | + with: |
| 108 | + node-version: ${{ secrets.NODE_VERSION }} |
| 109 | + - uses: actions/cache@v1 |
| 110 | + with: |
| 111 | + path: ~/.npm |
| 112 | + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} |
| 113 | + restore-keys: | |
| 114 | + ${{ runner.os }}-node- |
| 115 | + - run: | |
| 116 | + cd ui |
| 117 | + npm i |
| 118 | + npm test |
| 119 | + cd .. |
| 120 | + cd provider-ui |
| 121 | + npm i |
| 122 | + npm test |
| 123 | + cd .. |
| 124 | + mesheryctl_build: |
| 125 | + name: Mesheryctl build & release |
| 126 | + runs-on: macos-latest |
| 127 | + needs: [server-tests] |
| 128 | + steps: |
| 129 | + - name: Check out code |
| 130 | + uses: actions/checkout@master |
| 131 | + - name: Unshallow |
| 132 | + run: git fetch --prune --unshallow |
| 133 | + - name: Set up Go |
| 134 | + uses: actions/setup-go@v1 |
| 135 | + with: |
| 136 | + go-version: ${{ secrets.GO_VERSION }} |
| 137 | + - name: Setup Cache |
| 138 | + uses: actions/cache@v1 |
| 139 | + with: |
| 140 | + path: ~/go/pkg/mod |
| 141 | + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} |
| 142 | + restore-keys: | |
| 143 | + ${{ runner.os }}-go- |
| 144 | + - name: goreleaser WITHOUT tag |
| 145 | + uses: goreleaser/goreleaser-action@v1 |
| 146 | + if: success() && startsWith(github.ref, 'refs/tags/') == false |
| 147 | + with: |
| 148 | + version: latest |
| 149 | + args: release --snapshot --skip-publish --rm-dist |
0 commit comments