name: "Build CVE-2020-9986"

on:
  push:
    branches: [ main ]
    paths:
      - CVE-2020-9986/**
  pull_request:
    branches: [ main ]
    paths:
      - CVE-2020-9986/**

defaults:
  run:
    working-directory: CVE-2020-9986/OFReadKeys

jobs:
  lint-swiftlint:
    runs-on: macos-11
    steps:
      - name: "Checkout code"
        uses: actions/checkout@v2
      - name: "Run SwiftLint"
        run: swiftlint --reporter github-actions-logging

  build-ofreadkeys:
    runs-on: macos-latest
    needs: lint-swiftlint
    env:
      APP: OFReadKeys
    steps:
      - name: "Checkout code"
        uses: actions/checkout@v2
      - name: "Select Xcode 12"
        uses: keehun/xcode-select@v1
        with:
          version: "12"
      - name: "Archive project"
        run: xcodebuild archive -scheme ${APP} -configuration release -archivePath ${APP}.xcarchive

  build-offetchreports:
    runs-on: macos-latest
    needs: lint-swiftlint
    env:
      APP: OFFetchReports
    steps:
      - name: "Checkout code"
        uses: actions/checkout@v2
      - name: "Select Xcode 12"
        uses: keehun/xcode-select@v1
        with:
          version: "12"
      - name: "Archive project"
        run: xcodebuild archive -scheme ${APP} -configuration release -archivePath ${APP}.xcarchive
