Debian Codegraph @

.github/workflows/smoke-test-pr.yml

raw
1 name: Smoke test (PR)
2
3 permissions:
4 contents: read
5
6 on:
7 pull_request_target:
8 types:
9 - labeled
10
11 env:
12 python-version: "3.12"
13
14 concurrency:
15 group: "smoke-test" # Make sure, to not run multiple smoke tests at the same time
16 cancel-in-progress: false
17
18 jobs:
19 smoke_test_pr:
20 runs-on: ubuntu-latest
21 if: ${{ github.event.label.name == 'run smoke test' }}
22 strategy:
23 matrix:
24 country:
25 - ch
26 - de
27 - pl
28 - ma
29 - ie
30 steps:
31 - name: Get User Permission
32 id: checkAccess
33 uses: actions-cool/check-user-permission@v2
34 with:
35 require: read
36 username: ${{ github.triggering_actor }}
37 env:
38 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39 - name: Check User Permission
40 if: steps.checkAccess.outputs.require-result == 'false'
41 run: |
42 echo "${{ github.triggering_actor }} does not have permissions on this repo."
43 echo "Current permission level is ${{ steps.checkAccess.outputs.user-permission }}"
44 echo "Job originally triggered by ${{ github.actor }}"
45 exit 1
46 - name: Checkout current code
47 uses: actions/checkout@v6
48 - name: Set up Python ${{ env.python-version }}
49 uses: actions/setup-python@v6
50 with:
51 python-version: ${{ env.python-version }}
52 - name: Check secret access
53 run: |
54 if [[ "x${{ secrets.PASSWORD }}" != "x" ]]; then
55 echo "Access to secrets"
56 else
57 echo "No access to secrets"
58 exit 1
59 fi
60 - name: Install dependencies
61 run: |
62 python -m pip install --upgrade pip
63 pip install -r requirements.txt
64 pip install -r requirements_test.txt
65 - name: Prepare cookies with pytest
66 run: pytest smoke_test/test_1_setup_token.py -v -x
67 env:
68 COUNTRY: ${{ matrix.country }}
69 EMAIL_CH: ${{ vars.EMAIL_CH }}
70 EMAIL_DE: ${{ vars.EMAIL_DE }}
71 EMAIL_PL: ${{ vars.EMAIL_PL }}
72 EMAIL_MA: ${{ vars.EMAIL_MA }}
73 EMAIL_IE: ${{ vars.EMAIL_IE }}
74 PASSWORD: ${{ secrets.PASSWORD }}
75 # !!!!!!!!!!!!!!!!!!!!
76 # From here on, we run new code which does not have access to the password, only the cookies
77 # !!!!!!!!!!!!!!!!!!!!
78 - name: Preserve cookies
79 run: cp .cookies /tmp/.cookies
80 - name: Checkout new code
81 uses: actions/checkout@v6
82 with:
83 ref: "${{ github.event.pull_request.merge_commit_sha }}"
84 clean: false
85 - name: Restore cookies
86 run: cp /tmp/.cookies .cookies
87 - name: Test with pytest
88 run: pytest smoke_test/test_2_methods.py -v -x
89 env:
90 COUNTRY: ${{ matrix.country }}
91 EMAIL_CH: ${{ vars.EMAIL_CH }}
92 EMAIL_DE: ${{ vars.EMAIL_DE }}
93 EMAIL_PL: ${{ vars.EMAIL_PL }}
94 EMAIL_MA: ${{ vars.EMAIL_MA }}
95 EMAIL_IE: ${{ vars.EMAIL_IE }}
96 PASSWORD: <redacted>
97