name: CI on: pull_request: branches: - 'main' workflow_dispatch: push: branches: - 'main' jobs: swiftlint: runs-on: macos-latest steps: - name: Checkout repository uses: actions/checkout@v5 - name: Lint Package uses: cirruslabs/swiftlint-action@v1 with: version: latest test-linux: name: Testing CBOR (ubuntu) needs: swiftlint runs-on: ubuntu-latest container: swift:6.2-noble steps: - name: Checkout repository uses: actions/checkout@v5 - name: Restore .build id: "restore-build" uses: actions/cache/restore@v4 with: path: .build key: "swiftpm-tests-build-${{ runner.os }}-${{ github.event.pull_request.base.sha || github.event.after }}" restore-keys: "swiftpm-tests-build-${{ runner.os }}-" - name: Building Package run: swift build --build-tests - name: Cache .build if: steps.restore-build.outputs.cache-hit != 'true' uses: actions/cache/save@v4 with: path: .build key: "swiftpm-tests-build-${{ runner.os }}-${{ github.event.pull_request.base.sha || github.event.after }}" - name: Testing Package run: swift test --skip-build test-macos: name: Testing and Fuzzing CBOR (macOS) needs: swiftlint runs-on: macos-latest steps: - name: Checkout repository uses: actions/checkout@v5 - uses: swift-actions/setup-swift@next with: swift-version: "6.1" - name: Restore .build id: "restore-build" uses: actions/cache/restore@v4 with: path: .build key: "swiftpm-tests-build-${{ runner.os }}-${{ github.event.pull_request.base.sha || github.event.after }}" restore-keys: "swiftpm-tests-build-${{ runner.os }}-" - name: Building Package run: set -o pipefail && swift build --build-tests | xcbeautify --renderer github-actions # run: set -o pipefail && swift build --build-tests // --sanitize fuzzer | xcbeautify - name: Cache .build if: steps.restore-build.outputs.cache-hit != 'true' uses: actions/cache/save@v4 with: path: .build key: "swiftpm-tests-build-${{ runner.os }}-${{ github.event.pull_request.base.sha || github.event.after }}" - name: Testing Package run: set -o pipefail && swift test --skip-build | xcbeautify --renderer github-actions # TODO: The Xcode version of the swift toolchain does not come with libfuzzer # What needs to happen is we install the open source toolchain and then we can fuzz here... # - name: Fuzzing For 15 Seconds # run: | # mkdir -p .fuzz # mkdir -p .fuzz/new-corpus # mkdir -p .fuzz/corpus # mkdir -p .fuzz/artifacts # ./.build/debug/Fuzzing .fuzz/new-corpus .fuzz/corpus -max_total_time=15 -artifact_prefix=.fuzz/artifacts -max_len=1000000 # - name: "Upload Fuzzing Artifacts (if available)" # uses: actions/upload-artifact@v4 # with: # name: "FuzzArtifacts" # path: ".fuzz/artifacts" # if-no-files-found: "ignore" # retention-days: 14