Skip to content

Commit

Permalink
Migrate to GitHub Actions (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
okhan-okbay-cko authored Dec 12, 2023
1 parent 0fb9a86 commit b75e158
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 79 deletions.
File renamed without changes.
20 changes: 20 additions & 0 deletions .github/scripts/lintEditedFiles.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh

set -o pipefail
git fetch origin main
echo "Fetched"

# Use a conditional to check if there are edited files
if EDITED_FILES=$(git diff HEAD origin/main --name-only --diff-filter=d | grep "\.swift" | grep -v "\.swiftlint\.yml" | xargs echo | tr ' ' ','); then
echo "Got edited files"
echo $EDITED_FILES

# Check if EDITED_FILES is empty or null
if [ -z "$EDITED_FILES" ]; then
echo "No edited .swift files found."
else
swiftlint lint $EDITED_FILES | sed -E -n 's/^(.*):([0-9]+):([0-9]+): error: (.*)/::error file=\1,line=\2,col=\3::\4\n\1:\2:\3/p'
fi
else
echo "No changes in .swift files found."
fi
54 changes: 54 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: "Run CodeQL"

on:
push:
branches:
- 'main'
- 'develop'
- 'release/*'
pull_request:
# The branches below must be a subset of the branches above
branches:
- 'main'
- 'develop'
- 'release/*'
schedule:
- cron: '34 2 * * 0'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
analyze:
name: Analyze
runs-on: [ macos-latest ]
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'swift' ]

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
queries: security-and-quality

- name: Build
run: |
xcodebuild -scheme CheckoutNetwork -destination "platform=iOS Simulator,name=iPhone 14 Pro,OS=latest"
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
37 changes: 37 additions & 0 deletions .github/workflows/verify-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: "Verify PR"

on:
pull_request:
branches:
- 'main'
- 'develop'
- 'release/*'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
lint:
name: SwiftLint
runs-on: macos-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Lint Edited Files
run: bash .github/scripts/lintEditedFiles.sh

verify-pr:
name: Verify PR
runs-on: macos-latest
needs: lint

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Build
run: |
set -o pipefail && xcodebuild -scheme CheckoutNetwork -destination "platform=iOS Simulator,name=iPhone 14 Pro,OS=latest"
17 changes: 0 additions & 17 deletions Scripts/runSonarQube.sh

This file was deleted.

62 changes: 0 additions & 62 deletions bitrise.yml

This file was deleted.

0 comments on commit b75e158

Please sign in to comment.