Skip to content

Commit

Permalink
Merge pull request #10 from vapor-community/swift-5-github-actions
Browse files Browse the repository at this point in the history
Maintenance Update
  • Loading branch information
0xTim authored Dec 2, 2019
2 parents d9a43ac + 4da1b61 commit d451d3a
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 76 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI
on:
- push
jobs:
xenial:
container:
image: vapor/swift:5.1-xenial
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- run: swift test --enable-test-discovery --enable-code-coverage
bionic:
container:
image: vapor/swift:5.1-bionic
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Run Bionic Tests
run: swift test --enable-test-discovery --enable-code-coverage
- name: Setup container for codecov upload
run: apt-get update && apt-get install curl
- name: Process coverage file
run: llvm-cov show .build/x86_64-unknown-linux/debug/LeafMarkdownPackageTests.xctest -instr-profile=.build/x86_64-unknown-linux/debug/codecov/default.profdata > coverage.txt
- name: Upload code coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_UPLOAD_KEY }}
file: coverage.txt
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
Package.pins
DerivedData/
Package.resolved
.swiftpm
24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

10 changes: 5 additions & 5 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:4.0
// swift-tools-version:5.1

import PackageDescription

Expand All @@ -8,12 +8,12 @@ let package = Package(
.library(name: "LeafMarkdown", targets: ["LeafMarkdown"]),
],
dependencies: [
.package(url: "https://github.com/vapor/vapor.git", from: "3.0.0"),
.package(url: "https://github.com/vapor/template-kit.git", from: "1.4.0"),
.package(url: "https://github.com/vapor-community/markdown.git", from: "0.5.0"),
.package(url: "https://github.com/vapor/leaf.git", from: "3.0.0"),
.package(url: "https://github.com/vapor-community/markdown.git", .upToNextMajor(from: "0.4.0")),
],
targets: [
.target(name: "LeafMarkdown", dependencies: ["Vapor", "Leaf", "SwiftMarkdown"]),
.testTarget(name: "LeafMarkdownTests", dependencies: ["LeafMarkdown"]),
.target(name: "LeafMarkdown", dependencies: ["TemplateKit", "SwiftMarkdown"]),
.testTarget(name: "LeafMarkdownTests", dependencies: ["LeafMarkdown", "Leaf"]),
]
)
19 changes: 19 additions & 0 deletions [email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// swift-tools-version:4.0

import PackageDescription

let package = Package(
name: "LeafMarkdown",
products: [
.library(name: "LeafMarkdown", targets: ["LeafMarkdown"]),
],
dependencies: [
.package(url: "https://github.com/vapor/vapor.git", from: "3.0.0"),
.package(url: "https://github.com/vapor/leaf.git", from: "3.0.0"),
.package(url: "https://github.com/vapor-community/markdown.git", .upToNextMajor(from: "0.4.0")),
],
targets: [
.target(name: "LeafMarkdown", dependencies: ["Vapor", "Leaf", "SwiftMarkdown"]),
.testTarget(name: "LeafMarkdownTests", dependencies: ["LeafMarkdown"]),
]
)
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Leaf Markdown

[![Language](https://img.shields.io/badge/Swift-4-brightgreen.svg)](http://swift.org)
[![Build Status](https://travis-ci.org/vapor-community/leaf-markdown.svg?branch=master)](https://travis-ci.org/vapor-community/leaf-markdown)
[![Language](https://img.shields.io/badge/Swift-5.1-brightgreen.svg)](http://swift.org)
[![Build Status](https://github.com/vapor-community/leaf-markdown/workflows/CI/badge.svg?branch=master)](https://github.com/vapor-community/leaf-markdown/actions)
[![codecov](https://codecov.io/gh/vapor-community/leaf-markdown/branch/master/graph/badge.svg)](https://codecov.io/gh/vapor-community/leaf-markdown)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/vapor-community/leaf-markdown/master/LICENSE)

Expand Down
5 changes: 2 additions & 3 deletions Sources/LeafMarkdown/Tag.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Leaf
import TemplateKit
import SwiftMarkdown
import Async

public final class Markdown: TagRenderer {

Expand All @@ -11,7 +10,7 @@ public final class Markdown: TagRenderer {
public let name = "markdown"

private let options: MarkdownOptions?

public init(options: MarkdownOptions? = nil) {
self.options = options
}
Expand Down
18 changes: 7 additions & 11 deletions Tests/LeafMarkdownTests/LeafTests.swift
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
import XCTest
import Vapor

@testable import Leaf
import LeafMarkdown

class LeafTests: XCTestCase {
static var allTests = [
("testRunTag", testRunTag),
("testNilParameterDoesNotCrashLeaf", testNilParameterDoesNotCrashLeaf),
("testStripHtml", testStripHtml),
("testDoNotStripHtml", testDoNotStripHtml)
]

// MARK: - Properties

var renderer: LeafRenderer!
let template = "#markdown(data)"

// MARK: - Overrides

override func setUp() {
let queue = EmbeddedEventLoop()
let container = BasicContainer(config: .init(), environment: .testing, services: .init(), on: queue)
let tag = Markdown()
var leafTagConfig = LeafTagConfig.default()
leafTagConfig.use(tag, as: tag.name)
self.renderer = LeafRenderer(config: LeafConfig(tags: leafTagConfig, viewsDir: "", shouldCache: false),
using: container)
self.renderer = LeafRenderer(config: LeafConfig(tags: leafTagConfig, viewsDir: "", shouldCache: false), using: container)
}

// MARK: - Tests

func testRunTag() throws {
let inputMarkdown = "# This is a test\n\nWe have some text in a tag"
Expand Down Expand Up @@ -72,6 +69,5 @@ class LeafTests: XCTestCase {
let result = try renderer.render(template: template.data(using: .utf8)!, data).wait()
let resultString = String(data: result.data, encoding: .utf8)!
XCTAssertEqual(resultString, expectedHtml)

}
}
23 changes: 0 additions & 23 deletions Tests/LeafMarkdownTests/ServicesTests.swift

This file was deleted.

8 changes: 0 additions & 8 deletions Tests/LinuxMain.swift

This file was deleted.

0 comments on commit d451d3a

Please sign in to comment.