blob: 86bc75141ed37b6492c68a980598ed4408bb36a0 (
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
name: Windows
on:
pull_request:
push:
release:
types: [published]
jobs:
build:
strategy:
matrix:
os: [windows-2019, windows-2022]
arch: [x64, x86]
runs-on: ${{ matrix.os }}
concurrency:
group: ${{ github.ref }}-${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.os }}-${{ matrix.arch }}-Windows
cancel-in-progress: true
steps:
- uses: actions/checkout@v2
with:
# WyriHaximus/github-action-get-previous-tag@master need it
fetch-depth: 0
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: dlang-community/setup-dlang@v1
with:
compiler: dmd-latest
- uses: little-core-labs/[email protected]
id: tagName
# Force xmake to a specific folder (for cache)
- name: Set xmake package cache path
run: echo "XMAKE_PKG_CACHEDIR=$(pwd)/xmake-cache" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# Cache xmake dependencies
- name: Retrieve xmake cache for packages
uses: actions/cache@v2
with:
path: xmake-cache
key: ${{ matrix.os }}-${{ matrix.arch }}
- name: Prepare
run: |
xmake show
curl -fsSL "https://github.com/xmake-mirror/nsis/releases/download/v30b3/nsis-3.04.zip" -o ./nsis.zip
curl -fsSL "https://github.com/xmake-mirror/nsis/releases/download/v30b3/nsis-3.04-strlen_8192.zip" -o ./nsis-longstr.zip
curl -fsSL "https://github.com/xmake-mirror/nsis/releases/download/v30b3/UAC.zip" -o ./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/
- name: Build
run: |
cd core
xmake f -vD -a ${{ matrix.arch }}
xmake -vD
cd ..
- name: Tests
run: |
Copy-Item ./core/build/xmake.exe ./xmake
Copy-Item ./scripts/xrepo.bat ./xmake
Copy-Item ./scripts/xrepo.ps1 ./xmake
$Env:XMAKE_MAIN_REPO = "https://github.com/xmake-io/xmake-repo.git"
$Env:XMAKE_PROGRAM_DIR = $(Resolve-Path ./xmake)
Set-Item -Path Env:Path -Value ($Env:XMAKE_PROGRAM_DIR + ";" + $Env:Path)
xrepo --version
xmake show
#xmake l -v private.utils.bcsave --rootname='@programdir' -x 'scripts/**|templates/**' xmake
xmake lua -v -D tests/run.lua
- name: Set release arch name
run: |
if ("${{ matrix.arch }}" -eq "x64") {
Write-Output "RELEASE_NAME=win64" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf-8 -Append
} else {
Write-Output "RELEASE_NAME=win32" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf-8 -Append
}
- name: Artifact
run: |
# build installer
(New-Item ./winenv/bin -ItemType Directory).FullName
curl -fsSL "https://github.com/xmake-mirror/7zip/releases/download/19.00/7z19.00-${{ matrix.arch }}.zip" -o .\7zip.zip
Expand-Archive ./7zip.zip -DestinationPath ./7zip
Copy-Item ./7zip/7z.exe ./winenv/bin
Copy-Item ./7zip/7z.dll ./winenv/bin
curl -fsSL "https://curl.se/windows/dl-8.2.1_11/curl-8.2.1_11-win32-mingw.zip" -o .\curl.zip
Expand-Archive ./curl.zip -DestinationPath ./curl
Copy-Item ./curl/curl-8.2.1_11-win32-mingw/bin/curl.exe ./winenv/bin
Copy-Item ./curl/curl-8.2.1_11-win32-mingw/bin/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
# 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-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
# upload artifacts to latest release
- name: Inject slug/short variables
uses: rlespinasse/[email protected]
- name: Get Previous tag
id: previoustag
uses: WyriHaximus/github-action-get-previous-tag@master
- name: Upload artifacts to lastest release
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifacts/${{env.RELEASE_NAME}}/xmake.exe
asset_name: xmake-${{ env.GITHUB_REF_SLUG }}.${{ env.RELEASE_NAME }}.exe
tag: ${{ steps.previoustag.outputs.tag }}
overwrite: true
- name: Upload artifacts to lastest release
if: github.ref == 'refs/heads/master'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifacts/${{env.RELEASE_NAME}}/archive.zip
asset_name: xmake-${{ env.GITHUB_REF_SLUG }}.${{ env.RELEASE_NAME }}.zip
tag: ${{ steps.previoustag.outputs.tag }}
overwrite: true
# 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}}/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
|