download dev from github releases

fix ci

remove unused import

fix releases
This commit is contained in:
ruki
2021-07-16 22:37:18 +08:00
committed by Opportunity
Unverified
parent 2f05f7c4ad
commit b126f6b6d1
6 changed files with 30 additions and 22 deletions
+2 -1
View File
@@ -8,7 +8,7 @@ jobs:
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, windows-latest, macOS-latest] os: [ubuntu-latest, windows-latest, macOS-latest]
version: [latest, branch@master] version: [latest, branch@master, branch@dev]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@@ -19,6 +19,7 @@ jobs:
xmake-version: ${{ matrix.version }} xmake-version: ${{ matrix.version }}
- name: Run tests - name: Run tests
run: | run: |
xmake --version
xmake create -P test xmake create -P test
xmake build -P test xmake build -P test
xmake run -P test xmake run -P test
+6 -3
View File
@@ -9,10 +9,13 @@ const unix_install_1 = require("./unix-install");
async function run() { async function run() {
try { try {
const version = await versions_1.selectVersion(); const version = await versions_1.selectVersion();
if (os.platform() === 'win32' || os.platform() === 'cygwin') if (os.platform() === 'win32' || os.platform() === 'cygwin') {
await win_install_1.winInstall(version); const latest = await versions_1.selectVersion('latest');
else await win_install_1.winInstall(version, latest);
}
else {
await unix_install_1.unixInstall(version); await unix_install_1.unixInstall(version);
}
await exec_1.exec('xmake --version'); await exec_1.exec('xmake --version');
} }
catch (error) { catch (error) {
+7 -6
View File
@@ -8,12 +8,13 @@ const toolCache = require("@actions/tool-cache");
const os = require("os"); const os = require("os");
const path = require("path"); const path = require("path");
const semver = require("semver"); const semver = require("semver");
function getInstallerUrl(version) { function getInstallerUrl(version, latest) {
const ver = version.version; const ver = version.version;
switch (version.type) { switch (version.type) {
case 'heads': { case 'heads': {
const arch = os.arch() === 'x64' ? 'x64' : 'x86'; const arch = os.arch() === 'x64' ? 'win64' : 'win32';
return `https://ci.appveyor.com/api/projects/waruqi/xmake/artifacts/xmake-installer.exe?branch=${ver}&pr=false&job=Image%3A+Visual+Studio+2017%3B+Platform%3A+${arch}`; const latestver = latest.version;
return `https://github.com/xmake-io/xmake/releases/download/${latestver}/xmake-${ver}.${arch}.exe`;
} }
case 'pull': { case 'pull': {
throw new Error('PR builds for windows is not supported'); throw new Error('PR builds for windows is not supported');
@@ -33,15 +34,15 @@ function getInstallerUrl(version) {
} }
} }
} }
async function winInstall(version) { async function winInstall(version, latest) {
if (version.type === 'local') { if (version.type === 'local' || latest.type == 'local') {
throw new Error('Local builds for windows is not supported'); throw new Error('Local builds for windows is not supported');
} }
const ver = version.version; const ver = version.version;
let toolDir = toolCache.find('xmake', ver); let toolDir = toolCache.find('xmake', ver);
if (!toolDir) { if (!toolDir) {
const installer = await core.group(`download xmake ${String(version)}`, async () => { const installer = await core.group(`download xmake ${String(version)}`, async () => {
const url = getInstallerUrl(version); const url = getInstallerUrl(version, latest);
core.info(`downloading from ${url}`); core.info(`downloading from ${url}`);
const file = await toolCache.downloadTool(url); const file = await toolCache.downloadTool(url);
const exe = path.format({ const exe = path.format({
+2 -2
View File
@@ -1,5 +1,5 @@
{ {
"systemParams": "win32-x64-83", "systemParams": "darwin-x64-83",
"modulesFolders": [ "modulesFolders": [
"node_modules" "node_modules"
], ],
@@ -718,7 +718,7 @@
"wrap-ansi@^6.2.0": "https://registry.npm.taobao.org/wrap-ansi/download/wrap-ansi-6.2.0.tgz?cache=0&sync_timestamp=1618558913931&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fwrap-ansi%2Fdownload%2Fwrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53", "wrap-ansi@^6.2.0": "https://registry.npm.taobao.org/wrap-ansi/download/wrap-ansi-6.2.0.tgz?cache=0&sync_timestamp=1618558913931&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fwrap-ansi%2Fdownload%2Fwrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53",
"wrappy@1": "https://registry.nlark.com/wrappy/download/wrappy-1.0.2.tgz?cache=0&sync_timestamp=1619133505879&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fwrappy%2Fdownload%2Fwrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f", "wrappy@1": "https://registry.nlark.com/wrappy/download/wrappy-1.0.2.tgz?cache=0&sync_timestamp=1619133505879&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fwrappy%2Fdownload%2Fwrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f",
"write-file-atomic@^3.0.0": "https://registry.npm.taobao.org/write-file-atomic/download/write-file-atomic-3.0.3.tgz#56bd5c5a5c70481cd19c571bd39ab965a5de56e8", "write-file-atomic@^3.0.0": "https://registry.npm.taobao.org/write-file-atomic/download/write-file-atomic-3.0.3.tgz#56bd5c5a5c70481cd19c571bd39ab965a5de56e8",
"ws@^7.4.4": "https://registry.npm.taobao.org/ws/download/ws-7.4.5.tgz#a484dd851e9beb6fdb420027e3885e8ce48986c1", "ws@^7.4.4": "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c",
"xml-name-validator@^3.0.0": "https://registry.npm.taobao.org/xml-name-validator/download/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a", "xml-name-validator@^3.0.0": "https://registry.npm.taobao.org/xml-name-validator/download/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a",
"xmlchars@^2.2.0": "https://registry.npm.taobao.org/xmlchars/download/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb", "xmlchars@^2.2.0": "https://registry.npm.taobao.org/xmlchars/download/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb",
"y18n@^4.0.0": "https://registry.npm.taobao.org/y18n/download/y18n-4.0.3.tgz?cache=0&sync_timestamp=1617822642544&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fy18n%2Fdownload%2Fy18n-4.0.3.tgz#b5f259c82cd6e336921efd7bfd8bf560de9eeedf", "y18n@^4.0.0": "https://registry.npm.taobao.org/y18n/download/y18n-4.0.3.tgz?cache=0&sync_timestamp=1617822642544&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fy18n%2Fdownload%2Fy18n-4.0.3.tgz#b5f259c82cd6e336921efd7bfd8bf560de9eeedf",
+6 -2
View File
@@ -8,8 +8,12 @@ import { unixInstall } from './unix-install';
async function run(): Promise<void> { async function run(): Promise<void> {
try { try {
const version = await selectVersion(); const version = await selectVersion();
if (os.platform() === 'win32' || os.platform() === 'cygwin') await winInstall(version); if (os.platform() === 'win32' || os.platform() === 'cygwin') {
else await unixInstall(version); const latest = await selectVersion('latest');
await winInstall(version, latest);
} else {
await unixInstall(version);
}
await exec('xmake --version'); await exec('xmake --version');
} catch (error) { } catch (error) {
const ex = error as Error; const ex = error as Error;
+7 -8
View File
@@ -7,13 +7,13 @@ import * as path from 'path';
import * as semver from 'semver'; import * as semver from 'semver';
import { Version, GitVersion } from './interfaces'; import { Version, GitVersion } from './interfaces';
function getInstallerUrl(version: GitVersion): string { function getInstallerUrl(version: GitVersion, latest: GitVersion): string {
const ver = version.version; const ver = version.version;
switch (version.type) { switch (version.type) {
case 'heads': { case 'heads': {
// we only use appveyor ci artifacts for branch version const arch = os.arch() === 'x64' ? 'win64' : 'win32';
const arch = os.arch() === 'x64' ? 'x64' : 'x86'; const latestver = latest.version;
return `https://ci.appveyor.com/api/projects/waruqi/xmake/artifacts/xmake-installer.exe?branch=${ver}&pr=false&job=Image%3A+Visual+Studio+2017%3B+Platform%3A+${arch}`; return `https://github.com/xmake-io/xmake/releases/download/${latestver}/xmake-${ver}.${arch}.exe`;
} }
case 'pull': { case 'pull': {
throw new Error('PR builds for windows is not supported'); throw new Error('PR builds for windows is not supported');
@@ -22,7 +22,6 @@ function getInstallerUrl(version: GitVersion): string {
throw new Error('Sha builds for windows is not supported'); throw new Error('Sha builds for windows is not supported');
} }
case 'tags': { case 'tags': {
// we cannot use appveyor ci artifacts, the old version links may be broken.
const arch = os.arch() === 'x64' ? 'win64' : 'win32'; const arch = os.arch() === 'x64' ? 'win64' : 'win32';
return semver.gt(ver, '2.2.6') return semver.gt(ver, '2.2.6')
? `https://github.com/xmake-io/xmake/releases/download/${ver}/xmake-${ver}.${arch}.exe` ? `https://github.com/xmake-io/xmake/releases/download/${ver}/xmake-${ver}.${arch}.exe`
@@ -36,15 +35,15 @@ function getInstallerUrl(version: GitVersion): string {
} }
} }
export async function winInstall(version: Version): Promise<void> { export async function winInstall(version: Version, latest: Version): Promise<void> {
if (version.type === 'local') { if (version.type === 'local' || latest.type == 'local') {
throw new Error('Local builds for windows is not supported'); throw new Error('Local builds for windows is not supported');
} }
const ver = version.version; const ver = version.version;
let toolDir = toolCache.find('xmake', ver); let toolDir = toolCache.find('xmake', ver);
if (!toolDir) { if (!toolDir) {
const installer = await core.group(`download xmake ${String(version)}`, async () => { const installer = await core.group(`download xmake ${String(version)}`, async () => {
const url = getInstallerUrl(version); const url = getInstallerUrl(version, latest);
core.info(`downloading from ${url}`); core.info(`downloading from ${url}`);
const file = await toolCache.downloadTool(url); const file = await toolCache.downloadTool(url);
const exe = path.format({ const exe = path.format({