From 7275b8eac785cae2900261eadc8169af5fb030bb Mon Sep 17 00:00:00 2001 From: David Wertenteil Date: Mon, 3 Oct 2022 09:09:50 +0300 Subject: [PATCH] testing gh actions --- .github/workflows/build_dev.yaml | 174 +++++++++++++++---------------- 1 file changed, 82 insertions(+), 92 deletions(-) diff --git a/.github/workflows/build_dev.yaml b/.github/workflows/build_dev.yaml index ad03b6d8..e251a3fa 100644 --- a/.github/workflows/build_dev.yaml +++ b/.github/workflows/build_dev.yaml @@ -2,111 +2,100 @@ name: build-dev on: push: - branches: [ dev ] + branches: [ master ] paths-ignore: # Do not run the pipeline if only Markdown files changed - '**.md' jobs: - build: - name: Create cross-platform dev build - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive + # build: + # name: Create cross-platform dev build + # runs-on: ${{ matrix.os }} + # strategy: + # matrix: + # os: [ubuntu-latest, macos-latest, windows-latest] + # steps: + # - uses: actions/checkout@v3 + # with: + # submodules: recursive - - name: Cache Go modules (Linux) - if: matrix.os == 'ubuntu-latest' - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- + # - name: Cache Go modules (Linux) + # if: matrix.os == 'ubuntu-latest' + # uses: actions/cache@v3 + # with: + # path: | + # ~/.cache/go-build + # ~/go/pkg/mod + # key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + # restore-keys: | + # ${{ runner.os }}-go- - - name: Cache Go modules (macOS) - if: matrix.os == 'macos-latest' - uses: actions/cache@v3 - with: - path: | - ~/Library/Caches/go-build - ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- + # - name: Cache Go modules (macOS) + # if: matrix.os == 'macos-latest' + # uses: actions/cache@v3 + # with: + # path: | + # ~/Library/Caches/go-build + # ~/go/pkg/mod + # key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + # restore-keys: | + # ${{ runner.os }}-go- - - name: Cache Go modules (Windows) - if: matrix.os == 'windows-latest' - uses: actions/cache@v3 - with: - path: | - ~\AppData\Local\go-build - ~\go\pkg\mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- + # - name: Cache Go modules (Windows) + # if: matrix.os == 'windows-latest' + # uses: actions/cache@v3 + # with: + # path: | + # ~\AppData\Local\go-build + # ~\go\pkg\mod + # key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + # restore-keys: | + # ${{ runner.os }}-go- - - name: Set up Go - uses: actions/setup-go@v3 - with: - go-version: 1.18 - - # - name: Test cmd pkg - # run: cd cmd && go test -v ./... + # - name: Set up Go + # uses: actions/setup-go@v3 + # with: + # go-version: 1.18 + + # - name: Install MSYS2 & libgit2 (Windows) + # shell: cmd + # run: .\build.bat all + # if: matrix.os == 'windows-latest' + + # - name: Install libgit2 (Linux/macOS) + # run: make libgit2 + # if: matrix.os != 'windows-latest' + + # - name: Test core pkg + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # run: go test -tags=static -v ./... + + # - name: Test httphandler pkg + # run: cd httphandler && go test -tags=static -v ./... + + # - name: Build + # env: + # RELEASE: v2.0.${{ github.run_number }} + # CLIENT: release-dev + # CGO_ENABLED: 1 + # run: python3 --version && python3 build.py - # - name: Test core pkg - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # run: cd core && go test -v ./... + # - name: Smoke Testing + # env: + # RELEASE: v2.0.${{ github.run_number }} + # KUBESCAPE_SKIP_UPDATE_CHECK: "true" + # run: python3 smoke_testing/init.py ${PWD}/build/${{ matrix.os }}/kubescape - # - name: Test cmd pkg - # run: cd cmd && go test -v ./... - - - name: Install MSYS2 & libgit2 (Windows) - shell: cmd - run: .\build.bat all - if: matrix.os == 'windows-latest' - - - name: Install libgit2 (Linux/macOS) - run: make libgit2 - if: matrix.os != 'windows-latest' - - - name: Test core pkg - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: go test -tags=static -v ./... - - - name: Test httphandler pkg - run: cd httphandler && go test -tags=static -v ./... - - - name: Build - env: - RELEASE: v2.0.${{ github.run_number }} - CLIENT: release-dev - CGO_ENABLED: 1 - run: python3 --version && python3 build.py - - - name: Smoke Testing - env: - RELEASE: v2.0.${{ github.run_number }} - KUBESCAPE_SKIP_UPDATE_CHECK: "true" - run: python3 smoke_testing/init.py ${PWD}/build/${{ matrix.os }}/kubescape - - - name: Upload build artifacts - uses: actions/upload-artifact@v2 - with: - name: kubescape-${{ matrix.os }} - path: build/${{ matrix.os }}/kubescape + # - name: Upload build artifacts + # uses: actions/upload-artifact@v2 + # with: + # name: kubescape-${{ matrix.os }} + # path: build/${{ matrix.os }}/kubescape build-docker: name: Build docker container, tag and upload to registry needs: build - if: ${{ github.repository == 'kubescape/kubescape' }} # TODO + # if: ${{ github.repository == 'kubescape/kubescape' }} # TODO runs-on: ubuntu-latest permissions: id-token: write @@ -139,4 +128,5 @@ jobs: run: docker login -u="${QUAY_USERNAME}" -p="${QUAY_PASSWORD}" quay.io - name: Build the Docker image - run: docker buildx build . --file build/Dockerfile --tag ${{ steps.image-name.outputs.IMAGE_NAME }}:${{ steps.image-version.outputs.IMAGE_VERSION }} --build-arg image_version=${{ steps.image-version.outputs.IMAGE_VERSION }} --build-arg client=image-dev --push --platform linux/amd64,linux/arm64 + run: docker buildx build . --file build/Dockerfile --tag ${{ steps.image-name.outputs.IMAGE_NAME }}:${{ steps.image-version.outputs.IMAGE_VERSION }} --build-arg image_version=${{ steps.image-version.outputs.IMAGE_VERSION }} --build-arg client=image-dwertent --push + # --platform linux/amd64,linux/arm64