diff options
| author | 2019-09-26 19:30:33 -0300 | |
|---|---|---|
| committer | 2019-09-26 19:30:33 -0300 | |
| commit | c4a99944f2faf4092842cf9a5b84f44c128f5809 (patch) | |
| tree | 7b2b2b2b1dcb3c22833bf527a0505c0e9b093526 | |
| parent | Merge pull request #2864 from ReinUsesLisp/fix-clang-decompiler (diff) | |
| parent | ci: Add two step patreon build pipeline (diff) | |
| download | yuzu-c4a99944f2faf4092842cf9a5b84f44c128f5809.tar.gz yuzu-c4a99944f2faf4092842cf9a5b84f44c128f5809.tar.xz yuzu-c4a99944f2faf4092842cf9a5b84f44c128f5809.zip | |
Merge pull request #2911 from DarkLordZach/azure-patreon
ci: Add azure patreon pipeline
Diffstat (limited to '')
| -rw-r--r-- | .ci/scripts/merge/apply-patches-by-label-private.py | 41 | ||||
| -rw-r--r-- | .ci/scripts/merge/apply-patches-by-label.py | 6 | ||||
| -rw-r--r-- | .ci/templates/merge-private.yml | 47 | ||||
| -rw-r--r-- | .ci/templates/mergebot-private.yml | 23 | ||||
| -rw-r--r-- | .ci/yuzu-patreon-step1.yml | 8 | ||||
| -rw-r--r-- | .ci/yuzu-patreon-step2.yml | 28 | ||||
| -rw-r--r-- | .ci/yuzu-patreon.yml | 19 |
7 files changed, 151 insertions, 21 deletions
diff --git a/.ci/scripts/merge/apply-patches-by-label-private.py b/.ci/scripts/merge/apply-patches-by-label-private.py new file mode 100644 index 000000000..11ec60010 --- /dev/null +++ b/.ci/scripts/merge/apply-patches-by-label-private.py | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | # Download all pull requests as patches that match a specific label | ||
| 2 | # Usage: python download-patches-by-label.py <Label to Match> <Root Path Folder to DL to> | ||
| 3 | |||
| 4 | import requests, sys, json, urllib3.request, shutil, subprocess, os, traceback | ||
| 5 | |||
| 6 | org = os.getenv("PrivateMergeOrg".upper(), "yuzu-emu") | ||
| 7 | repo = os.getenv("PrivateMergeRepo".upper(), "yuzu-private") | ||
| 8 | tagline = os.getenv("MergeTaglinePrivate".upper(), "") | ||
| 9 | user = sys.argv[1] | ||
| 10 | |||
| 11 | http = urllib3.PoolManager() | ||
| 12 | dl_list = {} | ||
| 13 | |||
| 14 | def check_individual(repo_id, pr_id): | ||
| 15 | url = 'https://%sdev.azure.com/%s/%s/_apis/git/repositories/%s/pullRequests/%s/labels?api-version=5.1-preview.1' % (user, org, repo, repo_id, pr_id) | ||
| 16 | response = requests.get(url) | ||
| 17 | if (response.ok): | ||
| 18 | j = json.loads(response.content) | ||
| 19 | for tg in j['value']: | ||
| 20 | if (tg['name'] == sys.argv[2]): | ||
| 21 | return True | ||
| 22 | return False | ||
| 23 | |||
| 24 | try: | ||
| 25 | url = 'https://%sdev.azure.com/%s/%s/_apis/git/pullrequests?api-version=5.1' % (user, org, repo) | ||
| 26 | response = requests.get(url) | ||
| 27 | if (response.ok): | ||
| 28 | j = json.loads(response.content) | ||
| 29 | for pr in j["value"]: | ||
| 30 | repo_id = pr['repository']['id'] | ||
| 31 | pr_id = pr['pullRequestId'] | ||
| 32 | if (check_individual(repo_id, pr_id)): | ||
| 33 | pn = pr_id | ||
| 34 | ref = pr['sourceRefName'] | ||
| 35 | print("Matched PR# %s" % pn) | ||
| 36 | print(subprocess.check_output(["git", "fetch", "https://%sdev.azure.com/%s/_git/%s" % (user, org, repo), ref, "-f"])) | ||
| 37 | print(subprocess.check_output(["git", "merge", "--squash", 'origin/' + ref.replace('refs/heads/','')])) | ||
| 38 | print(subprocess.check_output(["git", "commit", "-m\"Merge %s PR %s\"" % (tagline, pn)])) | ||
| 39 | except: | ||
| 40 | traceback.print_exc(file=sys.stdout) | ||
| 41 | sys.exit(-1) | ||
diff --git a/.ci/scripts/merge/apply-patches-by-label.py b/.ci/scripts/merge/apply-patches-by-label.py index b346001a5..7f1ea06cf 100644 --- a/.ci/scripts/merge/apply-patches-by-label.py +++ b/.ci/scripts/merge/apply-patches-by-label.py | |||
| @@ -1,7 +1,9 @@ | |||
| 1 | # Download all pull requests as patches that match a specific label | 1 | # Download all pull requests as patches that match a specific label |
| 2 | # Usage: python download-patches-by-label.py <Label to Match> <Root Path Folder to DL to> | 2 | # Usage: python download-patches-by-label.py <Label to Match> <Root Path Folder to DL to> |
| 3 | 3 | ||
| 4 | import requests, sys, json, urllib3.request, shutil, subprocess | 4 | import requests, sys, json, urllib3.request, shutil, subprocess, os |
| 5 | |||
| 6 | tagline = os.getenv("MergeTaglinePublic".upper(), "") | ||
| 5 | 7 | ||
| 6 | http = urllib3.PoolManager() | 8 | http = urllib3.PoolManager() |
| 7 | dl_list = {} | 9 | dl_list = {} |
| @@ -23,6 +25,6 @@ try: | |||
| 23 | print("Matched PR# %s" % pn) | 25 | print("Matched PR# %s" % pn) |
| 24 | print(subprocess.check_output(["git", "fetch", "https://github.com/yuzu-emu/yuzu.git", "pull/%s/head:pr-%s" % (pn, pn), "-f"])) | 26 | print(subprocess.check_output(["git", "fetch", "https://github.com/yuzu-emu/yuzu.git", "pull/%s/head:pr-%s" % (pn, pn), "-f"])) |
| 25 | print(subprocess.check_output(["git", "merge", "--squash", "pr-%s" % pn])) | 27 | print(subprocess.check_output(["git", "merge", "--squash", "pr-%s" % pn])) |
| 26 | print(subprocess.check_output(["git", "commit", "-m\"Merge PR %s\"" % pn])) | 28 | print(subprocess.check_output(["git", "commit", "-m\"Merge %s PR %s\"" % (tagline, pn)])) |
| 27 | except: | 29 | except: |
| 28 | sys.exit(-1) | 30 | sys.exit(-1) |
diff --git a/.ci/templates/merge-private.yml b/.ci/templates/merge-private.yml new file mode 100644 index 000000000..a640cfbde --- /dev/null +++ b/.ci/templates/merge-private.yml | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | jobs: | ||
| 2 | - job: merge | ||
| 3 | displayName: 'pull requests' | ||
| 4 | steps: | ||
| 5 | - checkout: self | ||
| 6 | submodules: recursive | ||
| 7 | - template: ./mergebot-private.yml | ||
| 8 | parameters: | ||
| 9 | matchLabel: '$(BuildName)-merge' | ||
| 10 | matchLabelPublic: '$(PublicBuildName)-merge' | ||
| 11 | - task: ArchiveFiles@2 | ||
| 12 | displayName: 'Package Source' | ||
| 13 | inputs: | ||
| 14 | rootFolderOrFile: '$(System.DefaultWorkingDirectory)' | ||
| 15 | includeRootFolder: false | ||
| 16 | archiveType: '7z' | ||
| 17 | archiveFile: '$(Build.ArtifactStagingDirectory)/yuzu-$(BuildName)-source.7z' | ||
| 18 | - task: PublishPipelineArtifact@1 | ||
| 19 | displayName: 'Upload Artifacts' | ||
| 20 | inputs: | ||
| 21 | targetPath: '$(Build.ArtifactStagingDirectory)/yuzu-$(BuildName)-source.7z' | ||
| 22 | artifact: 'yuzu-$(BuildName)-source' | ||
| 23 | replaceExistingArchive: true | ||
| 24 | - job: upload_source | ||
| 25 | displayName: 'upload' | ||
| 26 | dependsOn: merge | ||
| 27 | steps: | ||
| 28 | - template: ./sync-source.yml | ||
| 29 | parameters: | ||
| 30 | artifactSource: 'true' | ||
| 31 | needSubmodules: 'true' | ||
| 32 | - script: chmod a+x $(System.DefaultWorkingDirectory)/.ci/scripts/merge/yuzubot-git-config.sh && $(System.DefaultWorkingDirectory)/.ci/scripts/merge/yuzubot-git-config.sh | ||
| 33 | displayName: 'Apply Git Configuration' | ||
| 34 | - script: git tag -a $(BuildName)-$(Build.BuildId) -m "yuzu $(BuildName) $(Build.BuildNumber) $(Build.DefinitionName)" | ||
| 35 | displayName: 'Tag Source' | ||
| 36 | - script: git remote add other $(GitRepoPushChangesURL) | ||
| 37 | displayName: 'Register Repository' | ||
| 38 | - script: git push --follow-tags --force other HEAD:$(GitPushBranch) | ||
| 39 | displayName: 'Update Code' | ||
| 40 | - script: git rev-list -n 1 $(BuildName)-$(Build.BuildId) > $(Build.ArtifactStagingDirectory)/tag-commit.sha | ||
| 41 | displayName: 'Calculate Release Point' | ||
| 42 | - task: PublishPipelineArtifact@1 | ||
| 43 | displayName: 'Upload Release Point' | ||
| 44 | inputs: | ||
| 45 | targetPath: '$(Build.ArtifactStagingDirectory)/tag-commit.sha' | ||
| 46 | artifact: 'yuzu-$(BuildName)-release-point' | ||
| 47 | replaceExistingArchive: true \ No newline at end of file | ||
diff --git a/.ci/templates/mergebot-private.yml b/.ci/templates/mergebot-private.yml new file mode 100644 index 000000000..a673c5b01 --- /dev/null +++ b/.ci/templates/mergebot-private.yml | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | parameters: | ||
| 2 | matchLabel: 'dummy-merge' | ||
| 3 | matchLabelPublic: 'dummy-merge' | ||
| 4 | |||
| 5 | steps: | ||
| 6 | - script: mkdir $(System.DefaultWorkingDirectory)/patches && pip install requests urllib3 | ||
| 7 | displayName: 'Prepare Environment' | ||
| 8 | - script: chmod a+x $(System.DefaultWorkingDirectory)/.ci/scripts/merge/yuzubot-git-config.sh && $(System.DefaultWorkingDirectory)/.ci/scripts/merge/yuzubot-git-config.sh | ||
| 9 | displayName: 'Apply Git Configuration' | ||
| 10 | - task: PythonScript@0 | ||
| 11 | displayName: 'Discover, Download, and Apply Patches' | ||
| 12 | inputs: | ||
| 13 | scriptSource: 'filePath' | ||
| 14 | scriptPath: '.ci/scripts/merge/apply-patches-by-label.py' | ||
| 15 | arguments: '${{ parameters.matchLabelPublic }} patches-public' | ||
| 16 | workingDirectory: '$(System.DefaultWorkingDirectory)' | ||
| 17 | - task: PythonScript@0 | ||
| 18 | displayName: 'Discover, Download, and Apply Patches' | ||
| 19 | inputs: | ||
| 20 | scriptSource: 'filePath' | ||
| 21 | scriptPath: '.ci/scripts/merge/apply-patches-by-label-private.py' | ||
| 22 | arguments: '$(PrivateMergeUser) ${{ parameters.matchLabel }} patches-private' | ||
| 23 | workingDirectory: '$(System.DefaultWorkingDirectory)' | ||
diff --git a/.ci/yuzu-patreon-step1.yml b/.ci/yuzu-patreon-step1.yml new file mode 100644 index 000000000..cf30397cd --- /dev/null +++ b/.ci/yuzu-patreon-step1.yml | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | trigger: | ||
| 2 | - master | ||
| 3 | |||
| 4 | stages: | ||
| 5 | - stage: merge | ||
| 6 | displayName: 'merge' | ||
| 7 | jobs: | ||
| 8 | - template: ./templates/merge-private.yml | ||
diff --git a/.ci/yuzu-patreon-step2.yml b/.ci/yuzu-patreon-step2.yml new file mode 100644 index 000000000..080118224 --- /dev/null +++ b/.ci/yuzu-patreon-step2.yml | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | trigger: | ||
| 2 | - master | ||
| 3 | |||
| 4 | stages: | ||
| 5 | - stage: format | ||
| 6 | displayName: 'format' | ||
| 7 | jobs: | ||
| 8 | - job: format | ||
| 9 | displayName: 'clang' | ||
| 10 | pool: | ||
| 11 | vmImage: ubuntu-latest | ||
| 12 | steps: | ||
| 13 | - template: ./templates/format-check.yml | ||
| 14 | - stage: build | ||
| 15 | dependsOn: format | ||
| 16 | displayName: 'build' | ||
| 17 | jobs: | ||
| 18 | - template: ./templates/build-standard.yml | ||
| 19 | parameters: | ||
| 20 | cache: 'true' | ||
| 21 | - stage: release | ||
| 22 | displayName: 'release' | ||
| 23 | dependsOn: build | ||
| 24 | jobs: | ||
| 25 | - job: azure | ||
| 26 | displayName: 'azure' | ||
| 27 | steps: | ||
| 28 | - template: ./templates/release-universal.yml \ No newline at end of file | ||
diff --git a/.ci/yuzu-patreon.yml b/.ci/yuzu-patreon.yml deleted file mode 100644 index aa912913d..000000000 --- a/.ci/yuzu-patreon.yml +++ /dev/null | |||
| @@ -1,19 +0,0 @@ | |||
| 1 | # Starter pipeline | ||
| 2 | # Start with a minimal pipeline that you can customize to build and deploy your code. | ||
| 3 | # Add steps that build, run tests, deploy, and more: | ||
| 4 | # https://aka.ms/yaml | ||
| 5 | |||
| 6 | trigger: | ||
| 7 | - master | ||
| 8 | |||
| 9 | pool: | ||
| 10 | vmImage: 'ubuntu-latest' | ||
| 11 | |||
| 12 | steps: | ||
| 13 | - script: echo Hello, world! | ||
| 14 | displayName: 'Run a one-line script' | ||
| 15 | |||
| 16 | - script: | | ||
| 17 | echo Add other tasks to build, test, and deploy your project. | ||
| 18 | echo See https://aka.ms/yaml | ||
| 19 | displayName: 'Run a multi-line script' | ||