87 lines
2.5 KiB
YAML
87 lines
2.5 KiB
YAML
name: Integration Tests
|
|
on:
|
|
workflow_dispatch: {}
|
|
schedule:
|
|
- cron: "0 0 * * *"
|
|
|
|
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: ./test/integration/scripts/setup-garm.sh
|
|
env:
|
|
GH_OAUTH_TOKEN: ${{ secrets.GH_OAUTH_TOKEN }}
|
|
CREDENTIALS_NAME: test-garm-creds
|
|
|
|
- name: Generate secrets
|
|
run: |
|
|
function randomStringGenerator() {
|
|
tr -dc "a-zA-Z0-9@#$%^&*()_+?><~\`;'" </dev/urandom | head -c 64 ; echo '';
|
|
}
|
|
|
|
GARM_PASSWORD=$(randomStringGenerator)
|
|
REPO_WEBHOOK_SECRET=$(randomStringGenerator)
|
|
ORG_WEBHOOK_SECRET=$(randomStringGenerator)
|
|
|
|
echo "::add-mask::$GARM_PASSWORD"
|
|
echo "::add-mask::$REPO_WEBHOOK_SECRET"
|
|
echo "::add-mask::$ORG_WEBHOOK_SECRET"
|
|
|
|
echo "GARM_PASSWORD=$GARM_PASSWORD" >> $GITHUB_ENV
|
|
echo "REPO_WEBHOOK_SECRET=$REPO_WEBHOOK_SECRET" >> $GITHUB_ENV
|
|
echo "ORG_WEBHOOK_SECRET=$ORG_WEBHOOK_SECRET" >> $GITHUB_ENV
|
|
|
|
- name: Set up ngrok
|
|
id: ngrok
|
|
uses: gabriel-samfira/ngrok-tunnel-action@v1.1
|
|
with:
|
|
ngrok_authtoken: ${{ secrets.NGROK_AUTH_TOKEN }}
|
|
port: 9997
|
|
tunnel_type: http
|
|
|
|
- name: Create logs directory
|
|
if: always()
|
|
run: sudo mkdir -p /artifacts-logs && sudo chmod 777 /artifacts-logs
|
|
|
|
- name: Run integration tests
|
|
run: |
|
|
set -o pipefail
|
|
set -o errexit
|
|
go run ./test/integration/e2e.go 2>&1 | tee /artifacts-logs/e2e.log
|
|
env:
|
|
GARM_BASE_URL: ${{ steps.ngrok.outputs.tunnel-url }}
|
|
GARM_USERNAME: admin
|
|
GARM_FULLNAME: Local GARM Admin
|
|
GARM_EMAIL: admin@example.com
|
|
GARM_NAME: local_garm
|
|
ORG_NAME: gsamfira
|
|
REPO_NAME: garm-testing
|
|
CREDENTIALS_NAME: test-garm-creds
|
|
|
|
- name: Show GARM logs
|
|
if: always()
|
|
run: |
|
|
sudo systemctl status garm
|
|
sudo journalctl -u garm --no-pager 2>&1 | tee /artifacts-logs/garm.log
|
|
|
|
- name: Upload GARM and e2e logs
|
|
if: always()
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: garm-logs
|
|
path: /artifacts-logs
|