blob: 2872a505432e42cfbc56b8d758f329b89e1bfb3a (
plain)
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
|
name: Windows
on:
pull_request:
push:
release:
types: [published]
jobs:
build:
strategy:
matrix:
arch: [x64, x86]
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: xmake-io/github-action-setup-xmake@v1
with:
# this is not supported, use dev branch instead
# xmake-version: local#
xmake-version: branch@dev
- uses: mihails-strasuns/[email protected]
with:
compiler: dmd-latest
- uses: olegtarasov/get-tag@v2
id: tagName
# prepare
- name: prepare
run: |
# xmake
xmake show
# nsis
Invoke-WebRequest "https://github.com/xmake-mirror/nsis/releases/download/v30b3/nsis-3.04.zip" -UseBasicParsing -OutFile ./nsis.zip
Invoke-WebRequest "https://github.com/xmake-mirror/nsis/releases/download/v30b3/nsis-3.04-strlen_8192.zip" -UseBasicParsing -OutFile ./nsis-longstr.zip
Invoke-WebRequest "https://github.com/xmake-mirror/nsis/releases/download/v30b3/UAC.zip" -UseBasicParsing -OutFile ./nsis-uac.zip
Expand-Archive ./nsis.zip -DestinationPath ./nsis
Move-Item ./nsis/*/* ./nsis
Expand-Archive ./nsis-longstr.zip -DestinationPath ./nsis -Force
Expand-Archive ./nsis-uac.zip -DestinationPath ./nsis -Force
Move-Item ./nsis/UAC.nsh ./nsis/Include/
# build
- name: build
run: |
xmake f -vD -P core -a ${{ matrix.arch }}
xmake -vD -P core
# tests
- name: tests
run: |
Copy-Item ./core/build/xmake.exe ./xmake
$Env:XMAKE_PROGRAM_DIR = $(Resolve-Path ./xmake)
Set-Item -Path Env:Path -Value ($Env:XMAKE_PROGRAM_DIR + ";" + $Env:Path)
xmake show
xmake l -v private.utils.bcsave --rootname='@programdir' -x 'scripts/**|templates/**' xmake
xmake lua -v -D tests/run.lua
# build artifacts
- name: set release arch name
run: |
if ("${{ matrix.arch }}" -eq "x64"){
echo "::set-env name=RELEASE_NAME::win64"
} else {
echo "::set-env name=RELEASE_NAME::win32"
}
- name: artifact
run: |
# build installer
(New-Item ./winenv/bin -ItemType Directory).FullName
Invoke-WebRequest "https://github.com/xmake-mirror/gnuwin32-unzip/releases/download/5.51.1/unzip-5.51-1-bin.zip" -UseBasicParsing -OutFile .\unzip.zip
Expand-Archive ./unzip.zip -DestinationPath ./unzip
Copy-Item ./unzip/bin/unzip.exe ./winenv/bin
Invoke-WebRequest "https://github.com/xmake-io/xmake-win64env/raw/master/bin/curl.exe" -UseBasicParsing -OutFile .\curl.exe
Invoke-WebRequest "https://raw.githubusercontent.com/xmake-io/xmake-win64env/master/bin/curl-ca-bundle.crt" -UseBasicParsing -OutFile .\curl-ca-bundle.crt
Copy-Item ./curl.exe ./winenv/bin
Copy-Item ./curl-ca-bundle.crt ./winenv/bin
$version = (Get-Command xmake/xmake.exe).FileVersionInfo
./nsis/makensis.exe /DMAJOR=$($version.ProductMajorPart) /DMINOR=$($version.ProductMinorPart) /DALTER=$($version.ProductBuildPart) /DBUILD=$($($version.ProductVersion -split '\+')[1]) /D${{ matrix.arch }} .\scripts\installer.nsi
(New-Item ./artifacts/${{env.RELEASE_NAME}} -ItemType Directory).FullName
Copy-Item scripts/xmake.exe ./artifacts/${{env.RELEASE_NAME}}/xmake.exe
# build installer for tinyc
if ("${{ matrix.arch }}" -eq "x64"){
Invoke-WebRequest "http://download.savannah.gnu.org/releases/tinycc/tcc-0.9.27-win64-bin.zip" -UseBasicParsing -OutFile .\tcc.zip
} else {
Invoke-WebRequest "http://download.savannah.gnu.org/releases/tinycc/tcc-0.9.27-win32-bin.zip" -UseBasicParsing -OutFile .\tcc.zip
}
Expand-Archive ./tcc.zip -DestinationPath ./tcc
Copy-Item ./tcc/tcc ./winenv/tcc -Recurse
Invoke-WebRequest "http://download.savannah.gnu.org/releases/tinycc/winapi-full-for-0.9.27.zip" -UseBasicParsing -OutFile .\winapi.zip
Expand-Archive ./winapi.zip -DestinationPath ./winapi
Copy-Item ./winapi/winapi-full-for-0.9.27 ./winenv/tcc/winapi -Recurse
./nsis/makensis.exe /DMAJOR=$($version.ProductMajorPart) /DMINOR=$($version.ProductMinorPart) /DALTER=$($version.ProductBuildPart) /DBUILD=$($($version.ProductVersion -split '\+')[1]) /D${{ matrix.arch }} .\scripts\installer.nsi
Copy-Item scripts/xmake.exe ./artifacts/${{env.RELEASE_NAME}}/xmake-tinyc.exe
Remove-Item ./winenv/tcc -Recurse
Remove-Item ./scripts/xmake.exe
# archive
Copy-Item ./*.md ./xmake
Copy-Item ./winenv ./xmake -Recurse
Add-Type -AssemblyName System.Text.Encoding
Add-Type -AssemblyName System.IO.Compression.FileSystem
class FixedEncoder : System.Text.UTF8Encoding {
FixedEncoder() : base($true) { }
[byte[]] GetBytes([string] $s)
{
$s = $s.Replace("\", "/")
return ([System.Text.UTF8Encoding]$this).GetBytes($s)
}
}
Copy-Item ./xmake ./archive/xmake -Recurse
[System.IO.Compression.ZipFile]::CreateFromDirectory("$PWD\archive", "$PWD\archive.zip", [System.IO.Compression.CompressionLevel]::Optimal, $false, [FixedEncoder]::new())
(Get-FileHash .\archive.zip -Algorithm SHA256).Hash.ToLower() + " *xmake.zip`n" | Out-File ./shafile -Encoding ASCII -NoNewLine -Append
Copy-Item archive.zip ./artifacts/${{env.RELEASE_NAME}}
Copy-Item shafile ./artifacts/${{env.RELEASE_NAME}}
# upload artifacts
- uses: actions/upload-artifact@v2
with:
name: xmake-latest.${{env.RELEASE_NAME}}.exe
path: artifacts/${{env.RELEASE_NAME}}/xmake.exe
- uses: actions/upload-artifact@v2
with:
name: xmake-tinyc-latest.${{env.RELEASE_NAME}}.exe
path: artifacts/${{env.RELEASE_NAME}}/xmake-tinyc.exe
- uses: actions/upload-artifact@v2
with:
name: xmake-latest.${{ env.RELEASE_NAME }}.zip
path: artifacts/${{env.RELEASE_NAME}}/archive.zip
- uses: actions/upload-artifact@v2
with:
name: xmake-latest.${{ env.RELEASE_NAME }}.sha256
path: artifacts/${{env.RELEASE_NAME}}/shafile
# publish release
- name: publish
if: github.event.action == 'published'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: artifacts/${{env.RELEASE_NAME}}/xmake.exe
asset_name: xmake-${{ steps.tagName.outputs.tag }}.${{ env.RELEASE_NAME }}.exe
asset_content_type: application/zip
- name: publish
if: github.event.action == 'published'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: artifacts/${{env.RELEASE_NAME}}/xmake-tinyc.exe
asset_name: xmake-tinyc-${{ steps.tagName.outputs.tag }}.${{ env.RELEASE_NAME }}.exe
asset_content_type: application/zip
- name: publish
if: github.event.action == 'published'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: artifacts/${{env.RELEASE_NAME}}/archive.zip
asset_name: xmake-${{ steps.tagName.outputs.tag }}.${{ env.RELEASE_NAME }}.zip
asset_content_type: application/zip
- name: publish
if: github.event.action == 'published'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: artifacts/${{env.RELEASE_NAME}}/shafile
asset_name: xmake-${{ steps.tagName.outputs.tag }}.${{ env.RELEASE_NAME }}.sha256
asset_content_type: application/zip
|