-
Notifications
You must be signed in to change notification settings - Fork 200
85 lines (75 loc) · 2.94 KB
/
TestGitHubReleasesInfoProvider.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
---
name: Test GitHubReleasesInfoProvider Processors
on:
pull_request:
paths:
- ".github/workflows/TestGitHubReleasesInfoProvider.yaml"
- "Code/autopkglib/GitHubReleasesInfoProvider.py"
- "Code/autopkglib/github/**"
- "requirements.txt"
jobs:
TestGitHubReleasesInfoProvider:
strategy:
matrix:
# https://ncorti.com/blog/howto-github-actions-build-matrix
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
# only needed on self hosted windows runners:
- name: set powershell execution policy CurrentUser
if: runner.os == 'Windows'
shell: cmd
run: powershell -command "Set-ExecutionPolicy -Force -ExecutionPolicy RemoteSigned -Scope CurrentUser"
- name: Set github token autopkg
# required for githubreleaseinfoprovider in github actions
# without this, API limits will be hit
run: |
cd ~
echo ${{ secrets.GITHUB_TOKEN }} > ".autopkg_gh_token"
- name: checkout this repo
uses: actions/checkout@v3
- name: checkout autopkg
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.8
cache: "pip"
cache-dependency-path: |
gh_actions_requirements.txt
- name: Install requirements
run: pip install --requirement gh_actions_requirements.txt
- name: create empty config windows
# https://stackoverflow.com/questions/57946173/github-actions-run-step-on-specific-os
if: runner.os == 'Windows'
shell: cmd
run: |
if not exist "%USERPROFILE%/AppData/Local/Autopkg" mkdir "%USERPROFILE%/AppData/Local/Autopkg"
if not exist "%USERPROFILE%/AppData/Local/Autopkg/config.json" echo {} > "%USERPROFILE%/AppData/Local/Autopkg/config.json"
- name: create default autopkg config file Linux
if: runner.os == 'Linux'
run: |
cd ~ && mkdir -p .config/Autopkg
cd ~ && echo {} > .config/Autopkg/config.json
- name: create file
shell: bash
run: |
cat <<'EOFEOF' > GitHubReleasesInfoProvider.test.recipe.yaml
---
Description: Test GitHubReleasesInfoProvider Processor
Identifier: com.github.autopkg.test.GitHubReleasesInfoProvider
Input:
NAME: GitHubReleasesInfoProviderTest
MinimumVersion: "2.3"
Process:
- Processor: GitHubReleasesInfoProvider
Arguments:
github_repo: audacity/audacity
asset_regex: .*64bit\.exe$
include_prereleases: False
EOFEOF
- name: get file contents
shell: bash
run: cat GitHubReleasesInfoProvider.test.recipe.yaml
- name: run integration recipe created in action
run: python Code/autopkg run -vvvv GitHubReleasesInfoProvider.test.recipe.yaml