Skip to content

Improve create command and package fairtool for release #2992

Improve create command and package fairtool for release

Improve create command and package fairtool for release #2992

Workflow file for this run

name: Continuous Integration
on:
push:
branches: [ main ]
pull_request_target:
branches:
- '*'
schedule:
- cron: '0 0,12 * * *'
jobs:
ci-linux:
runs-on: ubuntu-latest
timeout-minutes: 90
env:
FAIRHUB_API_SKIP: true # used by tests to determine load
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Get swift version
run: swift --version
- name: Checkout
uses: actions/checkout@v4
- name: Run fairtool
run: |
swift run fairtool version
- name: Fair Test Linux (Debug)
run: swift test -v --configuration debug --parallel
- name: Fair Test Linux (Release)
if: false
run: swift test -v --configuration release -Xswiftc -enable-testing --parallel
- name: Check fairtool formula
if: false
run: |
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
brew install fair-ground/tool/fairtool-head
brew test fairtool-head
fairtool-head version
ci-macOS:
runs-on: macos-latest
timeout-minutes: 90
env:
#DEVELOPER_DIR: /Applications/Xcode_14.1.app/Contents/Developer
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FAIRHUB_API_SKIP: true # used by tests to determine load
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Test iOS (Debug)
if: false
run: xcodebuild test -configuration Debug -scheme "Fair-Package" -sdk "iphonesimulator" -destination "platform=iOS Simulator,name=iPhone 14 Pro"
- name: Test iOS (Release)
if: false
run: xcodebuild test -configuration Release -scheme "Fair-Package" -sdk "iphonesimulator" -destination "platform=iOS Simulator,name=iPhone 14 Pro"
- name: Test macOS (Debug)
run: xcodebuild test -configuration Debug -scheme "Fair-Package" -sdk "macosx" -destination "platform=macosx"
- name: Test macOS (Release)
if: false
run: xcodebuild test -configuration Release -scheme "Fair-Package" -sdk "macosx" -destination "platform=macosx"
- name: Test Package
#run: xcrun swift test --parallel
run: swift test
- name: Run fairtool
run: xcrun swift run fairtool version
- name: Install swiftly
run: curl -L https://swiftlang.github.io/swiftly/swiftly-install.sh | bash -s -- -y
- name: Install Swift 6.2 host toolchain
run: swiftly install 6.2.0
- name: Install Static Linux SDK
run: swift sdk install https://download.swift.org/swift-6.2-release/static-sdk/swift-6.2-RELEASE/swift-6.2-RELEASE_static-linux-0.0.1.artifactbundle.tar.gz --checksum d2225840e592389ca517bbf71652f7003dbf45ac35d1e57d98b9250368769378
- name: Package fairtool
run: scripts/package_fairtool.sh
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
path: fairtool-bin.zip
- name: Create Release
if: startsWith(github.ref, 'refs/tags/')
env:
GH_TOKEN: ${{ github.token }}
# Create a release or upload the assets if the release already exists
run: |
VERSION=$(echo ${{ github.ref_name }} | sed 's/^v//')
gh release create "${VERSION}" -t "${VERSION}" --generate-notes fairtool-bin.zip
- name: Check fairtool formula
if: false
run: |
export HOMEBREW_NO_INSTALL_CLEANUP=1
brew install fair-ground/tool/fairtool-head
brew test fairtool-head
fairtool-head version
#fairtool-head app fork App-Name
#fairtool-head app config App-Name
#fairtool-head app release App-Name
#fairtool-head app integrate App-Name
api-doc:
if: false
runs-on: macos-12
timeout-minutes: 20
env:
DEVELOPER_DIR: /Applications/Xcode_14.0.1.app/Contents/Developer
steps:
- uses: actions/checkout@v3
- name: Build documentation
run: |
swift -version
export SWIFTPM_ENABLE_COMMAND_PLUGINS=1
export DOCC_JSON_PRETTYPRINT="YES"
# add in the docc plugin to generate the docs
sed -I "" 's;^ *dependencies: \[ *$;dependencies: \[ .package(name: "swift-docc-plugin", url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),;g' Package.swift
# until https://github.com/apple/swift-docc/issues/255
# is implemented, we can only have a single target,
# so we copy all the FairCore files into FairApp
# cp -v Sources/FairCore/*.swift Sources/FairApp
# FairApp
swift package --allow-writing-to-directory docs \
generate-documentation --target FairApp \
--disable-indexing \
--transform-for-static-hosting \
--hosting-base-path Fair \
--output-path docs
# FairCore
swift package --allow-writing-to-directory docs-faircore \
generate-documentation --target FairCore \
--disable-indexing \
--transform-for-static-hosting \
--hosting-base-path Fair \
--output-path docs-faircore
cp -R "docs-faircore/data/documentation/"* "docs/data/documentation/"
cp -R "docs-faircore/documentation/"* "docs/documentation/"
rm -r docs-faircore
# FairKit
swift package --allow-writing-to-directory docs-fairkit \
generate-documentation --target FairKit \
--disable-indexing \
--transform-for-static-hosting \
--hosting-base-path Fair \
--output-path docs-fairkit
cp -R "docs-fairkit/data/documentation/"* "docs/data/documentation/"
cp -R "docs-fairkit/documentation/"* "docs/documentation/"
rm -r docs-fairkit
# FairExpo
swift package --allow-writing-to-directory docs-fairexpo \
generate-documentation --target FairExpo \
--disable-indexing \
--transform-for-static-hosting \
--hosting-base-path Fair \
--output-path docs-fairexpo
cp -R "docs-fairexpo/data/documentation/"* "docs/data/documentation/"
cp -R "docs-fairexpo/documentation/"* "docs/documentation/"
rm -r docs-fairexpo
# FairTool executable
swift package --allow-writing-to-directory docs-fairtool \
generate-documentation --target fairtool \
--disable-indexing \
--transform-for-static-hosting \
--hosting-base-path Fair \
--output-path docs-fairtool
cp -R "docs-fairtool/data/documentation/"* "docs/data/documentation/"
cp -R "docs-fairtool/documentation/"* "docs/documentation/"
rm -r docs-fairtool
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: '.'