diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml new file mode 100644 index 0000000..250484f --- /dev/null +++ b/.github/workflows/build-and-release.yml @@ -0,0 +1,65 @@ +name: Meshery-NGINX Build and Releaser +on: + push: + branches: + - 'master' + tags: + - 'v*' + +jobs: + build: + name: Build check + runs-on: ubuntu-latest + # needs: [lint, error_check, static_check, vet, sec_check, tests] + steps: + - name: Check out code + uses: actions/checkout@master + with: + fetch-depth: 1 + - name: Setup Go + uses: actions/setup-go@v1 + with: + go-version: ${{ secrets.GO_VERSION }} + - run: GOPROXY=direct GOSUMDB=off GO111MODULE=on go build . + docker: + name: Docker build and push + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@master + with: + fetch-depth: 1 + - name: Docker login + uses: azure/docker-login@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Docker edge build & tag + if: startsWith(github.ref, 'refs/tags/') != true && success() + run: | + DOCKER_BUILDKIT=1 docker build --no-cache -t ${{ secrets.IMAGE_NAME }}:edge-latest --build-arg TOKEN=${{ secrets.GLOBAL_TOKEN }} . + docker tag ${{ secrets.IMAGE_NAME }}:edge-latest ${{ secrets.IMAGE_NAME }}:edge-${GITHUB_SHA::7} + - name: Docker edge push + if: startsWith(github.ref, 'refs/tags/') != true && success() + run: | + docker push ${{ secrets.IMAGE_NAME }}:edge-latest + docker push ${{ secrets.IMAGE_NAME }}:edge-${GITHUB_SHA::7} + - name: Docker stable build & tag + if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') && success() + run: | + DOCKER_BUILDKIT=1 docker build --no-cache -t ${{ secrets.IMAGE_NAME }}:stable-latest . + docker tag ${{ secrets.IMAGE_NAME }}:stable-latest ${{ secrets.IMAGE_NAME }}:stable-${GITHUB_REF/refs\/tags\//} + docker tag ${{ secrets.IMAGE_NAME }}:stable-latest ${{ secrets.IMAGE_NAME }}:stable-${GITHUB_SHA::7} + - name: Docker stable push + if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') && success() + run: | + docker push ${{ secrets.IMAGE_NAME }}:stable-latest + docker push ${{ secrets.IMAGE_NAME }}:stable-${GITHUB_REF/refs\/tags\//} + docker push ${{ secrets.IMAGE_NAME }}:stable-${GITHUB_SHA::7} + - name: Docker Hub Description + if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') && success() + uses: peter-evans/dockerhub-description@v2.0.0 + env: + DOCKERHUB_USERNAME: ${{ secrets.DOCKER_USERNAME }} + DOCKERHUB_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} + DOCKERHUB_REPOSITORY: ${{ secrets.IMAGE_NAME }} \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 817379f..2630b05 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,122 +28,4 @@ jobs: # args: --issues-exit-code=0 # Optional: show only new issues if it's a pull request. The default value is `false`. - # only-new-issues: true - server-tests: - needs: [tests-ui, golangci, build-backend, build-ui] - name: Server tests - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@master - with: - fetch-depth: 1 - - name: Setup Go - uses: actions/setup-go@v1 - with: - go-version: ${{ secrets.GO_VERSION }} - - name: Setup Cache - uses: actions/cache@v1 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - run: GOPROXY=direct GOSUMDB=off GO111MODULE=on go test -tags draft ./... - build-backend: - name: Backend build - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@master - with: - fetch-depth: 1 - - name: Setup Go - uses: actions/setup-go@v1 - with: - go-version: ${{ secrets.GO_VERSION }} - - name: Setup Cache - uses: actions/cache@v1 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - run: GOPROXY=direct GOSUMDB=off GO111MODULE=on go build -tags draft ./cmd/main.go - build-ui: - name: UI build - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@master - with: - fetch-depth: 1 - - uses: actions/setup-node@v1 - with: - node-version: ${{ secrets.NODE_VERSION }} - - uses: actions/cache@v1 - with: - path: ~/.npm - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node- - - run: | - cd ui - npm i - npm run build && npm run export - cd .. - cd provider-ui - npm i - npm run build && npm run export - tests-ui: - name: UI tests - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@master - with: - fetch-depth: 1 - - uses: actions/setup-node@v1 - with: - node-version: ${{ secrets.NODE_VERSION }} - - uses: actions/cache@v1 - with: - path: ~/.npm - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node- - - run: | - cd ui - npm i - npm test - cd .. - cd provider-ui - npm i - npm test - cd .. - mesheryctl_build: - name: Mesheryctl build & release - runs-on: macos-latest - needs: [server-tests] - steps: - - name: Check out code - uses: actions/checkout@master - - name: Unshallow - run: git fetch --prune --unshallow - - name: Set up Go - uses: actions/setup-go@v1 - with: - go-version: ${{ secrets.GO_VERSION }} - - name: Setup Cache - uses: actions/cache@v1 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - name: goreleaser WITHOUT tag - uses: goreleaser/goreleaser-action@v1 - if: success() && startsWith(github.ref, 'refs/tags/') == false - with: - version: latest - args: release --snapshot --skip-publish --rm-dist + # only-new-issues: true \ No newline at end of file diff --git a/.gitignore b/.gitignore index 66fd13c..6907f19 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,5 @@ # Dependency directories (remove the comment below to include it) # vendor/ +meshery-nginx +bin/ diff --git a/Dockerfile b/Dockerfile index ce14017..e13f843 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ ARG CONFIG_PROVIDER="viper" RUN apt update && apt install git libc-dev gcc pkgconf -y COPY ${PWD} /go/src/github.com/layer5io/meshery-nginx/ WORKDIR /go/src/github.com/layer5io/meshery-nginx/ -RUN go build -mod=vendor -ldflags="-w -s -X main.configProvider=$CONFIG_PROVIDER" -a -o meshery-nginx +RUN go build -ldflags="-w -s -X main.configProvider=$CONFIG_PROVIDER" -a -o meshery-nginx FROM golang:1.14-stretch RUN apt update && apt install ca-certificates curl -y