Skip to content

Commit

Permalink
Add workflow for GH Actions (#5)
Browse files Browse the repository at this point in the history
* Add workflow

* Adjust container

* Try being more explicit?

* Try removing method
  • Loading branch information
jdmcd authored Nov 5, 2021
1 parent 444a295 commit b84f5b3
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 6 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: test
on: { pull_request: {} }

jobs:
test-queues:
runs-on: ubuntu-latest
container: swift:5.5.1-focal
steps:
- name: Check out
uses: actions/checkout@v2
- name: Build
timeout-minutes: 30
run: swift build -c release
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Build image
# ================================
FROM swift:5.5.1-focal as build
WORKDIR /build

# First just resolve dependencies.
# This creates a cached layer that can be reused
# as long as your Package.swift/Package.resolved
# files do not change.
COPY ./Package.* ./
RUN swift package resolve

# Copy entire repo into container
COPY . .

# Compile with optimizations
RUN swift build -c release
12 changes: 6 additions & 6 deletions Sources/OneRoster/Client/OneRosterClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,15 @@ extension URLComponents {
///
/// The `queryItems` array is created if it is currently `nil`.
public mutating func appendQueryItem(name: String, value: String? = nil) {
self.queryItems = (self.queryItems ?? []) + [.init(name: name, value: value)]
self.queryItems = (self.queryItems ?? []) + [URLQueryItem(name: name, value: value)]
}

/// Add a `URLQueryItem` with the given percent-encoded name and value to the `percentEncodedQueryItems` component.
///
/// The `percentEncodedQueryItems` array is created if it is currently `nil`.
public mutating func appendPercentEncodedQueryItem(name: String, value: String? = nil) {
self.percentEncodedQueryItems = (self.percentEncodedQueryItems ?? []) + [.init(name: name, value: value)]
}
// public mutating func appendPercentEncodedQueryItem(name: String, value: String? = nil) {
// self.percentEncodedQueryItems = (self.percentEncodedQueryItems ?? []) + [URLQueryItem(name: name, value: value)]
// }
}

extension OneRosterAPI.Endpoint {
Expand All @@ -168,8 +168,8 @@ extension OneRosterAPI.Endpoint {
if let offset = offset {
components.appendQueryItem(name: "offset", value: "\(offset)")
}
if let filterString = filterString {
components.appendPercentEncodedQueryItem(name: "filter", value: "\(filterString)")
if let filterString = filterString, let encoded = filterString.addingPercentEncoding(withAllowedCharacters: .alphanumerics) {
components.appendQueryItem(name: "filter", value: encoded)
}

guard var paramUrl = components.url else {
Expand Down

0 comments on commit b84f5b3

Please sign in to comment.