build windows dists in circle-ci

This commit is contained in:
Evgeny Kochetkov
2021-01-22 19:32:36 +03:00
parent 6de52b496e
commit 24a7f8ff44
5 changed files with 49 additions and 103 deletions

View File

@@ -58,6 +58,14 @@ defs:
&& mkdir "/tmp/arduino-cli" \
&& cp "$HOME/arduino-cli" "/tmp/arduino-cli/arduino-cli"
step-install-arduino-cli-on-windows: &step-install-arduino-cli-on-windows
name: Install arduino-cli
command: |
curl -L -s --create-dirs -o "$HOME/arduino-cli.zip" "https://github.com/arduino/arduino-cli/releases/download/0.12.0/arduino-cli_0.12.0_Windows_64bit.zip" \
&& unzip "$HOME/arduino-cli.zip" -d "$HOME" \
&& cp "$HOME/arduino-cli.exe" "./packages/xod-client-electron/arduino-cli.exe"
shell: bash
step-install: &step-install
name: Install Node modules
# to always instal some essential tools(electron-builder etc)
@@ -156,16 +164,13 @@ jobs:
command: git config --global core.autocrlf input
- run:
command: git config --system core.longpaths true
- checkout
- run:
name: Install yarn
command: npm install yarn@1.22.10 -g
- checkout
- run:
name: Install Node modules
command: yarn
- run:
name: Install Node modules
command: yarn build
- run: *step-build
- run:
name: Verify that previous step made no side-effects
@@ -257,6 +262,41 @@ jobs:
- "*.dmg"
- "*.zip"
dist-windows:
executor:
name: win/default
steps:
- run:
command: git config --global core.autocrlf input
- run:
command: git config --system core.longpaths true
- checkout
- run:
name: Install yarn
command: npm install yarn@1.22.10 -g
- run: *step-install-arduino-cli-on-windows
- run:
name: Install Node modules
command: yarn
- run:
name: Bump version
command: |
if [[ $CIRCLE_BRANCH =~ ^prerelease-(patch|minor)- ]]; then
yarn lerna publish --skip-git --skip-npm --canary --cd-version ${BASH_REMATCH[1]} --yes
fi
shell: bash
- run:
name: Build electron IDE distro
command: NODE_ENV=production yarn build:electron && yarn dist:electron
shell: bash
no_output_timeout: 30m
- persist_to_workspace:
root: packages/xod-client-electron/dist
paths:
- latest.yml
- "*.exe"
- "*.blockmap"
#--------------------------------------------------------------------
# Upload distros job
#--------------------------------------------------------------------
@@ -366,11 +406,15 @@ workflows:
filters: *release-filters
- dist-macos:
filters: *release-filters
- dist-windows:
filters: *release-filters
- upload-distros:
filters: *release-filters
requires:
- verify-linux
- verify-macos
- verify-windows
- test-cpp
- dist-linux
- dist-macos
- dist-macos
- dist-windows

View File

@@ -1,29 +0,0 @@
image: Visual Studio 2017
version: '{build}'
platform:
- x64
clone_depth: 5
cache:
- '%LOCALAPPDATA%\Yarn'
- '%USERPROFILE%\.electron'
- node_modules
init:
- git config --global core.autocrlf input
- git config --system core.longpaths true
install:
- ps: Install-Product node 12 x64
- npm install yarn@1.22.10 -g
- yarn cache clean
- yarn install --force
- ps: . .\tools\install-arduinocli.ps1
build_script:
- yarn run build
- ps: . .\tools\appveyor.ps1
test: off

View File

@@ -1,33 +0,0 @@
function Upload-Dist-To-GCS($tag) {
$config = New-TemporaryFile
echo $env:GOOGLE_CLOUD_STORAGE_CONFIG | node -e "console.log(new Buffer ('$env:GOOGLE_CLOUD_STORAGE_CONFIG', 'base64').toString('utf8').trim())" > $config
(Get-Content -Path $config) | %{ $_.Replace("\xEF\xBB\xBF", "") } | Set-Content -Path $config
foreach ($file in (Get-ChildItem -Path packages/xod-client-electron/dist -File)) {
node tools/electron-upload.js --config=$($config.FullName) --file=$($file.FullName) --tag=$tag
}
}
function Build-Dist() {
# Build again with production settings for the UI part of the IDE
$env:NODE_ENV="production"
yarn run build:electron
yarn run dist:electron
}
$tags=(git tag --points-at $env:APPVEYOR_REPO_COMMIT)
if ($tags) {
Build-Dist
foreach ($tag in $tags) {
Upload-Dist-To-GCS $tag
}
}
if ($env:APPVEYOR_REPO_BRANCH -match '^prerelease-(patch|minor)-') {
Write-Host 'Building prerelease distributive...' -ForegroundColor Yellow
yarn lerna publish --skip-git --skip-npm --canary --cd-version $Matches[1] --yes
$tag=(node -e "console.log('v' + require('./packages/xod-client-electron/package.json').version)")
Build-Dist
Upload-Dist-To-GCS $tag
}

View File

@@ -1,29 +0,0 @@
// eslint-disable-next-line import/no-extraneous-dependencies
const docopt = require('docopt');
const path = require('path');
const storage = require('@google-cloud/storage');
const options = docopt.docopt(`
Uploads a release file to 'releases.xod.io' GCS bucket under tag directory.
Usage: electron-upload --config=<path-to-config> --file=<path-to-file> --tag=<tag>
`);
const resolve = path.resolve.bind(path, process.cwd());
const keyFilename = resolve(options['--config']);
const file = resolve(options['--file']);
const tag = options['--tag'];
const basename = path.basename(file);
storage({ keyFilename })
.bucket('releases.xod.io')
.upload(file, {
destination: `${tag}/${basename}`,
metadata: {
contentDisposition: `attachment; filename="${basename}"`,
},
public: true,
})
.catch(error => {
// eslint-disable-next-line no-console
console.error(error);
process.exit(1);
});

View File

@@ -1,7 +0,0 @@
# Install arduino-cli
Invoke-RestMethod -Uri "https://github.com/arduino/arduino-cli/releases/download/0.12.0/arduino-cli_0.12.0_Windows_64bit.zip" -Method GET -OutFile "$env:HOME/arduino-cli.zip"
unzip "$env:HOME/arduino-cli.zip" -d "$env:HOME"
copy "$env:HOME/arduino-cli.exe" "./packages/xod-client-electron/arduino-cli.exe"
$env:XOD_ARDUINO_CLI="$env:HOME/arduino-cli.exe"