Skip to content

fix: remove deprecated ioutil package #3096

fix: remove deprecated ioutil package

fix: remove deprecated ioutil package #3096

Workflow file for this run

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@v3
- uses: actions/setup-go@v3
with:
go-version: '1.20'
- uses: golangci/golangci-lint-action@v3
with:
## TODO: https://github.com/golangci/golangci-lint-action/issues/759
version: v1.52.2
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@v3
- uses: actions/setup-go@v3
with:
go-version: '1.20'
- 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
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)
- uses: actions/upload-artifact@v3
with:
name: coverprofile
path: |
*.out
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.20'
- run: make test
- uses: actions/upload-artifact@v3
with:
name: coverprofile
path: |
*.out
codecov:
runs-on: ubuntu-latest
needs:
- e2e-test
- unit-test
steps:
- uses: actions/download-artifact@v3
with:
name: coverprofile
- name: Get cover files
id: files
run: |
files="$(find -maxdepth 1 -name '*.out' -exec readlink -f '{}' ';' | tr '\n' ',' | sed 's/,$//g')"
echo "files=$files" >> $GITHUB_OUTPUT
- uses: codecov/codecov-action@v3
with:
files: ${{ steps.files.outputs.files }} # optional
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
- uses: geekyeggo/delete-artifact@v2
with:
name: coverprofile