-
Notifications
You must be signed in to change notification settings - Fork 14
63 lines (60 loc) · 2.53 KB
/
test-packages.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Test packages
on:
pull_request:
branches:
- main
paths:
- packages/**
jobs:
setup:
name: Setup
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
with:
fetch-depth: 2
- name: Git diff
id: diff
run: echo "changes=$(git diff --name-only HEAD~1 | grep -E "packages/[^/]+/[^/]+/.+" | cut -d / -f 2,3 -s | sort | uniq | jq -cnR '[inputs | split("/")]')" >> $GITHUB_OUTPUT
outputs:
changes: ${{ steps.diff.outputs.changes }}
test:
name: Test install
runs-on: ubuntu-latest
needs:
- setup
if: needs.setup.outputs.changes != '[]'
strategy:
matrix:
change: ${{ fromJson(needs.setup.outputs.changes) }}
steps:
- name: Checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
- name: Get latest Glasskube version
id: version
run: echo "version=$(curl https://glasskube.dev/release.json | jq -r .version)" >> $GITHUB_OUTPUT
- name: Install glasskube
run: curl -fL "https://github.com/glasskube/glasskube/releases/download/v${{ steps.version.outputs.version }}/glasskube_v${{ steps.version.outputs.version }}_linux_x86_64.tar.gz" | tar -xz
- name: Check glasskube
run: ./glasskube --version
- name: Start local webserver
uses: Eun/http-server-action@a68db85dc4a7e47241c0830702c3561709f021a2 # v1
with:
directory: ${{ github.workspace }}
port: 9090
- name: Add host.minikube.internal to /etc/hosts
run: sudo echo "127.0.0.1 host.minikube.internal" | sudo tee -a /etc/hosts
- name: Check local webserver
run: curl -v "http://host.minikube.internal:9090/packages/${{ matrix.change[0] }}/${{ matrix.change[1] }}/package.yaml"
- name: Start minikube cluster
uses: medyagh/setup-minikube@317d92317e473a10540357f1f4b2878b80ee7b95 # v0.0.16
- name: Bootstrap Glasskube in Minikube cluster
run: ./glasskube bootstrap --disable-telemetry --create-default-repository=false
- name: Add local repository
run: ./glasskube repo add local "http://host.minikube.internal:9090/packages/" --default
- name: Install package in Minikube cluster
run: ./glasskube install "${{ matrix.change[0] }}" --repository="local" --version="${{ matrix.change[1] }}" --yes
- name: Check package status
run: |
./glasskube describe "${{ matrix.change[0] }}" | grep -E "Status: *Ready"