From 3035c4580881111615342fb60c3279e6e4228a8c Mon Sep 17 00:00:00 2001 From: Max Howell Date: Sat, 29 May 2021 14:35:40 -0400 Subject: [PATCH] #continuous-resilience --- .github/workflows/checks.yml | 9 +++-- .github/workflows/ci.yml | 66 +++++++++++++++++++----------------- 2 files changed, 38 insertions(+), 37 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 393d48b..da4236d 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -1,14 +1,13 @@ -name: Checks on: push: branches: - master paths: - - Sources/** - - Tests/** + - '**/*.swift' + - .github/workflows/checks.yml jobs: - macOS: - runs-on: macos-latest + smoke: + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - run: swift --version diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b6b6372..4832ebd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,11 @@ name: CI -on: pull_request +on: + pull_request: + paths: + - '**/*.swift' + - .github/workflows/ci.yml + schedule: + - cron: '3 3 * * 5' # 3:03 AM, every Friday jobs: smoke: runs-on: macos-latest @@ -10,7 +16,7 @@ jobs: - run: git diff --exit-code apple: - runs-on: macos-latest + runs-on: macos-10.15 strategy: matrix: destination: @@ -34,50 +40,46 @@ jobs: - uses: codecov/codecov-action@v1 linux-swift-4: - name: linux (4.2) - runs-on: ubuntu-18.04 + name: linux (${{ matrix.swift }}) + runs-on: ubuntu-latest + strategy: + matrix: + swift: ['4.2', '5.0'] + container: + image: swift:${{ matrix.swift }} steps: - - uses: fwal/setup-swift@v1 - with: - swift-version: 4.2 - uses: actions/checkout@v2 - - run: swift test --parallel + - run: useradd -ms /bin/bash mxcl + - run: chown -R mxcl . + - run: su mxcl -c 'swift test --parallel' linux: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest strategy: matrix: swift: - - '5.0' - '5.1' - '5.2' - '5.3' + - '5.4' + container: + image: swift:${{ matrix.swift }} steps: - - uses: fwal/setup-swift@v1 - with: - swift-version: ${{ matrix.swift }} - uses: actions/checkout@v2 - - run: swift test --parallel --enable-code-coverage - - name: Generate Coverage Report + - run: useradd -ms /bin/bash mxcl + # ^^ we need to be a normal user and not root for the tests to be valid + - run: chown -R mxcl . + - run: su mxcl -c 'swift test --parallel --enable-code-coverage' + - name: Generate `.lcov` run: | - sudo apt-get -qq update && sudo apt-get -qq install llvm-10 - export b=$(swift build --show-bin-path) && llvm-cov-10 \ - export -format lcov \ - -instr-profile=$b/codecov/default.profdata \ - --ignore-filename-regex='\.build/' \ - $b/Path.swiftPackageTests.xctest \ + apt-get -qq update && apt-get -qq install curl + b=$(swift build --show-bin-path) + llvm-cov export \ + -format lcov \ + -instr-profile="$b"/codecov/default.profdata \ + --ignore-filename-regex='\.build|Tests' \ + "$b"/*.xctest \ > info.lcov - uses: codecov/codecov-action@v1 with: file: ./info.lcov - - # code coverage fails with 5.4 for some reason - linux-swift-5-4: - name: linux (5.4) - runs-on: ubuntu-18.04 - steps: - - uses: fwal/setup-swift@v1 - with: - swift-version: 5.4 - - uses: actions/checkout@v2 - - run: swift test --parallel