# This is a basic workflow to help you get started with Actions name: CICD # Controls when the action will run. Triggers the workflow on push or pull request # events but only for the master branch on: push: branches: - master - staging - develop pull_request: branches: - master - staging - develop # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: # The "build" workflow build: # The type of runner that the job will run on runs-on: ubuntu-latest # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v2 # Setup Go - name: Setup Go uses: actions/setup-go@v2 with: go-version: '^1.18' # The Go version to download (if necessary) and use. # Install all the dependencies - name: Install dependencies run: | go version go install -mod=mod golang.org/x/lint/golint go install -mod=mod github.com/onsi/ginkgo/v2/ginkgo # Run vet & lint on the code - name: Run vet & lint run: | go vet . golint . # Run testing on the code - name: Run testing run: | ginkgo --randomize-all --p --cover --coverprofile=cover.out . go tool cover -func=cover.out # Install build tool - name: Install build tool run: go install github.com/tystuyfzand/goc@latest # Run build of the application - name: Run build run: | mkdir build/ goc -o build/dlrouter cmd/main.go env: GOOS: linux,windows,darwin,openbsd,freebsd GOARCH: 386,amd64,arm,arm64 # Upload artifacts - name: Upload artifacts uses: actions/upload-artifact@v4.6.0 with: name: binaries path: build/ # The "deploy" workflow deploy: # The type of runner that the job will run on runs-on: ubuntu-latest needs: [build] # Only run this workflow when "build" workflow succeeds if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' }} # Only run this workflow if it is master branch on push event steps: - uses: actions/checkout@v2