Feature: Color conversions #23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Swift | |
| on: | |
| push: | |
| branches: [ "master" ] | |
| tags: [ "v*" ] | |
| pull_request: | |
| branches: [ "master" ] | |
| workflow_dispatch: | |
| jobs: | |
| analyze: | |
| name: Analyze | |
| runs-on: macos-14 | |
| permissions: | |
| actions: read | |
| contents: read | |
| security-events: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Swift | |
| uses: SwiftyLab/setup-swift@latest | |
| - name: Initialize CodeQL | |
| uses: github/codeql-action/init@v3 | |
| with: | |
| languages: swift | |
| - name: Build | |
| run: swift build -v -Xswiftc -swift-version -Xswiftc 6 | |
| - name: Perform CodeQL Analysis | |
| uses: github/codeql-action/analyze@v3 | |
| with: | |
| category: "/language:swift" | |
| test: | |
| name: Test | |
| needs: analyze | |
| runs-on: macos-14 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Swift | |
| uses: SwiftyLab/setup-swift@latest | |
| - name: Build | |
| run: swift build -v -Xswiftc -swift-version -Xswiftc 6 | |
| - name: Run tests | |
| run: swift test -v -Xswiftc -swift-version -Xswiftc 6 --enable-code-coverage | |
| - name: Generate coverage report | |
| run: | | |
| xcrun llvm-cov export -format=lcov \ | |
| .build/debug/SwiftDevKitPackageTests.xctest/Contents/MacOS/SwiftDevKitPackageTests \ | |
| -instr-profile .build/debug/codecov/default.profdata > coverage.lcov | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| files: ./coverage.lcov | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| fail_ci_if_error: true | |
| verbose: true | |
| lint: | |
| name: Lint | |
| runs-on: macos-14 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: SwiftLint | |
| run: | | |
| brew install swiftlint | |
| swiftlint lint --reporter github-actions-logging | |
| docs: | |
| name: Documentation | |
| needs: test | |
| runs-on: macos-14 | |
| if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Swift | |
| uses: SwiftyLab/setup-swift@latest | |
| - name: Generate Documentation | |
| run: | | |
| swift package --allow-writing-to-directory docs \ | |
| generate-documentation --target SwiftDevKit \ | |
| --output-path docs \ | |
| --transform-for-static-hosting \ | |
| --hosting-base-path SwiftDevKit | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./docs | |
| release: | |
| name: Create Release | |
| needs: [test, lint, docs] | |
| runs-on: macos-14 | |
| if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get Tag | |
| id: tag | |
| run: echo "::set-output name=tag::${GITHUB_REF#refs/tags/}" | |
| - name: Generate Changelog | |
| id: changelog | |
| run: | | |
| previous_tag=$(git describe --tags --abbrev=0 ${{ steps.tag.outputs.tag }}^ 2>/dev/null || echo "") | |
| if [ -z "$previous_tag" ]; then | |
| git log --pretty=format:"* %s" > CHANGELOG.md | |
| else | |
| git log --pretty=format:"* %s" $previous_tag..${{ steps.tag.outputs.tag }} > CHANGELOG.md | |
| fi | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| body_path: CHANGELOG.md | |
| draft: false | |
| prerelease: false | |
| token: ${{ secrets.GITHUB_TOKEN }} |