feat(deploy): support single namespace #3395
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run EMQX Operator Test Case | |
concurrency: | |
group: test-${{ github.event_name }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
pull_request: | |
push: | |
## For update codecov.io | |
branches: | |
- main** | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
outputs: | |
e2e: ${{ steps.e2e.outputs.e2e }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
- uses: golangci/golangci-lint-action@v4 | |
with: | |
##https://github.com/golangci/golangci-lint-action/issues/807 | |
skip-pkg-cache: true | |
args: --timeout=5m | |
- run: go install github.com/google/go-licenses@latest | |
- run: $(go env GOPATH)/bin/go-licenses check . --disallowed_types forbidden,restricted,unknown | |
- name: Check manifests | |
run: | | |
make manifests | |
if ! git diff --quiet; then | |
echo "Need run make manifests" | |
exit 1 | |
fi | |
- name: Check generate | |
run: | | |
make generate | |
if ! git diff --quiet; then | |
echo "Need run make generate" | |
exit 1 | |
fi | |
- name: Check helm crds | |
run: | | |
make helm-crds | |
if ! git diff --quiet; then | |
echo "Need run make helm-crds" | |
exit 1 | |
fi | |
- name: Check line-break at EOF | |
run: ./scripts/check-nl-at-eof.sh | |
- name: Check space at EOL | |
run: ./scripts/check-space-at-eol.sh | |
- name: Run shellcheck | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y --no-install-recommends shellcheck | |
./scripts/shellcheck.sh | |
- name: Output e2e test cases | |
id: e2e | |
run: | | |
e2e=$(find e2e -type f ! -name "suite_test.go" | jq -R -s -c 'split("\n") | map(select(length > 0))') | |
echo "e2e test cases: $e2e" | |
echo "e2e=$e2e" >> $GITHUB_OUTPUT | |
e2e-test: | |
runs-on: ubuntu-latest | |
needs: lint | |
strategy: | |
fail-fast: false | |
matrix: | |
file: ${{fromJSON(needs.lint.outputs.e2e)}} | |
steps: | |
- run: minikube start | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
- run: go install github.com/onsi/ginkgo/v2/ginkgo@latest | |
- name: Install Telepresence | |
env: | |
TELEPRESENCE_VERSION: 2.13.3 | |
run: | | |
sudo curl -fL https://app.getambassador.io/download/tel2/linux/amd64/${TELEPRESENCE_VERSION}/telepresence -o /usr/local/bin/telepresence | |
sudo chmod a+x /usr/local/bin/telepresence | |
- run: telepresence helm install | |
- run: telepresence connect | |
- name: Run e2e test cases | |
id: e2e_test | |
env: | |
FILE: ${{ matrix.file }} | |
run: | | |
echo "Run e2e test cases: $FILE" | |
filename="$(basename $FILE)" | |
filename="${filename%.*}" | |
$(go env GOPATH)/bin/ginkgo -v --cover -covermode=atomic -coverpkg=./... -coverprofile=${filename}.out --focus-file=${filename} $(dirname $FILE) | |
echo "filename=${filename}" >> "$GITHUB_OUTPUT" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: coverprofile-${{ steps.e2e_test.outputs.filename }} | |
path: | | |
*.out | |
unit-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
- run: make test | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: coverprofile-unit-test | |
path: | | |
*.out | |
codecov: | |
runs-on: ubuntu-latest | |
needs: | |
- e2e-test | |
- unit-test | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: coverprofile-* | |
- name: Get cover files | |
id: files | |
run: | | |
files="$(find . -type f -name '*.out' -exec readlink -f '{}' ';' | tr '\n' ',' | sed 's/,$//g')" | |
echo "files=$files" >> $GITHUB_OUTPUT | |
- uses: codecov/codecov-action@v4 | |
with: | |
files: ${{ steps.files.outputs.files }} # optional | |
fail_ci_if_error: true # optional (default = false) | |
verbose: true # optional (default = false) | |
token: ${{ secrets.CODECOV_TOKEN }} # required | |
- uses: geekyeggo/delete-artifact@v5 | |
with: | |
name: coverprofile-* |