Skip to content

E2E Tests

E2E Tests #16

Workflow file for this run

name: E2E Tests
on:
workflow_dispatch:
schedule:
- cron: "0 20 * * *"
release:
types: [ published ]
pull_request:
permissions:
contents: read
jobs:
install_and_run_e2e_tests:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- scm_token: E2E_ENV_TOKEN_GITHUB
report_file_path: /tmp/gh_out.json
scm: github
test_plan: TestGitHub
extra: --org legitify-e2e,legitify-e2e-2
- scm_token: E2E_ENV_TOKEN_GITLAB
report_file_path: /tmp/gl_out.json
scm: gitlab
test_plan: TestGitLab
extra:
- scm_token: E2E_ENV_TOKEN_GITHUB
report_file_path: /tmp/gh_out.json
scm: github
test_plan: TestCLI
extra: --failed-only
- scm_token: E2E_ENV_TOKEN_GITHUB
report_file_path: /tmp/gh_out.json
scm: github
test_plan: TestCLI
extra: --namespace repository
- scm_token: E2E_ENV_TOKEN_GITHUB
report_file_path: /tmp/gh_out.json
scm: github
test_plan: TestCLI
extra: --org Legitify-E2E
- scm_token: E2E_ENV_TOKEN_GITHUB
report_file_path: /tmp/gh_out.json
scm: github
test_plan: TestCLI
extra: --repo Legitify-E2E/bad_branch_protection
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # ratchet:actions/checkout@v3
- uses: actions/setup-go@c4a742cab115ed795e34d4513e2cf7d472deb55f # ratchet:actions/setup-go@v3
with:
go-version: 1.19
- name: Build
run: |
make build
- name: Run tests
run: |
./legitify analyze --output-format json --output-file ${{ matrix.report_file_path }} --scm ${{ matrix.scm }} ${{ matrix.extra }}
env:
SCM_TOKEN: ${{ secrets[matrix.scm_token] }}
- name: Run output verification
run: go test ./e2e/... -run ${{ matrix.test_plan }} --report_path=${{ matrix.report_file_path }} --execution_args '${{ matrix.extra }}'
- name: Upload error log
if: always()
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb
with:
name: error-log-${{ matrix.scm }}
path: error.log
- name: Upload analyze output
if: always()
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb
with:
name: ${{ matrix.scm }}_analyze_output.json
path: ${{ matrix.report_file_path }}
- name: Notify Slack
uses: rtCamp/action-slack-notify@28e8b353eabda5998a2e1203aed33c5999944779
if: failure()
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_HOOKS_LEGITIFY_ALERTS }}
SLACK_CHANNEL: legitify-e2e
SLACK_COLOR: ${{ job.status }}
SLACK_MESSAGE: E2E Tests failed - ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
SLACK_TITLE: "Legitify periodic E2E test failed"