From f8e81c78fd11c8651c936d4333171b99893349ce Mon Sep 17 00:00:00 2001 From: Simon McLoughlin Date: Tue, 7 May 2024 11:43:12 +0100 Subject: [PATCH] CI: test adding codeQL --- .github/workflows/codeql.yml | 35 ++++++++++++++++++++++ .github/workflows/unit-test.yml | 53 +++++++++++++++------------------ 2 files changed, 59 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..b1d3e50 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,35 @@ +name: CodeQl +on: + push: + branches: + - develop + pull_request: + branches: + - develop + +jobs: + deploy: + name: Running unit tests + runs-on: macos-14 + steps: + - name: Select Xcode version + run: sudo xcode-select -s '/Applications/Xcode_15.2.app/Contents/Developer' + + - name: Checkout repository + uses: actions/checkout@v4.1.1 + + - name: Get current date + run: echo "NOW=$(date +'%Y-%m-%dT%H-%M-%S')" >> $GITHUB_ENV + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: "swift" + + - name: Test + run: xcodebuild -scheme KukaiCryptoSwift -destination "platform=iOS Simulator,OS=17.2,name=iPhone 15" + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:swift" \ No newline at end of file diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 7fb2b71..57cfcb4 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -1,6 +1,4 @@ name: Unit Test - -# Run unit tests on every push or pull request, to main or develop on: push: branches: @@ -11,35 +9,32 @@ on: - main - develop -# Checkout the code, and run mxcl's xcodebuild action to run the unit tests jobs: - build: - runs-on: macos-12 - strategy: - matrix: - platform: - - iOS - - macOS - xcode: - - ^14 + deploy: + name: Running unit tests + runs-on: macos-14 steps: - - uses: actions/checkout@v4.1.1 + - name: Select Xcode version + run: sudo xcode-select -s '/Applications/Xcode_15.2.app/Contents/Developer' + + - name: Checkout repository + uses: actions/checkout@v4.1.1 - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: "swift" + - name: Get current date + run: echo "NOW=$(date +'%Y-%m-%dT%H-%M-%S')" >> $GITHUB_ENV - - uses: mxcl/xcodebuild@v2.0 - with: - platform: ${{ matrix.platform }} - xcode: ${{ matrix.xcode }} - action: test - scheme: KukaiCryptoSwift - code-coverage: true - upload-logs: always - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + - name: Test + run: xcodebuild test -scheme KukaiCryptoSwift -destination "platform=iOS Simulator,OS=17.2,name=iPhone 15" -enableCodeCoverage YES -resultBundlePath "~/xcode-$NOW.xcresult" + + - name: Upload results + if: ${{ success() || failure() }} + uses: actions/upload-artifact@v4.3.1 with: - category: "/language:swift" + name: "results-${{ env.NOW }}.xcresult" + path: "~/xcode-${{ env.NOW }}.xcresult" + + + + + + \ No newline at end of file