From af2cdbeab8c0e60ca3c8a3bc2097d3bb9ebc0ab8 Mon Sep 17 00:00:00 2001 From: Alex Collins Date: Tue, 11 May 2021 10:05:11 -0700 Subject: [PATCH] ci: unify build --- .github/workflows/build.yml | 124 ++++++++++++++++++++++++++++++++++ .github/workflows/e2e.yml | 36 ---------- .github/workflows/go.yml | 34 ---------- .github/workflows/release.yml | 65 ------------------ controllers/suite_test.go | 5 +- 5 files changed, 127 insertions(+), 137 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/e2e.yml delete mode 100644 .github/workflows/go.yml delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..69232996 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,124 @@ +name: Build + +on: + push: + tags: [ v* ] + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v2 + with: + go-version: 1.16 + - run: go version + - run: go env + - run: make kubebuilder name=linux + - run: go mod download + - run: make test + - run: bash <(curl -s https://codecov.io/bash) + + lint: + runs-on: ubuntu-latest + needs: [ test ] + steps: + - uses: actions/checkout@v2 + - run: touch api/util/message + - uses: golangci/golangci-lint-action@v2 + with: + version: v1.36.0 + - run: git diff --exit-code + + e2e: + runs-on: ubuntu-latest + needs: [ test ] + env: + KUBECONFIG: /etc/rancher/k3s/k3s.yaml + steps: + - uses: actions/checkout@v2 + - uses: docker/setup-qemu-action@v1 + - uses: docker/setup-buildx-action@v1 + - name: Install and start K3S + timeout-minutes: 3 + run: | + curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.18.17+k3s1 INSTALL_K3S_CHANNEL=stable INSTALL_K3S_EXEC=--docker K3S_KUBECONFIG_MODE=644 sh - + until kubectl cluster-info ; do sleep 10s ; done + - uses: actions/setup-go@v2 + with: + go-version: "1.16.2" + - run: make controller + - run: make deploy CONFIG=ci + - run: make runner runtimes + - run: make wait + - run: make test-examples + - name: list pods + if: ${{ failure() }} + run: kubectl -n argo-dataflow-system get pod + - name: controller logs + if: ${{ failure() }} + run: kubectl -n argo-dataflow-system logs deploy/controller-manager -c manager + + publish-images: + runs-on: ubuntu-latest + needs: [ test, lint, e2e ] + if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') + strategy: + matrix: + target: [ controller, runner, go1-16, java16, python3-9 ] + steps: + - uses: actions/checkout@v2 + - uses: docker/setup-qemu-action@v1 + - uses: docker/setup-buildx-action@v1 + - uses: docker/login-action@v1 + with: + registry: quay.io + username: ${{ secrets.QUAY_USERNAME }} + password: ${{ secrets.QUAY_ROBOT_TOKEN }} + - name: docker build + push + run: | + tag=$(basename $GITHUB_REF) + if [ $tag = "master" ]; then + tag="latest" + fi + docker buildx build . --target ${{matrix.target}} --tag quay.io/argoproj/dataflow-${{matrix.target}}:$tag --push + + draft-release: + runs-on: ubuntu-latest + needs: [ test, lint, e2e ] + if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + # 0 indicates all history for all branches and tags. + fetch-depth: 0 + # https://stackoverflow.com/questions/58033366/how-to-get-current-branch-within-github-actions + - uses: actions/setup-go@v2 + with: + go-version: 1.16 + - name: Get tag + run: | + tag=$(basename $GITHUB_REF) + if [ $tag = "master" ]; then + tag="latest" + fi + echo "##[set-output name=tag;]$tag" + id: tag + - name: Generate release artifacts + run: make manifests changelog TAG=${{ github.tag.inputs.tag }} + - name: Draft release + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ github.tag.inputs.tag }} + draft: true + prerelease: true + body_path: changelog + files: | + config/*.yaml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml deleted file mode 100644 index 4176123a..00000000 --- a/.github/workflows/e2e.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: E2E - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - build: - runs-on: ubuntu-latest - env: - KUBECONFIG: /etc/rancher/k3s/k3s.yaml - steps: - - uses: actions/checkout@v2 - - uses: docker/setup-qemu-action@v1 - - uses: docker/setup-buildx-action@v1 - - name: Install and start K3S - timeout-minutes: 3 - run: | - curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.18.17+k3s1 INSTALL_K3S_CHANNEL=stable INSTALL_K3S_EXEC=--docker K3S_KUBECONFIG_MODE=644 sh - - until kubectl cluster-info ; do sleep 10s ; done - - uses: actions/setup-go@v2 - with: - go-version: "1.16.2" - - run: make controller - - run: make deploy CONFIG=ci - - run: make runner runtimes - - run: make wait - - run: make test-examples - - name: list pods - if: ${{ failure() }} - run: kubectl -n argo-dataflow-system get pod - - name: controller logs - if: ${{ failure() }} - run: kubectl -n argo-dataflow-system logs deploy/controller-manager -c manager \ No newline at end of file diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml deleted file mode 100644 index df51c970..00000000 --- a/.github/workflows/go.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Go - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 - with: - go-version: 1.16 - - run: go version - - run: go env - - run: make kubebuilder name=linux - - run: go mod download - - run: make test - - run: bash <(curl -s https://codecov.io/bash) - - lint: - runs-on: ubuntu-latest - needs: [ build ] - steps: - - uses: actions/checkout@v2 - - run: touch api/util/message - - uses: golangci/golangci-lint-action@v2 - with: - version: v1.36.0 - - run: git diff --exit-code diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 82dfe441..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: Release - -on: - push: - tags: [ v* ] - branches: [ main ] - -jobs: - buildx: - runs-on: ubuntu-latest - - strategy: - matrix: - target: [ controller, runner, go1-16, java16, python3-9 ] - steps: - - uses: actions/checkout@v2 - - uses: docker/setup-qemu-action@v1 - - uses: docker/setup-buildx-action@v1 - - uses: docker/login-action@v1 - with: - registry: quay.io - username: ${{ secrets.QUAY_USERNAME }} - password: ${{ secrets.QUAY_ROBOT_TOKEN }} - - name: docker build + push - run: | - tag=$(basename $GITHUB_REF) - if [ $tag = "master" ]; then - tag="latest" - fi - docker buildx build . --target ${{matrix.target}} --tag quay.io/argoproj/dataflow-${{matrix.target}}:$tag --push - - draft-release: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - # 0 indicates all history for all branches and tags. - fetch-depth: 0 - # https://stackoverflow.com/questions/58033366/how-to-get-current-branch-within-github-actions - - uses: actions/setup-go@v2 - with: - go-version: 1.16 - - name: Get tag - run: | - tag=$(basename $GITHUB_REF) - if [ $tag = "master" ]; then - tag="latest" - fi - echo "##[set-output name=tag;]$tag" - id: tag - - name: Generate release artifacts - run: make manifests changelog TAG=${{ github.tag.inputs.tag }} - - name: Draft release - uses: softprops/action-gh-release@v1 - with: - tag_name: ${{ github.tag.inputs.tag }} - draft: true - prerelease: true - body_path: changelog - files: | - config/*.yaml - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/controllers/suite_test.go b/controllers/suite_test.go index 6ce906ed..e85cd38a 100644 --- a/controllers/suite_test.go +++ b/controllers/suite_test.go @@ -1,11 +1,12 @@ package controllers import ( - "github.com/argoproj-labs/argo-dataflow/api/util/containerkiller" - "k8s.io/client-go/kubernetes" "path/filepath" "testing" + "github.com/argoproj-labs/argo-dataflow/api/util/containerkiller" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/tools/record" . "github.com/onsi/ginkgo"