lacymorrow/crossover

View on GitHub
.circleci/config.yml

Summary

Maintainability
Test Coverage
# Use the latest 2.1 version of CircleCI pipeline process engine.
# See: https://circleci.com/docs/2.0/configuration-reference
version: 2.1

orbs:
  # The Node.js orb contains a set of prepackaged CircleCI configuration you can utilize
  # Orbs reduce the amount of configuration required for common tasks.
  # See the orb documentation here: https://circleci.com/developer/orbs/orb/circleci/node
  node: circleci/node@5.1.0

jobs:
  build-linux: # this can be any name you choose
    executor: node/default # use the default executor defined within the orb
    steps:
      - checkout
      - run:
          command: pwd
      - node/install:
          install-yarn: true
          node-version: "14.21.3"
      - run:
          command: node --version
      - run:
          command: npm i --openssl-fips=''
      # - node/install-packages:
      #     pkg-manager: npm
      - run:
          command: sudo apt-get update
          name: Update apt-get
      - run:
          command: sudo apt-get install rpm
          name: Install Dependencies
      - run:
          command: npm run build:linux --openssl-fips=""
          name: Build app
      - run:
          name: Build and Publish - snap
          command: npm run build:snap $( [ "$CIRCLE_BRANCH" == "release" ] && printf %s '--publish-always' )  --openssl-fips=""

      - run:
          name: Create Artifacts
          command: |
            mkdir -p upload
            cp dist/CrossOver* upload
      - store_artifacts:
          path: upload
          destination: upload

  # Below is the definition of your job to build and test your app, you can rename and customize it as you want.
  build-all:
    macos:
      xcode: 12.5.1
    steps:
      # Checkout the code as the first step.
      - checkout
      - add_ssh_keys:
          fingerprints:
            - "ea:9f:b9:27:c8:2b:8c:fb:f8:63:dc:a8:33:a7:55:62"
      - run:
          name: ls
          command: ls
      - run:
          name: pwd
          command: pwd
      - node/install:
          install-yarn: true
          node-version: "14.21.3"
      # AT SOME POINT YARN INSTALL BROKE FOR NO REASON, TRY SWITCHING BACK TO YARN TO SEE IF IT WORKS
      # - node/install-packages:
      #     # If you are using yarn, change the line below from "npm" to "yarn"
      #     pkg-manager: yarn
      - run:
          name: Install Node modules
          command: npm i  --openssl-fips=''
      - run:
          name: Brew Clean
          command: rm '/usr/local/lib/python3.9/site-packages/six.py'
      - run:
          name: Install Dependencies
          command: HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1 brew install snapcraft rpm
      # - run:
      #     name: Run tests
      #     command: yarn test || echo "There were test failures, this build may be sour."
      - run:
          name: Build and Publish - linux
          command: npm run build:linux --openssl-fips=""
      - run:
          name: Build and Publish - windows
          command: npm run build:windows $( [ "$CIRCLE_BRANCH" != "release" ] && printf %s '--publish-never' ) --openssl-fips=""
      # - run:
      #     name: Create Windows EXE
      #     command: yarn sh:copyexe
      - run:
          name: Build and Publish - windows CrossOver.exe
          command: npm run build:windows:exe --openssl-fips="" || echo 'We error here since latest.yml has already been uploaded.'
      # Snapcraft > 6 uses a different login method that requires an ENV variable: SNAPCRAFT_STORE_CREDENTIALS
      # See https://snapcraft.io/docs/snapcraft-authentication
      #   - run:
      #       name: Snapcraft Login
      #       # Generate the snap token with 'snapcraft export-login --snaps crossover --channels edge,stable -'
      #       command: snapcraft login
      # - run:
      #     name: Build and Publish - snap
      #     command: npm run build:snap $( [ "$CIRCLE_BRANCH" == "release" ] && printf %s '--publish-always' )  --openssl-fips=""
      - run:
          name: Build and Publish - mac
          command: npm run build:mac --openssl-fips=""
      - run:
          name: ls dist
          command: ls dist
      - run:
          name: Cut stable branch
          command: |
            rm yarn.lock package-lock.json || echo "No lock files to remove"
            git config user.email "me@lacymorrow.com"
            git config user.name "Lacy CI"
            git checkout stable || git checkout -b stable
            git pull
            git merge ${CIRCLE_BRANCH} || echo "Not merging to stable"
            git push --set-upstream origin stable || echo "Not pushing stable"

      - run:
          name: Create Artifacts
          command: |
            mkdir -p /Users/distiller/project/upload
            cp /Users/distiller/project/dist/CrossOver* /Users/distiller/project/upload
            cp /Users/distiller/project/dist/latest* /Users/distiller/project/upload
      - store_artifacts:
          path: /Users/distiller/project/upload

workflows:
  # Below is the definition of your workflow.
  # Inside the workflow, you provide the jobs you want to run, e.g this workflow runs the build-and-test job above.
  # CircleCI will run this workflow on every commit.
  # For more details on extending your workflow, see the configuration docs: https://circleci.com/docs/2.0/configuration-reference/#workflows
  build:
    when: # Only test on select branches (not stable)
      or: # One must be true to trigger
        - equal: [dev, << pipeline.git.branch >>]
        - equal: [master, << pipeline.git.branch >>]
        - equal: [release, << pipeline.git.branch >>]
    jobs:
      # - build-linux
      - build-all