mirror of
https://github.com/softinio/Fishee.git
synced 2025-08-31 18:06:42 -07:00
Add github actions workflow
This commit is contained in:
parent
d2b3d2be3c
commit
b3ab1e325f
2 changed files with 116 additions and 26 deletions
86
.github/workflows/build-and-test.yml
vendored
Normal file
86
.github/workflows/build-and-test.yml
vendored
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
name: Build and Test
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
release:
|
||||||
|
types: [created]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up Swift
|
||||||
|
uses: swift-actions/setup-swift@v2
|
||||||
|
with:
|
||||||
|
swift-version: '6.0'
|
||||||
|
|
||||||
|
- name: Get swift version
|
||||||
|
run: swift --version
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: swift test
|
||||||
|
|
||||||
|
build-macos:
|
||||||
|
runs-on: macos-latest
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
arch: [x86_64, arm64]
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up Swift
|
||||||
|
uses: swift-actions/setup-swift@v2
|
||||||
|
with:
|
||||||
|
swift-version: '6.0'
|
||||||
|
|
||||||
|
- name: Get swift version
|
||||||
|
run: swift --version
|
||||||
|
|
||||||
|
- name: Build for macOS
|
||||||
|
run: |
|
||||||
|
swift build -c release --arch ${{ matrix.arch }}
|
||||||
|
mkdir -p artifacts/macos-${{ matrix.arch }}
|
||||||
|
cp .build/apple/Products/Release/fishee artifacts/macos-${{ matrix.arch }}/
|
||||||
|
|
||||||
|
- name: Upload macOS artifacts
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: fishee-macos-${{ matrix.arch }}-${{ github.ref_name }}
|
||||||
|
path: artifacts/macos-${{ matrix.arch }}
|
||||||
|
|
||||||
|
build-linux:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: github.event_name == 'release'
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up Swift
|
||||||
|
uses: swift-actions/setup-swift@v2
|
||||||
|
with:
|
||||||
|
swift-version: '6.0'
|
||||||
|
|
||||||
|
- name: Get swift version
|
||||||
|
run: swift --version
|
||||||
|
|
||||||
|
- name: Build for Linux
|
||||||
|
run: |
|
||||||
|
swift build -c release
|
||||||
|
mkdir -p artifacts/linux
|
||||||
|
cp .build/release/fishee artifacts/linux/
|
||||||
|
|
||||||
|
- name: Upload Linux artifacts
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: fishee-linux-${{ github.ref_name }}
|
||||||
|
path: artifacts/linux
|
|
@ -4,30 +4,34 @@
|
||||||
import PackageDescription
|
import PackageDescription
|
||||||
|
|
||||||
let package = Package(
|
let package = Package(
|
||||||
name: "Fishee",
|
name: "Fishee",
|
||||||
dependencies: [
|
products: [
|
||||||
.package(url: "https://github.com/apple/swift-argument-parser.git", .upToNextMajor(from: "1.5.0")),
|
.executable(name: "fishee", targets: ["Fishee"])
|
||||||
.package(url: "https://github.com/duckdb/duckdb-swift", .upToNextMinor(from: .init(1, 1, 0))),
|
],
|
||||||
],
|
dependencies: [
|
||||||
targets: [
|
.package(
|
||||||
// Targets are the basic building blocks of a package, defining a module or a test suite.
|
url: "https://github.com/apple/swift-argument-parser.git", .upToNextMajor(from: "1.5.0")),
|
||||||
// Targets can depend on other targets in this package and products from dependencies.
|
.package(url: "https://github.com/duckdb/duckdb-swift", .upToNextMinor(from: .init(1, 1, 0))),
|
||||||
.executableTarget(
|
],
|
||||||
name: "Fishee",
|
targets: [
|
||||||
dependencies: [
|
// Targets are the basic building blocks of a package, defining a module or a test suite.
|
||||||
.product(name: "ArgumentParser", package: "swift-argument-parser"),
|
// Targets can depend on other targets in this package and products from dependencies.
|
||||||
.product(name: "DuckDB", package: "duckdb-swift"),
|
.executableTarget(
|
||||||
],
|
name: "Fishee",
|
||||||
path: "Sources"
|
dependencies: [
|
||||||
),
|
.product(name: "ArgumentParser", package: "swift-argument-parser"),
|
||||||
.testTarget(
|
.product(name: "DuckDB", package: "duckdb-swift"),
|
||||||
name: "FisheeTests",
|
],
|
||||||
dependencies: ["Fishee"],
|
path: "Sources"
|
||||||
path: "Tests",
|
),
|
||||||
resources: [
|
.testTarget(
|
||||||
.copy("Resources/fish_history_test.txt"),
|
name: "FisheeTests",
|
||||||
.copy("Resources/fish_history_test_2.txt"),
|
dependencies: ["Fishee"],
|
||||||
]
|
path: "Tests",
|
||||||
)
|
resources: [
|
||||||
]
|
.copy("Resources/fish_history_test.txt"),
|
||||||
|
.copy("Resources/fish_history_test_2.txt"),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
]
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue