diff --git a/.github/workflows/Ubuntu.yml b/.github/workflows/Ubuntu.yml deleted file mode 100644 index ae3d6295..00000000 --- a/.github/workflows/Ubuntu.yml +++ /dev/null @@ -1,50 +0,0 @@ -# This workflow will build a Swift project -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift - -name: Ubuntu (Experimental) - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} - -jobs: - linux_build: - runs-on: ubuntu-latest - steps: - # - name: Setup Swift - # # You may pin to the exact commit or the version. - # # uses: swift-actions/setup-swift@65540b95f51493d65f5e59e97dcef9629ddf11bf - # uses: swift-actions/setup-swift@v1.23.0 - # with: - # # Swift version to configure - # swift-version: 5.9 # default is 5.8 - - name: Setup Swift environment for macOS, Linux and Windows - uses: SwiftyLab/setup-swift@v1.4.1 - with: - swift-version: "5.9" - - name: Get swift version - run: swift --version - - uses: actions/checkout@v3 - - name: Set up Ruby - uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1 - with: - ruby-version: '3.1' - - name: Install dependencies - run: | - sudo apt install libffi-dev - sudo apt install build-essential - sudo apt install libsqlite3-dev - sudo apt-get install libncurses5-dev - shell: bash - - name: Bundle Install - run: bundle install - - name: Swift Build - run: swift build - - name: Run tests - run: swift test diff --git a/.github/workflows/release.yml b/.github/workflows/bump_homebrew.yml similarity index 94% rename from .github/workflows/release.yml rename to .github/workflows/bump_homebrew.yml index 405a6acd..b194f53d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/bump_homebrew.yml @@ -1,3 +1,5 @@ +name: Bump Homebrew formula + on: workflow_dispatch: inputs: diff --git a/.github/workflows/jazzy.yml b/.github/workflows/jazzy.yml new file mode 100644 index 00000000..25b18fa0 --- /dev/null +++ b/.github/workflows/jazzy.yml @@ -0,0 +1,42 @@ +# This workflow will build a Swift project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift + +name: rake docs + +on: + workflow_dispatch: + inputs: + ref: + description: 'Ref to build (branch, tag or SHA)' + required: false + default: 'master' + push: + branches: [ "master" ] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} + +jobs: + update_docs: + runs-on: macos-13 + steps: + - name: Set Xcode 15.1.0 + run: sudo xcode-select -s /Applications/Xcode_15.1.0.app/Contents/Developer + - name: Print Current Xcode + run: xcode-select -p + - uses: actions/checkout@v3 + - name: Update Docs + run: | + brew install coreutils + brew install sourcekitten + bundle install + rake docs + - uses: EndBug/add-and-commit@v9.1.3 + with: + add: '.' + message: 'Update Docs' + committer_name: GitHub Actions + committer_email: actions@github.com + + diff --git a/.github/workflows/release_macOS.yml b/.github/workflows/release_macOS.yml new file mode 100644 index 00000000..eba2f755 --- /dev/null +++ b/.github/workflows/release_macOS.yml @@ -0,0 +1,98 @@ +name: release macOS + +on: + workflow_run: + workflows: [test macOS] + types: + - completed + workflow_dispatch: + inputs: + ref: + description: 'Ref to build (branch, tag or SHA)' + required: false + default: 'master' + push: + tags: + - '*' + +jobs: + build: + if: ${{ github.event.workflow_run.conclusion == 'success' }} + name: Build Sourcery for macOS + runs-on: macos-13 + steps: + - name: Set Xcode 15.1.0 + run: sudo xcode-select -s /Applications/Xcode_15.1.0.app/Contents/Developer + - name: Print Current Xcode + run: xcode-select -p + - uses: actions/checkout@v3 + with: + ref: ${{ github.event.inputs.ref }} + - name: Build it + id: build + run: | + brew install coreutils + brew install sourcekitten + bundle install + rake docs + + CLI_DIR="${HOME}/cli/" + RESOURCES_DIR="${CLI_DIR}Resources/" + TEMPLATES_DIR="${CLI_DIR}Templates/" + BUILD_DIR="${HOME}/build/" + BIN_DIR="${CLI_DIR}bin/" + ARTIFACT_BUNDLE_PATH="${HOME}/artifactbundle/" + path_to_sourcery_binary="${BIN_DIR}/sourcery" + + mkdir -p $BIN_DIR + mkdir -p $RESOURCES_DIR + mkdir -p $TEMPLATES_DIR + mkdir -p ${ARTIFACT_BUNDLE_PATH}bin + + cp -r docs/docsets/Sourcery.docset $CLI_DIR + cp -r "Templates/Templates/" $TEMPLATES_DIR + cp Resources/daemon.gif $RESOURCES_DIR + cp Resources/icon-128.png $RESOURCES_DIR + cp CHANGELOG.md $CLI_DIR + cp README.md $CLI_DIR + cp LICENSE $CLI_DIR + + cp -r SourceryJS/Resources/ejs.js $BIN_DIR + cp -r $CLI_DIR/ "${ARTIFACT_BUNDLE_PATH}sourcery" + cp Templates/artifactbundle.info.json.template ${ARTIFACT_BUNDLE_PATH}/info.json + + swift build --disable-sandbox -c release --arch arm64 --build-path $BUILD_DIR + swift build --disable-sandbox -c release --arch x86_64 --build-path $BUILD_DIR + lipo -create -output $path_to_sourcery_binary ${BUILD_DIR}arm64-apple-macosx/release/sourcery ${BUILD_DIR}x86_64-apple-macosx/release/sourcery + strip -rSTX ${path_to_sourcery_binary} + + cp $path_to_sourcery_binary "${ARTIFACT_BUNDLE_PATH}sourcery/bin/" + + pushd $CLI_DIR + TAG=$GITHUB_REF_NAME + FILENAME="sourcery-$TAG.zip" + zip -r -X $FILENAME . + mv $FILENAME "${HOME}/" + popd + + pushd $ARTIFACT_BUNDLE_PATH + sed -i '' "s/VERSION/${TAG}/g" ${ARTIFACT_BUNDLE_PATH}/info.json + ARTIFACTBUNDLENAME=$FILENAME.artifactbundle.zip + zip -r -X $ARTIFACTBUNDLENAME . + mv $ARTIFACTBUNDLENAME "${HOME}/" + popd + + echo "FILENAME=${FILENAME}" >> $GITHUB_OUTPUT + echo "ARTIFACTBUNDLENAME=${ARTIFACTBUNDLENAME}" >> $GITHUB_OUTPUT + - name: 'Upload Sourcery Artifact' + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.build.outputs.FILENAME }} + path: "~/${{ steps.build.outputs.FILENAME }}" + retention-days: 5 + - name: 'Upload Bundle Artifact' + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.build.outputs.ARTIFACTBUNDLENAME }} + path: "~/${{ steps.build.outputs.ARTIFACTBUNDLENAME }}" + retention-days: 5 \ No newline at end of file diff --git a/.github/workflows/release_ubuntu.yml b/.github/workflows/release_ubuntu.yml new file mode 100644 index 00000000..5c3641da --- /dev/null +++ b/.github/workflows/release_ubuntu.yml @@ -0,0 +1,58 @@ +name: release ubuntu + +on: + workflow_run: + workflows: [test ubuntu] + types: + - completed + workflow_dispatch: + inputs: + ref: + description: 'Ref to build (branch, tag or SHA)' + required: false + default: 'master' + push: + tags: + - '*' + +jobs: + build: + if: ${{ github.event.workflow_run.conclusion == 'success' }} + name: Build Sourcery for Ubuntu (latest) + runs-on: ubuntu-latest + outputs: + filename: ${{ steps.build.outputs.filename }} + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ github.event.inputs.ref }} + - name: Setup Swift + uses: swift-actions/setup-swift@v1.26.0 + with: + swift-version: "5.9.2" + - name: Build it + id: build + run: | + BUILD_DIR="${HOME}/build/" + swift build --disable-sandbox -c release --build-path $BUILD_DIR + mv "${BUILD_DIR}x86_64-unknown-linux-gnu/release/sourcery" "${BUILD_DIR}/sourcery" + + UNAME=$(uname -m) + CODENAME=$(lsb_release -c -s) + DESCRIPTION=$(lsb_release -d -s | sed "s/ /-/g" | sed "s/./\L&/g") + SUFFIX=$DESCRIPTION-$CODENAME-$UNAME + TAG=$GITHUB_REF_NAME + FILENAME="sourcery-${TAG}-${SUFFIX}.tar.xz" + + pushd $BUILD_DIR + tar -zcvf $FILENAME sourcery + mv $FILENAME "${HOME}/" + popd + + echo "FILENAME=${FILENAME}" >> $GITHUB_OUTPUT + - name: 'Upload Artifact' + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.build.outputs.FILENAME }} + path: "~/${{ steps.build.outputs.FILENAME }}" + retention-days: 5 \ No newline at end of file diff --git a/.github/workflows/macOS.yml b/.github/workflows/test_macOS.yml similarity index 64% rename from .github/workflows/macOS.yml rename to .github/workflows/test_macOS.yml index 719c66a4..c86ca98c 100644 --- a/.github/workflows/macOS.yml +++ b/.github/workflows/test_macOS.yml @@ -1,9 +1,10 @@ # This workflow will build a Swift project # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift -name: macOS +name: test macOS on: + workflow_call: push: branches: [ "master" ] pull_request: @@ -17,17 +18,11 @@ jobs: macos_build: runs-on: macos-13 steps: - - name: Set Xcode 14.3.1 - run: sudo xcode-select -s /Applications/Xcode_14.3.1.app/Contents/Developer - #- name: Set Xcode 15.0 Beta - # run: sudo xcode-select -s /Applications/Xcode_15.0.app/Contents/Developer + - name: Set Xcode 15.1.0 + run: sudo xcode-select -s /Applications/Xcode_15.1.0.app/Contents/Developer - name: Print Current Xcode run: xcode-select -p - uses: actions/checkout@v3 - - name: Bundle Install - run: bundle install - - name: Swift Build - run: swift build - name: Run tests run: swift test diff --git a/.github/workflows/test_ubuntu.yml b/.github/workflows/test_ubuntu.yml new file mode 100644 index 00000000..edf6a500 --- /dev/null +++ b/.github/workflows/test_ubuntu.yml @@ -0,0 +1,29 @@ +# This workflow will build a Swift project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift + +name: test ubuntu + +on: + workflow_call: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} + +jobs: + linux_build: + runs-on: ubuntu-latest + steps: + - name: Setup Swift + uses: swift-actions/setup-swift@v1.26.0 + with: + swift-version: "5.9.2" + - name: Get swift version + run: swift --version + - uses: actions/checkout@v3 + - name: Run tests + run: swift test diff --git a/.jazzy.yaml b/.jazzy.yaml index e1a8d4c6..82704ffa 100644 --- a/.jazzy.yaml +++ b/.jazzy.yaml @@ -6,6 +6,7 @@ github_url: https://github.com/krzysztofzablocki/Sourcery copyright: 'Copyright © 2016-2021 Pixle. All rights reserved.' readme: About.md documentation: guides/*.md +exclude: ["*_Linux.swift"] custom_categories: - name: Guides