diff --git a/.github/workflows/mcad-CI.yml b/.github/workflows/mcad-CI.yml new file mode 100644 index 000000000..0d6ebbd03 --- /dev/null +++ b/.github/workflows/mcad-CI.yml @@ -0,0 +1,44 @@ +# This workflow will build mcad and run unit test and E2E tests +name: MCAD-CI +on: + pull_request: + branches: + - 'main' + - 'release-*' + +jobs: + MCAD-CI: + runs-on: ubuntu-latest + + steps: + - name: checkout code + uses: actions/checkout@v3 + with: + ref: "refs/pull/${{ github.event.number }}/merge" + fetch-depth: 0 + + - name: Set latest tag and Branch name + run: | + echo "GIT_BRANCH=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV + echo "TAG=$(git describe --abbrev=0 --tags)" >> $GITHUB_ENV + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: 1.18.10 + + - name: Build + run: + make mcad-controller + + - name: Run Unit tests + run: make run-test + + - name: Build Image + run: | + make images -e GIT_BRANCH=${{ env.GIT_BRANCH }} TAG=${{ env.GIT_BRANCH }}-${{ env.TAG }} + + - name: Run E2E tests + run: | + make run-e2e -e GIT_BRANCH=${{ env.GIT_BRANCH }} TAG=${{ env.GIT_BRANCH }}-${{ env.TAG }} + diff --git a/.travis.yml b/.travis.yml index e073d3d7e..6bd4fc81e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,7 @@ + +# Skip CI check when running as a pull request +if: "$TRAVIS_PULL_REQUEST != false" + language: go sudo: required @@ -25,8 +29,6 @@ script: - make run-test # Process 'make images' when NOT a pull request - 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then make images; fi' - # Process 'make images' when running as a pull request - - 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then unset quay_repository && make images; fi' # Process 'make push-images' when NOT a pull request - 'if [[ "$TRAVIS_PULL_REQUEST" == "false" && ! "$TRAVIS_BRANCH" =~ "^v[0-9]\.[0-9]+\.[0-9]+" ]]; then make push-images; fi' # Run the e2e and handle Travis condition where Travis fails on no output for 10 minutes. No output for 10 minutes