feat: support perf testing with sbom_auto_generation on/off #82
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: [push, pull_request] | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install modules | |
run: npm install | |
- name: Run ESLint | |
run: npm run lint | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.20.7 | |
- name: Prepare memory storage for etcd of kind cluster | |
run: | | |
# Use memory storage for etcd of the kind cluster, see https://github.com/kubernetes-sigs/kind/issues/845 for more info | |
mkdir -p /tmp/lib/etcd | |
sudo mount -t tmpfs tmpfs /tmp/lib/etcd | |
- name: Install kubernetes | |
uses: helm/[email protected] | |
with: | |
version: v0.20.0 | |
node_image: kindest/node:v1.24.15 | |
cluster_name: harbor | |
config: .github/kind.yaml | |
- name: Install nginx ingress controller | |
run: | | |
if ! time kubectl wait --for=condition=ready=false node --all --timeout=180s; then | |
kubectl describe node | |
fi | |
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml | |
if ! time kubectl wait --namespace ingress-nginx --for=condition=ready pod --selector=app.kubernetes.io/component=controller --timeout=300s; then | |
kubectl get all -n ingress-nginx | |
kubectl describe pod -n ingress-nginx | |
exit 1 | |
fi | |
- name: Set up helm | |
uses: azure/setup-helm@v3 | |
with: | |
version: "3.11.1" | |
- name: Install harbor | |
run: | | |
sudo -- sh -c "echo '127.0.0.1 core.harbor.domain' >> /etc/hosts" | |
git clone https://github.com/goharbor/harbor-helm | |
cd harbor-helm | |
helm install harbor . --set harborAdminPassword=Harbor1234567890 --set logLevel=debug | |
if ! time kubectl wait --for=condition=ready pod --all --timeout=600s; then | |
kubectl get all | |
kubectl describe pod | |
exit 1 | |
fi | |
- name: Prepare data | |
env: | |
K6_QUIET: yes | |
HARBOR_VUS: 20 | |
HARBOR_SIZE: ci | |
HARBOR_URL: https://admin:[email protected] | |
run: go run mage.go prepare | |
- name: Run all tests | |
env: | |
K6_QUIET: yes | |
HARBOR_VUS: 10 | |
HARBOR_ITERATIONS: 10 | |
HARBOR_SIZE: ci | |
HARBOR_URL: https://admin:[email protected] | |
HARBOR_REPORT: true | |
run: go run mage.go | |
- name: Fetch harbor logs | |
if: ${{ failure() }} | |
run: | | |
mkdir -p /tmp/harbor | |
for name in chartmuseum core database jobservice notary-server notary-signer portal redis registry trivy; do \ | |
kubectl logs -l "component=$name" --all-containers=true > /tmp/harbor/$name.log ; \ | |
done | |
- uses: actions/upload-artifact@v2 | |
if: ${{ failure() }} | |
with: | |
name: harbor | |
path: /tmp/harbor | |
- name: Fetch cluster logs | |
if: ${{ failure() }} | |
run: | | |
mkdir -p /tmp/logs | |
kind export logs --name harbor /tmp/logs | |
- uses: actions/upload-artifact@v2 | |
if: ${{ failure() }} | |
with: | |
name: kind | |
path: /tmp/logs |