Skip to content

Commit

Permalink
Add GitHub workflow for integration tests
Browse files Browse the repository at this point in the history
Signed-off-by: Mihaela Balutoiu <mbalutoiu@cloudbasesolutions.com>
  • Loading branch information
mihaelabalutoiu committed Aug 2, 2023
1 parent d373b1c commit 6f69f94
Show file tree
Hide file tree
Showing 4 changed files with 1,230 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Integration Tests
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
integration-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Golang
uses: actions/setup-go@v3
with:
go-version-file: go.mod

- name: Setup LXD
uses: canonical/setup-lxd@v0.1.1

- name: Build GARM
run: make build

- name: Setup GARM
run: sudo --preserve-env ./test/integration/scripts/setup-garm.sh
env:
GH_OAUTH_TOKEN: ${{ secrets.GH_OAUTH_TOKEN }}
CREDENTIALS_NAME: test-garm-creds

- name: Run integration tests
run: go run ./test/integration/e2e.go
env:
GARM_BASE_URL: http://127.0.0.1:9997
GARM_USERNAME: admin
GARM_PASSWORD: ${{ secrets.GARM_ADMIN_PASSWORD }}
GARM_FULLNAME: Local GARM Admin
GARM_EMAIL: admin@example.com
GARM_NAME: local_garm
CREDENTIALS_NAME: test-garm-creds
REPO_WEBHOOK_SECRET: ${{ secrets.REPO_WEBHOOK_SECRET }}
ORG_WEBHOOK_SECRET: ${{ secrets.ORG_WEBHOOK_SECRET }}

- name: Show GARM logs
if: always()
run: |
sudo systemctl status garm
sudo journalctl -u garm --no-pager
59 changes: 59 additions & 0 deletions test/integration/config/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
[default]
callback_url = "http://${GARM_METADATA_IP}:9997/api/v1/callbacks/status"
metadata_url = "http://${GARM_METADATA_IP}:9997/api/v1/metadata"

[metrics]
enable = true
disable_auth = false

[jwt_auth]
secret = "${JWT_AUTH_SECRET}"
time_to_live = "8760h"

[apiserver]
bind = "0.0.0.0"
port = 9997
use_tls = false

[database]
backend = "sqlite3"
passphrase = "${DB_PASSPHRASE}"
[database.sqlite3]
db_file = "/etc/garm/garm.db"

[[provider]]
name = "lxd_local"
provider_type = "lxd"
description = "Local LXD installation"
[provider.lxd]
unix_socket_path = "/var/snap/lxd/common/lxd/unix.socket"
include_default_profile = false
instance_type = "container"
secure_boot = false
project_name = "default"
[provider.lxd.image_remotes]
[provider.lxd.image_remotes.ubuntu]
addr = "https://cloud-images.ubuntu.com/releases"
public = true
protocol = "simplestreams"
skip_verify = false
[provider.lxd.image_remotes.ubuntu_daily]
addr = "https://cloud-images.ubuntu.com/daily"
public = true
protocol = "simplestreams"
skip_verify = false
[provider.lxd.image_remotes.images]
addr = "https://images.linuxcontainers.org"
public = true
protocol = "simplestreams"
skip_verify = false

[[github]]
name = "${CREDENTIALS_NAME}"
description = "GARM GitHub OAuth token"
oauth2_token = "${GH_OAUTH_TOKEN}"

[[github]]
name = "${CREDENTIALS_NAME}-clone"
description = "GARM GitHub OAuth token - clone"
oauth2_token = "${GH_OAUTH_TOKEN}"
Loading

0 comments on commit 6f69f94

Please sign in to comment.