Skip to content

Commit f0b17de

Browse files
committed
workflows: add a workflow to run end-to-end tests
Add a dedicated 'test.yml' workflow that executes the end-to-end tests. Unlike CI, these tests are only run automatically for pull requests (although they can be manually triggered via workflow dispatch). By default, the tests will run with the "default" profile; this can be changed via an input variable in the workflow dispatch. Because the end-to-end tests deal with external dependencies (namely, Git), add an 'install-dependencies.sh' script to install and configure the dependencies on a GitHub Actions runner. The goal of this workflow is for it to eventually be used to run multiple types of long-running tests, such as integration tests or installer validation tests. Signed-off-by: Victoria Dye <[email protected]>
1 parent a6ff664 commit f0b17de

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

.github/workflows/test.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: End-to-end test
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
inputs:
7+
run-all:
8+
type: boolean
9+
description: 'Include tests that are excluded by default due to slowness'
10+
default: false
11+
12+
jobs:
13+
e2e-test:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Clone repository
18+
uses: actions/checkout@v3
19+
20+
- name: Setup Go
21+
uses: actions/setup-go@v3
22+
with:
23+
go-version-file: 'go.mod'
24+
25+
- name: Setup Node.js
26+
uses: actions/setup-node@v3
27+
with:
28+
node-version: 18
29+
30+
- name: Install system dependencies for end-to-end tests
31+
run: build/ci/install-dependencies.sh
32+
shell: bash
33+
34+
- name: Enable perf tests
35+
if: ${{ github.event.inputs.run-all }}
36+
run: echo "E2E_FLAGS='--all'" >> $GITHUB_ENV
37+
38+
- name: Run end-to-end tests
39+
env:
40+
E2E_FLAGS: ${{env.E2E_FLAGS}}
41+
run: make e2e-test E2E_FLAGS="$E2E_FLAGS"

build/ci/install-dependencies.sh

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
die () {
3+
echo "$*" >&2
4+
exit 1
5+
}
6+
7+
# Exit as soon as any line fails
8+
set -e
9+
10+
# Install latest version of Git (minimum v2.40)
11+
if command -v apt >/dev/null 2>&1; then
12+
sudo add-apt-repository ppa:git-core/ppa
13+
sudo apt update
14+
sudo apt -q -y install git
15+
elif command -v brew >/dev/null 2>&1; then
16+
brew install git
17+
else
18+
die 'Cannot install git'
19+
fi
20+
21+
# Set up test Git config
22+
git config --global user.name "GitHub Action"
23+
git config --global user.email "[email protected]"

0 commit comments

Comments
 (0)