Skip to content

Commit

Permalink
test new linux version string
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyberbeni committed Oct 9, 2020
1 parent 1d75ecc commit df7dc5b
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
os: [ubuntu-18.04, ubuntu-20.04, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
Expand Down
4 changes: 3 additions & 1 deletion __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import { exec } from '../src/helpers'
// const url = 'https://github.com/realm/SwiftLint'

test('Local test', async() => {
const osVersion = `${os.type()}-${os.release()}`
console.log(osVersion)
const swiftVersion = await exec('swift', ['-version'])
let additionalInfo = `${os.version()}-${swiftVersion}`
let additionalInfo = `${osVersion}-${swiftVersion}`
if (os.platform() == "darwin") {
let macVersion = await exec('sw_vers', ['-productVersion'])
if (semver.gte(macVersion, "10.14.4")) {
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

31 changes: 23 additions & 8 deletions lib/helpers.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 22 additions & 8 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,28 @@ export async function exec(commandLine: string, args?: string[]): Promise<string
}

export async function getUuid(url: string, commitHash: string): Promise<string> {
const osVersion = await exec('uname', ['-v']) // os.version is somehow undefined on GitHub runner
const swiftVersion = await exec('swift', ['-version'])
let additionalInfo = `${osVersion}-${swiftVersion}`
core.info(additionalInfo)
if (os.platform() == "darwin") {
let macVersion = await exec('sw_vers', ['-productVersion'])
if (semver.gte(macVersion, "10.14.4")) {
additionalInfo = `macos-${os.arch()}`
let additionalInfo: string
switch (os.platform()) {
case "darwin": {
let macVersion = await exec('sw_vers', ['-productVersion'])
if (semver.gte(macVersion, "10.14.4")) {
additionalInfo = `macos-${os.arch()}`
} else {
additionalInfo = `macos-embed-swift-${os.arch()}`
}
break
}
case "linux": {
const osCodename = await exec('lsb_release', ['-c'])
const kernelVersion = os.release()
const swiftVersion = await exec('swift', ['-version'])
additionalInfo = `${osCodename}-${kernelVersion}-${swiftVersion}`
break
}
default: {
const osVersion = await exec('uname', ['-v']) // os.version is somehow undefined on GitHub runner
const swiftVersion = await exec('swift', ['-version'])
additionalInfo = `${osVersion}-${swiftVersion}`
}
}
core.info(additionalInfo)
Expand Down

0 comments on commit df7dc5b

Please sign in to comment.