Skip to content

Commit

Permalink
Change default branch to main (#9)
Browse files Browse the repository at this point in the history
* change ci/cd branch to main

* Modify README

* remove linux support on test

* remove Trailing spaces

* fix syntax error in workflow

* upgrade fwal/[email protected] version

* use SwiftEnv

* work with workflow

* work with workflow

* sync

* remove xcode version

* remove xcode version

* remove duplicate swift version
  • Loading branch information
sboh1214 authored Oct 6, 2020
1 parent 00dd970 commit b901d5e
Show file tree
Hide file tree
Showing 12 changed files with 76 additions and 67 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/Coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Coverage
on:
push:
branches:
- master
- main

jobs:
coverage:
Expand All @@ -20,6 +20,5 @@ jobs:
run: xcrun llvm-cov export -format="lcov" .build/debug/HwpKitPackageTests.xctest/Contents/MacOS/HwpKitPackageTests -instr-profile .build/debug/codecov/default.profdata > info.lcov
- name: Upload to Codecov
run: bash <(curl https://codecov.io/bash)
env:
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

2 changes: 1 addition & 1 deletion .github/workflows/Documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Documentation
on:
push:
branches:
- master
- main

jobs:
documentation:
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/Lint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: Lint

on: [ push, pull_request ]
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
lint:
Expand Down
25 changes: 16 additions & 9 deletions .github/workflows/Test.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
name: Test

on: [ push, pull_request ]
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test:
name: Test on ${{ matrix.os }} and swift ${{ matrix.swift }}
runs-on: ${{ matrix.os }}
name: Test on Xcode ${{ matrix.xcode }}
runs-on: macos-latest
strategy:
matrix:
os: [macOS-latest]
swift: ["5.1", "5.2"]
xcode: ["11.7", "11.3.1"]

steps:
- uses: actions/checkout@v2
- name: Setup Swift
uses: fwal/[email protected]
with:
swift-version: ${{ matrix.swift }}
- name: Set Xcode version
run: |
sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app/
export TOOLCHAINS=swift
- name: Get Swift version
run: swift --version
- name: Build
run: swift build -v
- name: Run tests
Expand Down
38 changes: 34 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,47 @@
![Coverage](https://github.com/sboh1214/HwpKit/workflows/Coverage/badge.svg)
![Documentation](https://github.com/sboh1214/HwpKit/workflows/Documentation/badge.svg)
![Lint](https://github.com/sboh1214/HwpKit/workflows/Lint/badge.svg)
[![codecov](https://codecov.io/gh/sboh1214/HwpKit/branch/master/graph/badge.svg)](https://codecov.io/gh/sboh1214/HwpKit)

[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=sboh1214_HwpKit&metric=alert_status)](https://sonarcloud.io/dashboard?id=sboh1214_HwpKit)
[![CodeFactor](https://www.codefactor.io/repository/github/sboh1214/hwpkit/badge)](https://www.codefactor.io/repository/github/sboh1214/hwpkit)

Swift Package for Reading & Writing HWP File

## Install

### Swift Package Manager

Go to ```File``` > ```Swift Packages``` > ```Add Package Dependency...``` in Xcode.

Or add dependency manually.
```swift
dependencies: [
.package(url: "https://github.com/sboh1214/HwpKit.git", .branch("main")),
],
```

## Contribute

[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=sboh1214_HwpKit&metric=ncloc)](https://sonarcloud.io/dashboard?id=sboh1214_HwpKit)

### Code Quality

[![codecov](https://codecov.io/gh/sboh1214/HwpKit/branch/master/graph/badge.svg)](https://codecov.io/gh/sboh1214/HwpKit)
[![CodeFactor](https://www.codefactor.io/repository/github/sboh1214/hwpkit/badge)](https://www.codefactor.io/repository/github/sboh1214/hwpkit)

[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=sboh1214_HwpKit&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=sboh1214_HwpKit)
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=sboh1214_HwpKit&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=sboh1214_HwpKit)
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=sboh1214_HwpKit&metric=security_rating)](https://sonarcloud.io/dashboard?id=sboh1214_HwpKit)



### Test on Linux

Currently, this project does not support Linux due to dependency [DataCompression](https://github.com/mw99/DataCompression).
You should install [Sourcery](https://github.com/krzysztofzablocki/Sourcery) to create LinuxMain.swift and test.

```bash
$ sourcery --sources Tests --templates Tests/LinuxMain.stencil
$ swift test
```

## License

![GitHub](https://img.shields.io/github/license/sboh1214/HwpKit)
7 changes: 0 additions & 7 deletions Tests/HwpKitTests/Blank/BlankTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,4 @@ final class BlankTests: XCTestCase {
let hwp = try openHwp()
XCTAssertEqual(hwp.fileHeader.encryptVersion, 4)
}

static var allTests = [
("testOpen", testOpen),
("testSignature", testSignature),
("testHwpVersion", testHwpVersion),
("testEncryptVersion", testEncryptVersion)
]
}
4 changes: 0 additions & 4 deletions Tests/HwpKitTests/HwpUtilTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,4 @@ final class HwpUtilTests: XCTestCase {
let bits = [false, true, false, false, true, false, true, false].reversed() as [Bool]
XCTAssertEqual(bits, byte.bits)
}

static var allTests = [
("testBitsFromInt8", testBitsFromInt8)
]
}
12 changes: 0 additions & 12 deletions Tests/HwpKitTests/Noori/NooriDocInfoTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,4 @@ final class NooriDocInfoTests: XCTestCase {
let hwp = try openHwp()
XCTAssertEqual(hwp.sectionArray[0].paragraph[2].ctrlHeaderArray![0].ctrlId, 1885826672)
}

static var allTests = [
("testSectionSize", testSectionSize),
("testStartingIndex", testStartingIndex),
("testCaratLocation", testCaratLocation),
("testBinData", testBinData),
("testFaceName", testFaceName),
("testBorderFill", testBorderFill),
("testCharShape", testCharShape),
("testTabDef", testTabDef),
("testCtrlHeader", testCtrlHeader)
]
}
7 changes: 0 additions & 7 deletions Tests/HwpKitTests/Noori/NooriSectionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,4 @@ final class NooriSectionTests: XCTestCase {

XCTAssertNotNil(hwp.sectionArray[0].paragraph[20].paraLineSegArray![0])
}

static var allTests = [
("testParagraph", testParagraph),
("testParaText", testParaText),
("testParaCharShape", testParaCharShape),
("testParaLineSeg", testParaLineSeg)
]
}
13 changes: 0 additions & 13 deletions Tests/HwpKitTests/XCTestManifests.swift

This file was deleted.

16 changes: 16 additions & 0 deletions Tests/LinuxMain.stencil
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import XCTest
import HwpKitTests

{% for type in types.classes|based:"XCTestCase" %}
{% if not type.annotations.disableTests %}extension {{ type.name }} {
static var allTests: [(String, ({{ type.name }}) -> () throws -> Void)] = [
{% for method in type.methods %}{% if method.parameters.count == 0 and method.shortName|hasPrefix:"test" %} ("{{ method.shortName }}", {{ method.shortName }}){{ ',' if not forloop.last }}
{% endif %}{% endfor %}]
}
{% endif %}{% endfor %}

// swiftlint:disable trailing_comma
XCTMain([
{% for type in types.classes|based:"XCTestCase" %}{% if not type.annotations.disableTests %} testCase({{ type.name }}.allTests),
{% endif %}{% endfor %}])
// swiftlint:enable trailing_comma
6 changes: 0 additions & 6 deletions Tests/LinuxMain.swift

This file was deleted.

0 comments on commit b901d5e

Please sign in to comment.