Skip to content

Commit

Permalink
[misc] add separate push/pr ci
Browse files Browse the repository at this point in the history
  • Loading branch information
markusyeo committed Mar 19, 2024
1 parent 6074503 commit eeb9136
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 17 deletions.
32 changes: 15 additions & 17 deletions .github/workflows/swift.yml → .github/workflows/pull-ci.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
# 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: Swift
name: CI (Pull Request)

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
branches: ["main"]

jobs:
# Taken from:
# https://hoppsen.com/posts/unlock-the-secrets-of-swift-linting-with-swiftlint-and-swiftformat-on-github-actions/
jobs:
# Taken from:
# https://hoppsen.com/posts/unlock-the-secrets-of-swift-linting-with-swiftlint-and-swiftformat-on-github-actions/
SwiftLint:
runs-on: ubuntu-20.04
steps:
Expand All @@ -24,7 +22,7 @@ jobs:
if [ -f ".build/release/swiftlint" ]; then
sudo cp -f .build/release/swiftlint /usr/local/bin/swiftlint
else
git clone --depth 1 --branch $ https://github.com/realm/SwiftLint
git clone --depth 1 https://github.com/realm/SwiftLint
cd SwiftLint
swift build --disable-sandbox -c release
mv .build .. && cd ..
Expand All @@ -41,12 +39,12 @@ jobs:
runs-on: macos-latest
# https://github.com/slashmo/install-swift install specified swift version
steps:
- name: Install Swift
uses: slashmo/[email protected]
with:
version: 5.5
- uses: actions/checkout@v3
- name: Build
run: swift build -v
- name: Run tests
run: swift test -v
- name: Install Swift
uses: slashmo/[email protected]
with:
version: 5.5
- uses: actions/checkout@v3
- name: Build
run: swift build -v
- name: Run tests
run: swift test -v
35 changes: 35 additions & 0 deletions .github/workflows/push-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 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: CI (Push)

on: push

jobs:
# Taken from:
# https://hoppsen.com/posts/unlock-the-secrets-of-swift-linting-with-swiftlint-and-swiftformat-on-github-actions/
SwiftLint:
runs-on: ubuntu-20.04
steps:
- uses: actions/cache@v2
with:
path: .build/release/swiftlint
key: $-linting-swiftlint-$
- name: Build realm/SwiftLint
run: |
if [ -f ".build/release/swiftlint" ]; then
sudo cp -f .build/release/swiftlint /usr/local/bin/swiftlint
else
git clone --depth 1 https://github.com/realm/SwiftLint
cd SwiftLint
swift build --disable-sandbox -c release
mv .build .. && cd ..
rm -rf SwiftLint
sudo cp -f .build/release/swiftlint /usr/local/bin/swiftlint
fi
- name: SwiftLint
run: |
swiftlint --version
swiftlint lint --strict --config .swiftlint.yml --quiet
env:
LINUX_SOURCEKIT_LIB_PATH: /usr/share/swift/usr/lib

0 comments on commit eeb9136

Please sign in to comment.