Skip to content

Commit

Permalink
Merge pull request #1 from 417-72KI/test
Browse files Browse the repository at this point in the history
Add test
  • Loading branch information
417-72KI authored Jul 18, 2024
2 parents c224780 + 3e74bb0 commit 7af33f6
Show file tree
Hide file tree
Showing 9 changed files with 1,301 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/matrix.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"xcode_version": [
"15.4",
"15.2"
]
}
71 changes: 71 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: CI
on:
push:
branches: main
paths:
- '**.swift'
- '.github/workflows/ci.yml'
pull_request: {}
concurrency:
group: ${{ github.head_ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
generate-matrix:
name: Generate matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- id: set-matrix
run: |
matrix=$(cat .github/matrix.json | jq -c .)
echo "matrix=$matrix" >> $GITHUB_OUTPUT
test:
name: Test
needs: generate-matrix
runs-on: macOS-14
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
env:
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode_version }}.app/Contents/Developer
steps:
- uses: actions/checkout@v4
- name: Cache SPM build directory
uses: actions/cache@v4
env:
cache-name: swiftpm
with:
path: .build
key: ${{ runner.os }}-${{ github.job }}-${{ matrix.xcode_version }}-${{ env.cache-name }}-${{ hashFiles('**/Package.swift') }}
restore-keys: |
${{ runner.os }}-${{ github.job }}-${{ matrix.xcode_version }}-${{ env.cache-name }}-
${{ runner.os }}-${{ github.job }}-${{ matrix.xcode_version }}-
${{ runner.os }}-${{ github.job }}-
${{ runner.os }}-
# - name: Cache Homebrew modules
# uses: actions/cache@v4
# env:
# cache-name: brew
# with:
# path: |
# ~/Library/Caches/Homebrew/downloads
# key: ${{ runner.os }}-${{ github.job }}-${{ matrix.xcode_version }}-${{ env.cache-name }}-${{ hashFiles('**/Package.swift') }}
# restore-keys: |
# ${{ runner.os }}-${{ github.job }}-${{ matrix.xcode_version }}-${{ env.cache-name }}-
# ${{ runner.os }}-${{ github.job }}-${{ matrix.xcode_version }}-
# ${{ runner.os }}-${{ github.job }}-
# ${{ runner.os }}-
- name: Disable SwiftLint Plugin
run: sed -i -e 's/.*SwiftLint.*//g' Package.swift
- name: Install LLVM
env:
HOMEBREW_NO_AUTO_UPDATE: 1
run: brew install llvm
- name: Activate clang module
run: |
swift package resolve
sudo swift .build/checkouts/ClangSwift/utils/make-pkgconfig.swift
- name: Test
run: swift test
10 changes: 10 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ let package = Package(
]
),
.target(name: "Util"),
.testTarget(
name: "SBHCCoreTests",
dependencies: ["SBHCCore"],
resources: [.copy("Resources")]
),
.testTarget(
name: "SBSCCoreTests",
dependencies: ["SBSCCore"],
resources: [.copy("Resources")]
),
]
)

Expand Down
Loading

0 comments on commit 7af33f6

Please sign in to comment.