|
1 | 1 | name: Run tests on Git-Mastery |
2 | 2 |
|
3 | 3 | on: |
4 | | - pull_request_target: |
5 | 4 | workflow_dispatch: |
6 | 5 | push: |
7 | 6 | branches: |
8 | 7 | - main |
9 | 8 |
|
10 | 9 | permissions: |
11 | 10 | contents: read |
12 | | - pull-requests: read |
13 | 11 |
|
14 | 12 | jobs: |
15 | | - test-e2e-pr: |
16 | | - name: E2E Tests (${{ matrix.os }}) |
17 | | - if: github.event_name == 'pull_request_target' |
18 | | - # Require manual approval before secrets are exposed to untrusted PR code |
19 | | - environment: e2e-test |
20 | | - runs-on: ${{ matrix.os }} |
21 | | - |
22 | | - strategy: |
23 | | - fail-fast: false |
24 | | - matrix: |
25 | | - os: [ubuntu-latest, macos-latest, windows-latest] |
26 | | - python-version: ["3.13"] |
27 | | - |
28 | | - steps: |
29 | | - - name: Validate GH_PAT secret |
30 | | - shell: bash |
31 | | - env: |
32 | | - GH_PAT: ${{ secrets.GH_PAT }} |
33 | | - run: | |
34 | | - if [ -z "$GH_PAT" ]; then |
35 | | - echo "GH_PAT secret is required to run E2E tests." |
36 | | - exit 1 |
37 | | - fi |
38 | | -
|
39 | | - - name: Checkout |
40 | | - uses: actions/checkout@v4 |
41 | | - with: |
42 | | - # Explicitly check out the PR branch so we build and test the submitted code |
43 | | - # pull_request_target checks out the base branch by default |
44 | | - repository: ${{ github.event.pull_request.head.repo.full_name }} |
45 | | - ref: ${{ github.event.pull_request.head.sha }} |
46 | | - |
47 | | - - name: Set up Python ${{ matrix.python-version }} |
48 | | - uses: actions/setup-python@v5 |
49 | | - with: |
50 | | - python-version: ${{ matrix.python-version }} |
51 | | - |
52 | | - - name: Install dependencies |
53 | | - run: | |
54 | | - python -m pip install --upgrade pip |
55 | | - pip install -r requirements.txt |
56 | | -
|
57 | | - - name: Build binary |
58 | | - run: | |
59 | | - pyinstaller --onefile main.py --name gitmastery |
60 | | -
|
61 | | - - name: Set binary path (Unix) |
62 | | - if: runner.os != 'Windows' |
63 | | - run: echo "GITMASTERY_BINARY=${{ github.workspace }}/dist/gitmastery" >> $GITHUB_ENV |
64 | | - |
65 | | - - name: Set binary path (Windows) |
66 | | - if: runner.os == 'Windows' |
67 | | - run: echo "GITMASTERY_BINARY=${{ github.workspace }}/dist/gitmastery.exe" >> $env:GITHUB_ENV |
68 | | - |
69 | | - - name: Configure Git |
70 | | - run: | |
71 | | - git config --global user.name "github-actions[bot]" |
72 | | - git config --global user.email "github-actions[bot]@users.noreply.github.com" |
73 | | -
|
74 | | - - name: Run E2E tests |
75 | | - env: |
76 | | - GH_TOKEN: ${{ secrets.GH_PAT }} |
77 | | - run: | |
78 | | - python -m pytest tests/e2e/ -v |
79 | | -
|
80 | 13 | test-e2e: |
81 | 14 | name: E2E Tests (${{ matrix.os }}) |
82 | | - if: github.event_name != 'pull_request_target' && github.repository == 'git-mastery/app' |
83 | 15 | runs-on: ${{ matrix.os }} |
84 | 16 |
|
85 | 17 | strategy: |
|
0 commit comments