Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(e2e): run uptest every pr in this repo #53

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions .github/workflows/e2e-template-validation.yaml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not we use re-usable workflow approach for here? Are there steps we don't want to use?

Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Run Template Validation

jobs:
uptest:
if: ${{ github.event.issue.pull_request }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to add a on block to the workflow definition similar to this? Or will this definition be sufficient to run workflow?

runs-on: [e2-standard-8, linux]

steps:
- name: Setup QEMU
uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2
with:
platforms: all

- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
with:
submodules: true

- name: Setup Go
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3
with:
go-version: ${{ inputs.go-version }}

- name: Checkout PR
id: checkout-pr
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr checkout ${{ github.event.issue.number }}
git submodule update --init --recursive
OUTPUT=$(git log -1 --format='%H')
echo "commit-sha=$OUTPUT" >> $GITHUB_OUTPUT

- name: Find the Go Build Cache
if: ${{ inputs.package-type == 'provider' }}
id: go
run: echo "cache=$(make go.cachedir)" >> $GITHUB_OUTPUT

- name: Cache the Go Build Cache
if: ${{ inputs.package-type == 'provider' }}
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3
with:
path: ${{ steps.go.outputs.cache }}
key: ${{ runner.os }}-build-uptest-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-build-uptest-

- name: Cache Go Dependencies
if: ${{ inputs.package-type == 'provider' }}
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3
with:
path: .work/pkg
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-pkg-

- name: Vendor Dependencies
if: ${{ inputs.package-type == 'provider' }}
run: make vendor vendor.check

- name: Run Uptest
id: run-uptest
env:
UPTEST_CLOUD_CREDENTIALS: '{"upjet": "provider-template"}'
UPTEST_EXAMPLE_LIST: "examples/null/resource.yaml"
UPTEST_TEST_DIR: ./_output/controlplane-dump
UPTEST_DATASOURCE_PATH: .work/uptest-datasource.yaml
run: |
mkdir -p .work && echo "${{ secrets.UPTEST_DATASOURCE }}" > .work/uptest-datasource.yaml
make e2e

- name: Collect Cluster Dump
if: always()
run: |
make controlplane.dump

- name: Upload Cluster Dump
if: always()
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3
with:
name: controlplane-dump
path: ./_output/controlplane-dump

- name: Cleanup
if: always()
run: |
eval $(make --no-print-directory build.vars)
${KUBECTL} delete managed --all || true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ cover.out
# ignore IDE folders
.vscode/
.idea/

kubeconfig
4 changes: 3 additions & 1 deletion hack/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,6 @@ git mv "cluster/images/upjet-provider-template" "cluster/images/provider-${PROVI
# generate: open /Users/hasanturken/Workspace/crossplane-contrib/upjet-provider-template/apis/null/v1alpha1/zz_generated.deepcopy.go: no such file or directory
rm -rf apis/null
# remove the sample directory which was a configuration in the template
rm -rf config/null
rm -rf config/null
# remove the validation ci step which was a configuration in the template for validation with uptest
rm -rf .github/workflows/e2e-template-validation.yaml
Loading