diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3a8820b..44cf66b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,15 +11,20 @@ jobs: contents: write steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3 + - uses: actions/setup-node@v4 + with: + cache: "npm" + cache-dependency-path: | + **/package-lock.json - - name: package - run: make package-all + - name: package + run: make package-all - - name: readme - run: make readme-all + - name: readme + run: make readme-all - # Commit all changed files back to the repository (dist and readme files) - - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: Automated commit of npm build result and updated readme files + # Commit all changed files back to the repository (dist and readme files) + - uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: Automated commit of npm build result and updated readme files diff --git a/.github/workflows/test-prepare-cluster.yml b/.github/workflows/test-prepare-cluster.yml new file mode 100644 index 0000000..e8bc7d0 --- /dev/null +++ b/.github/workflows/test-prepare-cluster.yml @@ -0,0 +1,64 @@ +name: test - prepare-cluster + +on: + pull_request: + branches: + - main + paths: + - prepare-cluster/** + - create-release/** + - create-customer/** + - create-cluster/** + - helm-install/** + - kots-install/** + +concurrency: + group: test-prepare-cluster-${{ github.head_ref }} + cancel-in-progress: true + +jobs: + test: + runs-on: ubuntu-latest + env: + WORDPRESS_CHART_VERSION: 22.2.8 + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + cache: "npm" + cache-dependency-path: | + **/package-lock.json + + - name: build + run: | + set -e + make package-create-release + make package-create-customer + make package-create-cluster + make package-helm-install + make package-kots-install + + - name: pull helm chart + run: | + helm pull oci://registry-1.docker.io/bitnamicharts/wordpress --version ${{ env.WORDPRESS_CHART_VERSION }} + + - name: test prepare-cluster + id: prepare-cluster + uses: ./prepare-cluster + with: + api-token: ${{ secrets.REPLICATED_API_TOKEN }} + app-slug: replicated-actions-ci # from the Replicated QA team + chart: wordpress-${{ env.WORDPRESS_CHART_VERSION }}.tgz + kubernetes-distribution: kind + helm-chart-name: wordpress + helm-run-preflights: false + + - name: remove cluster + id: remove-cluster + if: always() + uses: replicatedhq/compatibility-actions/remove-cluster@v1 + continue-on-error: true # It could be that the cluster is already removed + with: + api-token: ${{ secrets.REPLICATED_API_TOKEN }} + cluster-id: ${{ steps.prepare-cluster.outputs.cluster-id }} diff --git a/.gitignore b/.gitignore index c03bd36..460475e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ **/build -**/node_modules \ No newline at end of file +**/node_modules +.vscode/ diff --git a/prepare-cluster/action.yml b/prepare-cluster/action.yml index 3ba6820..7e25454 100644 --- a/prepare-cluster/action.yml +++ b/prepare-cluster/action.yml @@ -108,15 +108,15 @@ runs: steps: - name: 'Create Release' id: 'create-release' - uses: replicatedhq/compatibility-actions/create-release@v1 + uses: ./create-release with: app-slug: ${{ inputs.app-slug }} api-token: ${{ inputs.api-token }} yaml-dir: ${{ inputs.yaml-dir }} - chart: ${{ inputs.chart }} + chart: ${{ inputs.chart }} - name: 'Create Customer' id: 'create-customer' - uses: replicatedhq/compatibility-actions/create-customer@v1 + uses: ./create-customer with: app-slug: ${{ inputs.app-slug }} api-token: ${{ inputs.api-token }} @@ -127,7 +127,7 @@ runs: channel-slug: ${{ steps.create-release.outputs.channel-slug }} - name: Create Cluster id: create-cluster - uses: replicatedhq/compatibility-actions/create-cluster@v1 + uses: ./create-cluster with: api-token: ${{ inputs.api-token }} kubernetes-distribution: ${{ inputs.kubernetes-distribution }} @@ -145,7 +145,7 @@ runs: kubeconfig-path: ${{ inputs.kubeconfig-path || '' }} export-kubeconfig: ${{ inputs.export-kubeconfig || false }} - name: Deploy the app with Helm - uses: replicatedhq/compatibility-actions/helm-install@v1 + uses: ./helm-install if: ${{ inputs.chart != '' }} with: kubeconfig: ${{ steps.create-cluster.outputs.cluster-kubeconfig }} @@ -159,7 +159,7 @@ runs: run-preflights: ${{ inputs.helm-run-preflights }} - name: Deploy the app with KOTS if: ${{ inputs.yaml-dir != '' }} - uses: replicatedhq/compatibility-actions/kots-install@v1 + uses: ./kots-install with: kubeconfig: ${{ steps.create-cluster.outputs.cluster-kubeconfig }} app-slug: ${{ inputs.app-slug }}/test-channel