vapor-community / vapor-aws-lambda-runtime

Run your Vapor api server on AWS Lambda using the official Swift Server runtime.
Apache License 2.0
104 stars 10 forks source link

Update CI and fix build errors for Swift 5.5 #18

Closed PSchmiedmayer closed 3 years ago

PSchmiedmayer commented 3 years ago

When checking out the vapor-aws-lambda-runtime package I noted that it fails to compile on Linux for Swift 5.5. I have updated the package to build on Swift 5.5 and have updated the CI to reflect that support. The changes are very small: There was a missing .self in both APIGateway.swift and APIGatewayV2.swift.

Unfortunately macOS 11 support is still in private preview so I can not update the macOS builds to Swift 5.4 or Swift 5.5 and I could not test this using GitHub Actions in my fork. It builds without any problems locally. The following GitHub Actions runs verify the behavior for Swift 5.4 and Swift 5.5: https://github.com/PSchmiedmayer/vapor-aws-lambda-runtime/actions/runs/985680292

Adding CI support for Swift 5.4 and 5.5 on macOS should is easily doable once the vapor-community organization has access to macOS 11 by changing the GitHub Action file in the following way for macOS builds:

  "macOS-Tests":
    runs-on: macos-11
    strategy:
      fail-fast: false
      matrix:
        xcode:
        - 11.7 # Swift 5.2
        - 12.4 # Swift 5.3
        - 12.5 # Swift 5.4
        - latest
    steps:
    - name: Checkout
      uses: actions/checkout@v1
    - uses: maxim-lobanov/setup-xcode@v1.2.3
      with:
        xcode-version: ${{ matrix.xcode }}
    - name: Xcode Tests
      run: swift test --enable-code-coverage
    - name: Generate Coverage Report
      if: matrix.xcode == 'latest'
      run: xcrun llvm-cov export -format="lcov" .build/debug/vapor-aws-lambda-runtimePackageTests.xctest/Contents/MacOS/vapor-aws-lambda-runtimePackageTests -instr-profile .build/debug/codecov/default.profdata > coverage.lcov
    - name: Upload coverage to Codecov
      if: matrix.xcode == 'latest'
      uses: codecov/codecov-action@v1
codecov[bot] commented 3 years ago

Codecov Report

Merging #18 (c8eee3b) into main (eef25d7) will not change coverage. The diff coverage is 0.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #18   +/-   ##
=======================================
  Coverage   17.07%   17.07%           
=======================================
  Files           3        3           
  Lines         205      205           
=======================================
  Hits           35       35           
  Misses        170      170           
Impacted Files Coverage Δ
Sources/VaporAWSLambdaRuntime/APIGateway.swift 30.15% <0.00%> (ø)
Sources/VaporAWSLambdaRuntime/APIGatewayV2.swift 19.27% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update eef25d7...c8eee3b. Read the comment docs.

PSchmiedmayer commented 3 years ago

@0xTim You're welcome, happy to help. I see that the codecov/patch check is failing at the moment as I have neither changed nor added any tests because there was no change in functionality to support building on Swift 5.5. Can you merge the PR and tag a new release anyways or is this a blocker that would require me to add some additional unit tests?

0xTim commented 3 years ago

@PSchmiedmayer nah it's fine - there are no real code changes so it's all good