1- # This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2- # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3-
41name : CI
52
63on :
@@ -14,81 +11,58 @@ concurrency:
1411 group : mailosaur-python
1512 cancel-in-progress : true
1613
14+ permissions :
15+ contents : read
16+
1717jobs :
1818 build :
19- runs-on : ubuntu-latest
19+ name : Build (${{ matrix.environment }})
20+ runs-on : ${{ vars.LINUX }}
2021 timeout-minutes : 10
2122 strategy :
23+ fail-fast : false
2224 max-parallel : 1
2325 matrix :
24- python-version : ["3.9" ]
26+ environment : [live, next ]
2527
2628 env :
27- MAILOSAUR_BASE_URL : https://mailosaur.com/
28- MAILOSAUR_SMTP_HOST : mailosaur.net
29+ MAILOSAUR_BASE_URL : ${{ matrix.environment == 'live' && ' https://mailosaur.com/' || 'https://next.mailosaur.com/' }}
30+ MAILOSAUR_SMTP_HOST : ${{ matrix.environment == 'live' && ' mailosaur.net' || 'mailosaur.email' }}
2931 MAILOSAUR_SMTP_PORT : 2525
3032 MAILOSAUR_API_KEY : ${{ secrets.MAILOSAUR_API_KEY }}
3133 MAILOSAUR_SERVER : ${{ secrets.MAILOSAUR_SERVER }}
3234 MAILOSAUR_VERIFIED_DOMAIN : ${{ secrets.MAILOSAUR_VERIFIED_DOMAIN }}
3335
3436 steps :
35- - uses : actions/checkout@v2
36- - name : Set up Python ${{ matrix.python-version }}
37+ - name : Checkout source code
38+ uses : actions/checkout@v4
39+ - name : Set up Python
3740 uses : actions/setup-python@v4
3841 with :
39- python-version : ${{ matrix.python-version }}
42+ python-version : ${{ vars.PYTHON_VERSION }}
4043 - name : Install dependencies
4144 run : |
4245 python -m pip install --upgrade pip
4346 if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
4447 - name : Test with pytest
4548 run : |
4649 pytest
47- - name : Notify on Failure
48- uses : skitionek/notify-microsoft-teams@master
49- if : ${{ failure() }}
50- with :
51- webhook_url : ${{ secrets.TEAMS_BUILDS_WEBHOOK }}
52- needs : ${{ toJson(needs) }}
53- job : ${{ toJson(job) }}
54- overwrite : " { title: `${workflow} failed for ${repository.name}` }"
5550
56- build-next :
51+ notify :
52+ name : Notify
5753 if : ${{ always() }}
5854 needs : build
59- runs-on : ubuntu-latest
60- timeout-minutes : 10
61- strategy :
62- max-parallel : 1
63- matrix :
64- python-version : ["3.9"]
65-
66- env :
67- MAILOSAUR_BASE_URL : https://next.mailosaur.com/
68- MAILOSAUR_SMTP_HOST : mailosaur.email
69- MAILOSAUR_SMTP_PORT : 2525
70- MAILOSAUR_API_KEY : ${{ secrets.MAILOSAUR_API_KEY }}
71- MAILOSAUR_SERVER : ${{ secrets.MAILOSAUR_SERVER }}
72- MAILOSAUR_VERIFIED_DOMAIN : ${{ secrets.MAILOSAUR_VERIFIED_DOMAIN }}
73-
55+ runs-on : ${{ vars.LINUX }}
56+
7457 steps :
75- - uses : actions/checkout@v2
76- - name : Set up Python ${{ matrix.python-version }}
77- uses : actions/setup-python@v4
58+ - name : Checkout custom actions
59+ uses : actions/checkout@v4
7860 with :
79- python-version : ${{ matrix.python-version }}
80- - name : Install dependencies
81- run : |
82- python -m pip install --upgrade pip
83- if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
84- - name : Test with pytest
85- run : |
86- pytest
87- - name : Notify on Failure
88- uses : skitionek/notify-microsoft-teams@master
89- if : ${{ failure() }}
61+ repository : mailosaur/actions
62+ token : ${{ secrets.CUSTOM_ACTIONS_TOKEN }}
63+ path : .github/actions
64+ - name : Send notifications
65+ uses : ./.github/actions/notify
9066 with :
91- webhook_url : ${{ secrets.TEAMS_BUILDS_WEBHOOK }}
92- needs : ${{ toJson(needs) }}
93- job : ${{ toJson(job) }}
94- overwrite : " { title: `${workflow} failed for ${repository.name}` }"
67+ webhook-url : ${{ secrets.NOTIFICATION_URL }}
68+ data : ' {"matrixBuildResult": "${{ needs.build.result }}"}'
0 commit comments