Skip to content

Commit

Permalink
chore(ci): test prepare-cluster on pr
Browse files Browse the repository at this point in the history
  • Loading branch information
emosbaugh committed May 15, 2024
1 parent 17650df commit a1634b9
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 16 deletions.
23 changes: 14 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
64 changes: 64 additions & 0 deletions .github/workflows/test-prepare-cluster.yml
Original file line number Diff line number Diff line change
@@ -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 }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
**/build
**/node_modules
**/node_modules
.vscode/
12 changes: 6 additions & 6 deletions prepare-cluster/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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 }}
Expand All @@ -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 }}
Expand All @@ -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
Expand Down

0 comments on commit a1634b9

Please sign in to comment.