Merge pull request #2086 from spotify/rugvip/win

workflows: add Windows master build
This commit is contained in:
Patrik Oldsberg
2020-08-23 19:33:43 +02:00
committed by GitHub
3 changed files with 62 additions and 5 deletions
+47
View File
@@ -0,0 +1,47 @@
name: Master Build Windows
on:
push:
branches: [master]
jobs:
build:
runs-on: windows-latest
strategy:
matrix:
node-version: [12.x]
env:
CI: true
NODE_OPTIONS: --max-old-space-size=4096
steps:
- uses: actions/checkout@v2
- name: find location of global yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: cache global yarn cache
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: cache node_modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
- name: use node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org/ # Needed for auth
- name: yarn install
run: yarn install --frozen-lockfile
# Tests are broken on Windows, disabled for now
# - name: test
# run: yarn lerna -- run test
+1 -1
View File
@@ -1,4 +1,4 @@
name: Master Build
name: Main Master Build
on:
push:
+14 -4
View File
@@ -15,7 +15,11 @@
*/
import ts from 'typescript';
import { relative } from 'path';
import {
relative as relativePath,
sep as pathSep,
posix as posixPath,
} from 'path';
import {
ExportedInstance,
ApiDoc,
@@ -25,6 +29,12 @@ import {
TypeLink,
} from './types';
// Always use unix path separators for the relative file
// paths, since we'll be using those for HTTP URLs.
function relativeLink(basePath: string, filePath: string) {
return relativePath(basePath, filePath).split(pathSep).join(posixPath.sep);
}
/**
* The ApiDocGenerator uses the typescript compiler API to build the data structure that
* describes a Backstage API and all of it's related types.
@@ -58,7 +68,7 @@ export default class ApiDocGenerator {
const id = this.getObjectPropertyLiteral(info, 'id');
const description = this.getObjectPropertyLiteral(info, 'description');
const file = relative(this.basePath, source.fileName);
const file = relativeLink(this.basePath, source.fileName);
const { line } = source.getLineAndCharacterOfPosition(
apiInstance.node.getStart(),
);
@@ -111,7 +121,7 @@ export default class ApiDocGenerator {
const name = (type.aliasSymbol || type.symbol).name;
const [declaration] = (type.aliasSymbol || type.symbol).declarations;
const sourceFile = declaration.getSourceFile();
const file = relative(this.basePath, sourceFile.fileName);
const file = relativeLink(this.basePath, sourceFile.fileName);
const { line } = sourceFile.getLineAndCharacterOfPosition(
declaration.getStart(),
);
@@ -234,7 +244,7 @@ export default class ApiDocGenerator {
const { line } = sourceFile.getLineAndCharacterOfPosition(
declaration.getStart(),
);
const file = relative(this.basePath, sourceFile.fileName);
const file = relativeLink(this.basePath, sourceFile.fileName);
const typeInfo = {
id: (symbol as any).id,
name: symbol.name,