mirror of
https://github.com/yuzu-emu/yuzu-mainline.git
synced 2024-12-12 17:24:24 +01:00
Merge pull request #2911 from DarkLordZach/azure-patreon
ci: Add azure patreon pipeline
This commit is contained in:
commit
c4a99944f2
41
.ci/scripts/merge/apply-patches-by-label-private.py
Normal file
41
.ci/scripts/merge/apply-patches-by-label-private.py
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
# Download all pull requests as patches that match a specific label
|
||||||
|
# Usage: python download-patches-by-label.py <Label to Match> <Root Path Folder to DL to>
|
||||||
|
|
||||||
|
import requests, sys, json, urllib3.request, shutil, subprocess, os, traceback
|
||||||
|
|
||||||
|
org = os.getenv("PrivateMergeOrg".upper(), "yuzu-emu")
|
||||||
|
repo = os.getenv("PrivateMergeRepo".upper(), "yuzu-private")
|
||||||
|
tagline = os.getenv("MergeTaglinePrivate".upper(), "")
|
||||||
|
user = sys.argv[1]
|
||||||
|
|
||||||
|
http = urllib3.PoolManager()
|
||||||
|
dl_list = {}
|
||||||
|
|
||||||
|
def check_individual(repo_id, pr_id):
|
||||||
|
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)
|
||||||
|
response = requests.get(url)
|
||||||
|
if (response.ok):
|
||||||
|
j = json.loads(response.content)
|
||||||
|
for tg in j['value']:
|
||||||
|
if (tg['name'] == sys.argv[2]):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
try:
|
||||||
|
url = 'https://%sdev.azure.com/%s/%s/_apis/git/pullrequests?api-version=5.1' % (user, org, repo)
|
||||||
|
response = requests.get(url)
|
||||||
|
if (response.ok):
|
||||||
|
j = json.loads(response.content)
|
||||||
|
for pr in j["value"]:
|
||||||
|
repo_id = pr['repository']['id']
|
||||||
|
pr_id = pr['pullRequestId']
|
||||||
|
if (check_individual(repo_id, pr_id)):
|
||||||
|
pn = pr_id
|
||||||
|
ref = pr['sourceRefName']
|
||||||
|
print("Matched PR# %s" % pn)
|
||||||
|
print(subprocess.check_output(["git", "fetch", "https://%sdev.azure.com/%s/_git/%s" % (user, org, repo), ref, "-f"]))
|
||||||
|
print(subprocess.check_output(["git", "merge", "--squash", 'origin/' + ref.replace('refs/heads/','')]))
|
||||||
|
print(subprocess.check_output(["git", "commit", "-m\"Merge %s PR %s\"" % (tagline, pn)]))
|
||||||
|
except:
|
||||||
|
traceback.print_exc(file=sys.stdout)
|
||||||
|
sys.exit(-1)
|
@ -1,7 +1,9 @@
|
|||||||
# Download all pull requests as patches that match a specific label
|
# Download all pull requests as patches that match a specific label
|
||||||
# Usage: python download-patches-by-label.py <Label to Match> <Root Path Folder to DL to>
|
# Usage: python download-patches-by-label.py <Label to Match> <Root Path Folder to DL to>
|
||||||
|
|
||||||
import requests, sys, json, urllib3.request, shutil, subprocess
|
import requests, sys, json, urllib3.request, shutil, subprocess, os
|
||||||
|
|
||||||
|
tagline = os.getenv("MergeTaglinePublic".upper(), "")
|
||||||
|
|
||||||
http = urllib3.PoolManager()
|
http = urllib3.PoolManager()
|
||||||
dl_list = {}
|
dl_list = {}
|
||||||
@ -23,6 +25,6 @@ try:
|
|||||||
print("Matched PR# %s" % pn)
|
print("Matched PR# %s" % pn)
|
||||||
print(subprocess.check_output(["git", "fetch", "https://github.com/yuzu-emu/yuzu.git", "pull/%s/head:pr-%s" % (pn, pn), "-f"]))
|
print(subprocess.check_output(["git", "fetch", "https://github.com/yuzu-emu/yuzu.git", "pull/%s/head:pr-%s" % (pn, pn), "-f"]))
|
||||||
print(subprocess.check_output(["git", "merge", "--squash", "pr-%s" % pn]))
|
print(subprocess.check_output(["git", "merge", "--squash", "pr-%s" % pn]))
|
||||||
print(subprocess.check_output(["git", "commit", "-m\"Merge PR %s\"" % pn]))
|
print(subprocess.check_output(["git", "commit", "-m\"Merge %s PR %s\"" % (tagline, pn)]))
|
||||||
except:
|
except:
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
47
.ci/templates/merge-private.yml
Normal file
47
.ci/templates/merge-private.yml
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
jobs:
|
||||||
|
- job: merge
|
||||||
|
displayName: 'pull requests'
|
||||||
|
steps:
|
||||||
|
- checkout: self
|
||||||
|
submodules: recursive
|
||||||
|
- template: ./mergebot-private.yml
|
||||||
|
parameters:
|
||||||
|
matchLabel: '$(BuildName)-merge'
|
||||||
|
matchLabelPublic: '$(PublicBuildName)-merge'
|
||||||
|
- task: ArchiveFiles@2
|
||||||
|
displayName: 'Package Source'
|
||||||
|
inputs:
|
||||||
|
rootFolderOrFile: '$(System.DefaultWorkingDirectory)'
|
||||||
|
includeRootFolder: false
|
||||||
|
archiveType: '7z'
|
||||||
|
archiveFile: '$(Build.ArtifactStagingDirectory)/yuzu-$(BuildName)-source.7z'
|
||||||
|
- task: PublishPipelineArtifact@1
|
||||||
|
displayName: 'Upload Artifacts'
|
||||||
|
inputs:
|
||||||
|
targetPath: '$(Build.ArtifactStagingDirectory)/yuzu-$(BuildName)-source.7z'
|
||||||
|
artifact: 'yuzu-$(BuildName)-source'
|
||||||
|
replaceExistingArchive: true
|
||||||
|
- job: upload_source
|
||||||
|
displayName: 'upload'
|
||||||
|
dependsOn: merge
|
||||||
|
steps:
|
||||||
|
- template: ./sync-source.yml
|
||||||
|
parameters:
|
||||||
|
artifactSource: 'true'
|
||||||
|
needSubmodules: 'true'
|
||||||
|
- script: chmod a+x $(System.DefaultWorkingDirectory)/.ci/scripts/merge/yuzubot-git-config.sh && $(System.DefaultWorkingDirectory)/.ci/scripts/merge/yuzubot-git-config.sh
|
||||||
|
displayName: 'Apply Git Configuration'
|
||||||
|
- script: git tag -a $(BuildName)-$(Build.BuildId) -m "yuzu $(BuildName) $(Build.BuildNumber) $(Build.DefinitionName)"
|
||||||
|
displayName: 'Tag Source'
|
||||||
|
- script: git remote add other $(GitRepoPushChangesURL)
|
||||||
|
displayName: 'Register Repository'
|
||||||
|
- script: git push --follow-tags --force other HEAD:$(GitPushBranch)
|
||||||
|
displayName: 'Update Code'
|
||||||
|
- script: git rev-list -n 1 $(BuildName)-$(Build.BuildId) > $(Build.ArtifactStagingDirectory)/tag-commit.sha
|
||||||
|
displayName: 'Calculate Release Point'
|
||||||
|
- task: PublishPipelineArtifact@1
|
||||||
|
displayName: 'Upload Release Point'
|
||||||
|
inputs:
|
||||||
|
targetPath: '$(Build.ArtifactStagingDirectory)/tag-commit.sha'
|
||||||
|
artifact: 'yuzu-$(BuildName)-release-point'
|
||||||
|
replaceExistingArchive: true
|
23
.ci/templates/mergebot-private.yml
Normal file
23
.ci/templates/mergebot-private.yml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
parameters:
|
||||||
|
matchLabel: 'dummy-merge'
|
||||||
|
matchLabelPublic: 'dummy-merge'
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- script: mkdir $(System.DefaultWorkingDirectory)/patches && pip install requests urllib3
|
||||||
|
displayName: 'Prepare Environment'
|
||||||
|
- script: chmod a+x $(System.DefaultWorkingDirectory)/.ci/scripts/merge/yuzubot-git-config.sh && $(System.DefaultWorkingDirectory)/.ci/scripts/merge/yuzubot-git-config.sh
|
||||||
|
displayName: 'Apply Git Configuration'
|
||||||
|
- task: PythonScript@0
|
||||||
|
displayName: 'Discover, Download, and Apply Patches'
|
||||||
|
inputs:
|
||||||
|
scriptSource: 'filePath'
|
||||||
|
scriptPath: '.ci/scripts/merge/apply-patches-by-label.py'
|
||||||
|
arguments: '${{ parameters.matchLabelPublic }} patches-public'
|
||||||
|
workingDirectory: '$(System.DefaultWorkingDirectory)'
|
||||||
|
- task: PythonScript@0
|
||||||
|
displayName: 'Discover, Download, and Apply Patches'
|
||||||
|
inputs:
|
||||||
|
scriptSource: 'filePath'
|
||||||
|
scriptPath: '.ci/scripts/merge/apply-patches-by-label-private.py'
|
||||||
|
arguments: '$(PrivateMergeUser) ${{ parameters.matchLabel }} patches-private'
|
||||||
|
workingDirectory: '$(System.DefaultWorkingDirectory)'
|
8
.ci/yuzu-patreon-step1.yml
Normal file
8
.ci/yuzu-patreon-step1.yml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
trigger:
|
||||||
|
- master
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- stage: merge
|
||||||
|
displayName: 'merge'
|
||||||
|
jobs:
|
||||||
|
- template: ./templates/merge-private.yml
|
28
.ci/yuzu-patreon-step2.yml
Normal file
28
.ci/yuzu-patreon-step2.yml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
trigger:
|
||||||
|
- master
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- stage: format
|
||||||
|
displayName: 'format'
|
||||||
|
jobs:
|
||||||
|
- job: format
|
||||||
|
displayName: 'clang'
|
||||||
|
pool:
|
||||||
|
vmImage: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- template: ./templates/format-check.yml
|
||||||
|
- stage: build
|
||||||
|
dependsOn: format
|
||||||
|
displayName: 'build'
|
||||||
|
jobs:
|
||||||
|
- template: ./templates/build-standard.yml
|
||||||
|
parameters:
|
||||||
|
cache: 'true'
|
||||||
|
- stage: release
|
||||||
|
displayName: 'release'
|
||||||
|
dependsOn: build
|
||||||
|
jobs:
|
||||||
|
- job: azure
|
||||||
|
displayName: 'azure'
|
||||||
|
steps:
|
||||||
|
- template: ./templates/release-universal.yml
|
@ -1,19 +0,0 @@
|
|||||||
# Starter pipeline
|
|
||||||
# Start with a minimal pipeline that you can customize to build and deploy your code.
|
|
||||||
# Add steps that build, run tests, deploy, and more:
|
|
||||||
# https://aka.ms/yaml
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
- master
|
|
||||||
|
|
||||||
pool:
|
|
||||||
vmImage: 'ubuntu-latest'
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- script: echo Hello, world!
|
|
||||||
displayName: 'Run a one-line script'
|
|
||||||
|
|
||||||
- script: |
|
|
||||||
echo Add other tasks to build, test, and deploy your project.
|
|
||||||
echo See https://aka.ms/yaml
|
|
||||||
displayName: 'Run a multi-line script'
|
|
Loading…
Reference in New Issue
Block a user