-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathazure-pipelines.yml
100 lines (83 loc) · 3.56 KB
/
azure-pipelines.yml
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
trigger:
- master
pool:
vmImage: 'vs2017-win2016'
variables:
status: 'fail'
steps:
- checkout: self
persistCredentials: "true"
- powershell: (new-object System.Net.WebClient).DownloadFile('http://www.nespowerpak.com/nesasm/NESASM3.zip','NESASM3.zip')
displayName: 'Download NESASM3 (NES assembler) for Windows'
- task: ExtractFiles@1
displayName: 'Extract NESASM3'
inputs:
archiveFilePatterns: NESASM3.zip
destinationFolder: NESASM3
- task: Bash@3
displayName: 'Add current date and time to NES game (source file)'
inputs:
targetType: 'inline'
script: |
current_date=`date +"%^b %d, %Y"`
current_time=`date +"%0l:%M %p"`
sed -i "s/.db \"... .., 20..\"/.db \"$current_date\"/" game/test.asm
sed -i "s/.db \"..:.. .M\"/.db \"$current_time\"/" game/test.asm
cat game/test.asm
- task: CmdLine@2
displayName: 'Assemble source file to create NES ROM'
inputs:
script: 'cd D:\a\1\s\game && D:\a\1\s\NESASM3\NESASM3.exe D:\a\1\s\game\test.asm'
- task: Bash@3
displayName: 'Check assembly status'
inputs:
targetType: 'inline'
script: |
result=$(cd D:/a/1/s/game && D:/a/1/s/NESASM3/NESASM3.exe D:/a/1/s/game/test.asm | grep error)
echo $result
echo "##vso[task.setvariable variable=status]$result"
- task: Bash@3
displayName: 'Fail build only if assembly fails'
inputs:
targetType: 'inline'
script: exit 1
condition: contains(variables['status'], 'error')
- powershell: (new-object System.Net.WebClient).DownloadFile('https://downloads.sourceforge.net/project/fceultra/Binaries/2.2.3/fceux-2.2.3-win32.zip?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Ffceultra%2Ffiles%2FBinaries%2F2.2.3%2Ffceux-2.2.3-win32.zip%2Fdownload&ts=1559878465','FCEUX.zip')
displayName: 'Download FCEUX (NES emulator) for Windows'
- task: ExtractFiles@1
displayName: 'Extract FCEUX'
inputs:
archiveFilePatterns: FCEUX.zip
destinationFolder: build/fceux
cleanDestinationFolder: false
- powershell: Start-Process D:\a\1\s\build\fceux\fceux.exe "-lua D:\a\1\s\build\screenshot.lua D:\a\1\s\game\test.nes"
displayName: 'Open NES ROM in FCEUX and run Lua script to take screenshot'
- task: Bash@3
displayName: 'Wait 10 seconds then confirm screenshot was created'
inputs:
targetType: 'inline'
script: sleep 10 && cd D:/a/1/s/build && ls && cat screenshot.png
- task: Bash@3
displayName: 'Configure git'
inputs:
targetType: 'inline'
script: git config user.email "[email protected]" && git config user.name "NES Build Pipeline"
- task: Bash@3
displayName: 'Remove NESASM3 and FCEUX from build folder'
inputs:
targetType: 'inline'
script: 'rm NESASM3.zip FCEUX.zip build/fceux/7z.dll build/fceux/auxlib.lua build/fceux/fceux.chm build/fceux/fceux.exe build/fceux/lua5.1.dll build/fceux/lua51.dll build/fceux/taseditor.chm && rm -rf build/fceux/luaScripts/ build/fceux/palettes/ build/fceux/tools/ NESASM3 && ls && cd build && ls'
- task: Bash@3
displayName: 'Update caption in README.md with date and time of update'
inputs:
targetType: 'inline'
script: |
current_date=`date +"%A, %B %d, %Y at %T"`
sed -i "6c<figcaption>Screenshot updated $current_date UTC+00:00.</figcaption>" readme.md
cat readme.md
- task: Bash@3
displayName: 'Commit changes and push ROM, ROM screenshot, and README back to GitHub repo (master branch)'
inputs:
targetType: 'inline'
script: cd D:/a/1/s/ && ls && git add --all && git commit -m "Adds latest ROM, screenshot, and README from build pipeline. [skip ci]" && git push origin HEAD:master
continueOnError: true