-
Notifications
You must be signed in to change notification settings - Fork 275
108 lines (92 loc) · 3.09 KB
/
pr-tests.yml
File metadata and controls
108 lines (92 loc) · 3.09 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Run tests on PRs
on: [workflow_call]
permissions:
contents: read
jobs:
run-tests:
name: Run tests for ${{ matrix.package }}
runs-on: infra-tests
strategy:
matrix:
include:
- package: packages/api
test_path: ./...
sudo: false
- package: packages/client-proxy
test_path: ./...
sudo: false
- package: packages/db
test_path: ./...
sudo: false
- package: packages/docker-reverse-proxy
test_path: ./...
sudo: false
- package: packages/envd
test_path: ./...
sudo: true
- package: packages/orchestrator
test_path: ./...
sudo: true
- package: packages/shared
test_path: ./pkg/...
sudo: false
fail-fast: false
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
ref: ${{ inputs.commit_sha }}
- name: Setup Go
uses: ./.github/actions/go-setup-cache
with:
cache-dependency-paths: |
go.work
${{ matrix.package }}/go.mod
${{ matrix.package }}/go.sum
- name: Setup envd tests
run: |
# Install bindfs for FUSE mount tests
sudo apt-get update && sudo apt-get install -y bindfs
if: matrix.package == 'packages/envd'
- name: Setup orchestrator tests
run: |
# Enable unprivileged uffd mode
echo 1 | sudo tee /proc/sys/vm/unprivileged_userfaultfd
# Enable hugepages
sudo mkdir -p /mnt/hugepages
sudo mount -t hugetlbfs none /mnt/hugepages
echo 2000 | sudo tee /proc/sys/vm/nr_hugepages
# Enable NBD
sudo modprobe nbd nbds_max=256
# Disable inotify watching of change events for NBD devices
echo 'ACTION=="add|change", KERNEL=="nbd*", OPTIONS:="nowatch"' | sudo tee /etc/udev/rules.d/97-nbd-device.rules
sudo udevadm control --reload-rules
sudo udevadm trigger
if: matrix.package == 'packages/orchestrator'
- name: Run tests that require sudo
working-directory: ${{ matrix.package }}
run: |
# Run tests. The '-E' flag is required to allow root to use the correct cache path.
sudo -E `which go` test -v ${{ matrix.test_path }}
if: matrix.sudo == true
- name: Run tests
working-directory: ${{ matrix.package }}
run: go test -v ${{ matrix.test_path }}
if: matrix.sudo == false
validate-iac:
name: Validate terraform
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Parse .tool-versions
uses: wistia/parse-tool-versions@v2.1.1
- name: Setup Terraform
uses: hashicorp/setup-terraform@v4
with:
terraform_version: "${{ env.TERRAFORM }}"
- name: Validate terraform
working-directory: ./iac/provider-gcp
run: |
terraform init -backend=false
terraform validate