diff --git a/.github/workflows/actionlint.yml b/.github/workflows/actionlint.yml deleted file mode 100644 index 5a4a5058..00000000 --- a/.github/workflows/actionlint.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: actionlint - -on: - pull_request: - branches: [main] - paths: - - ".github/workflows/*" - -jobs: - actionlint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: actionlint - run: | - bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) - ./actionlint -color - shell: bash diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 6bbc8ce7..00000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,66 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: "CodeQL" - -on: - schedule: - - cron: '27 7 * * 4' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [ 'go' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] - # Learn more: - # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed - - steps: - - name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v3 - - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml deleted file mode 100644 index 780417be..00000000 --- a/.github/workflows/github-pages.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: github-pages - -on: - push: - branches: - - main -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - - uses: actions/setup-python@v5 - with: - python-version: 3.x - - run: pip install mkdocs-material - - run: mkdocs gh-deploy --force diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml deleted file mode 100644 index e7c54473..00000000 --- a/.github/workflows/pre-commit.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: pre-commit -on: - pull_request: - -jobs: - pre-commit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - - uses: actions/setup-python@v5 - with: - python-version: 3.x - - uses: pre-commit/action@v3.0.1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index f0e78cdb..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,101 +0,0 @@ -name: release - -on: - release: - types: - - published - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - -jobs: - build-and-push-image: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - - name: Build and push Docker image - uses: docker/build-push-action@v6 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - - create-pr-to-update-kustomization: - needs: [build-and-push-image] - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - with: - ref: 'main' - - - name: Update kustomization - run: IMG=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${GITHUB_REF:10} make update-version-to-install - - - name: Set output - id: set-output - run: echo "RELEASE_VERSION=${GITHUB_REF:10}" >> "$GITHUB_OUTPUT" - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v7 - with: - token: ${{ secrets.GITHUB_TOKEN }} - title: "chore: bump version to ${{ steps.set-output.outputs.RELEASE_VERSION }} in install/kustomization.yaml" - body: | - # Why - - New version [${{ steps.set-output.outputs.RELEASE_VERSION }}](${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ steps.set-output.outputs.RELEASE_VERSION }}) was released. - # What - - Update kustomization for installation - - create-pr-for-helm-charts: - needs: [build-and-push-image] - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - with: - ref: main - repository: nakamasato/helm-charts - - - name: Set output - id: set-output - run: echo "RELEASE_VERSION=${GITHUB_REF:10}" >> "$GITHUB_OUTPUT" - - - name: Update app version - run: | - yq e -i ".version = \"${{ steps.set-output.outputs.RELEASE_VERSION }}\"" charts/mysql-operator/Chart.yaml - yq e -i ".appVersion = \"${{ steps.set-output.outputs.RELEASE_VERSION }}\"" charts/mysql-operator/Chart.yaml - yq e -i ".controllerManager.manager.image.tag = \"${{ steps.set-output.outputs.RELEASE_VERSION }}\"" charts/mysql-operator/values.yaml - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v7 - with: - token: ${{ secrets.PAT_TO_UPDATE_HELM_CHARTS_REPO }} # when expired, need to update in https://github.com/settings/tokens - title: "chore: bump mysql-operator version to ${{ steps.set-output.outputs.RELEASE_VERSION }}" - branch: bump-mysql-operator-chart - body: | - # Why - - New version [${{ steps.set-output.outputs.RELEASE_VERSION }}](${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ steps.set-output.outputs.RELEASE_VERSION }}) was released. - # What - - bump mysql-operator chart version to [${{ steps.set-output.outputs.RELEASE_VERSION }}](${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ steps.set-output.outputs.RELEASE_VERSION }}) diff --git a/.github/workflows/test-build-oracle.yml b/.github/workflows/test-build-oracle.yml new file mode 100644 index 00000000..e69de29b diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 5b5d02ea..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,168 +0,0 @@ -name: test - -on: - pull_request: - push: - branches: - - main - -jobs: - path-filter: - outputs: - go: ${{steps.changes.outputs.go}} - e2e: ${{steps.changes.outputs.e2e}} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - - - uses: dorny/paths-filter@v3 - id: changes - with: - filters: | - go: - - '**.go' - - 'go.*' - - .github/workflows/test.yml - e2e: - - Dockerfile - - .github/workflows/test.yml - - config/crd/** - - tests/e2e/** - - internal/** - - '**.go' - - 'go.*' - - kuttl-test.yaml - - skaffold.yaml - - status-check: - runs-on: ubuntu-latest - needs: - - lint - - test - - e2e-kuttl - - e2e-ginkgo - permissions: {} - if: failure() - steps: - - run: exit 1 - - lint: - needs: path-filter - if: needs.path-filter.outputs.go == 'true' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - - - name: setup go - uses: actions/setup-go@v5 - with: - go-version-file: go.mod - - - name: golangci-lint - uses: golangci/golangci-lint-action@v6 - with: - # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version - version: latest - - # Optional: golangci-lint command line arguments. - args: --timeout=3m # --issues-exit-code=0 - - test: - needs: path-filter - if: needs.path-filter.outputs.go == 'true' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - - - name: setup go - uses: actions/setup-go@v5 - with: - go-version-file: ./go.mod - - - run: | - make test - cat cover.out >> coverage.txt - - - name: codecov - uses: codecov/codecov-action@v4 - - e2e-kuttl: - needs: path-filter - if: needs.path-filter.outputs.e2e == 'true' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - - - name: setup go - uses: actions/setup-go@v5 - with: - go-version-file: ./go.mod - cache: true - - # https://krew.sigs.k8s.io/docs/user-guide/setup/install/ - - name: krew - install - run: | - ( - set -x; cd "$(mktemp -d)" && - OS="$(uname | tr '[:upper:]' '[:lower:]')" && - ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" && - KREW="krew-${OS}_${ARCH}" && - curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" && - tar zxvf "${KREW}.tar.gz" && - ./"${KREW}" install krew - ) - - # https://docs.github.com/en/actions/learn-github-actions/workflow-commands-for-github-actions#adding-a-system-path - - name: krew - set PATH - run: echo "${KREW_ROOT:-$HOME/.krew}/bin:$PATH" >> "$GITHUB_PATH" - - # https://kuttl.dev/docs/cli.html#setup-the-kuttl-kubectl-plugin - - name: kuttl - install - run: | - kubectl krew install kuttl - kubectl kuttl -v - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Build with gha - uses: docker/build-push-action@v6 - with: - context: . - push: false # a shorthand for --output=type=registry if set to true - load: true # a shorthand for --output=type=docker if set to true - tags: mysql-operator:latest - cache-from: type=gha - cache-to: type=gha,mode=max - - - name: kuttl test - run: make kuttl - - e2e-ginkgo: - needs: path-filter - if: needs.path-filter.outputs.e2e == 'true' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - - - name: setup go - uses: actions/setup-go@v5 - with: - go-version-file: ./go.mod - cache: true - - - name: install skaffold # TODO: #69 Enable to install skaffold in e2e - run: | - curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64 && \ - sudo install skaffold /usr/local/bin/ - - - name: create kind cluster - working-directory: e2e - run: kind create cluster --name mysql-operator-e2e --kubeconfig kubeconfig --config kind-config.yml --wait 30s - - - name: skaffold run - working-directory: e2e - run: skaffold run --kubeconfig kubeconfig - - - name: e2e-with-ginkgo - run: make e2e-with-ginkgo