|  | 
|  | 1 | +name: Darwin Package Build | 
|  | 2 | + | 
|  | 3 | +on: [push, pull_request] | 
|  | 4 | + | 
|  | 5 | +concurrency: | 
|  | 6 | +  group: ${{ github.workflow }}-${{ github.ref }} | 
|  | 7 | +  cancel-in-progress: true | 
|  | 8 | + | 
|  | 9 | +env: | 
|  | 10 | +  LOG_LEVEL: debug | 
|  | 11 | + | 
|  | 12 | +jobs: | 
|  | 13 | +  dist_darwin: | 
|  | 14 | +    runs-on: macos-11 | 
|  | 15 | + | 
|  | 16 | +    steps: | 
|  | 17 | +      - | 
|  | 18 | +        name: Select Xcode | 
|  | 19 | +        uses: maxim-lobanov/setup-xcode@v1 | 
|  | 20 | +        with: | 
|  | 21 | +          xcode-version: '13.2.1' | 
|  | 22 | + | 
|  | 23 | +      - # Reference: https://github.com/actions/checkout#Checkout-multiple-repos-side-by-side | 
|  | 24 | +        name: Download distribution-scripts sources | 
|  | 25 | +        uses: actions/checkout@v4 | 
|  | 26 | +        with: | 
|  | 27 | +          path: distribution-scripts | 
|  | 28 | + | 
|  | 29 | +      - | 
|  | 30 | +        name: Download crystal sources | 
|  | 31 | +        uses: actions/checkout@v4 | 
|  | 32 | +        with: | 
|  | 33 | +          repository: crystal-lang/crystal | 
|  | 34 | +          path: crystal | 
|  | 35 | +          fetch-tags: true | 
|  | 36 | +          fetch-depth: 0 | 
|  | 37 | + | 
|  | 38 | +      - | 
|  | 39 | +        name: Restore Omnibus Depenedcies' cache | 
|  | 40 | +        uses: actions/cache@v3 | 
|  | 41 | +        with: | 
|  | 42 | +          path: distribution-scripts/omnibus/vendor/bundler | 
|  | 43 | +          key: ${{ runner.os }}-omnibus-bundler-${{ hashFiles('distribution-scripts/omnibus/Gemfile.lock') }} | 
|  | 44 | +          restore-keys: | | 
|  | 45 | +            ${{ runner.os }}-omnibus-bundler- | 
|  | 46 | +            ${{ runner.os }}- | 
|  | 47 | +
 | 
|  | 48 | +      - | 
|  | 49 | +        name: Install Omnibus Depenedcies | 
|  | 50 | +        run: | | 
|  | 51 | +          cd omnibus | 
|  | 52 | +          bundle install --path vendor/bundler | 
|  | 53 | +
 | 
|  | 54 | +      - | 
|  | 55 | +        name: Create build folders | 
|  | 56 | +        run: | | 
|  | 57 | +          sudo mkdir -p /opt/crystal | 
|  | 58 | +          sudo chown $(whoami) /opt/crystal/ | 
|  | 59 | +          sudo mkdir -p /var/cache | 
|  | 60 | +          sudo chown $(whoami) /var/cache | 
|  | 61 | +
 | 
|  | 62 | +      - | 
|  | 63 | +        name: Build Dawin package | 
|  | 64 | +        run: | | 
|  | 65 | +          make -C distribution-scripts/darwin \ | 
|  | 66 | +            OMNIBUS_OPTS="--log-level ${{ env.LOG_LEVEL }} --override use_git_caching:false" \ | 
|  | 67 | +            CRYSTAL_REPO=$GITHUB_WORKSPACE/crystal \ | 
|  | 68 | +            CRYSTAL_SRC=$GITHUB_WORKSPACE/crystal \ | 
|  | 69 | +            CRYSTAL_SHA1=master \ | 
|  | 70 | +            CRYSTAL_VERSION=1.11.0 \ | 
|  | 71 | +            PACKAGE_ITERATION=1 \ | 
|  | 72 | +            LLVM_VERSION=15.0.7 \ | 
|  | 73 | +            PREVIOUS_CRYSTAL_RELEASE_DARWIN_TARGZ=https://github.com/crystal-lang/crystal/releases/download/1.10.1/crystal-1.10.1-1-darwin-universal.tar.gz | 
|  | 74 | +
 | 
|  | 75 | +
 | 
|  | 76 | +      - # Reference: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#environment-files | 
|  | 77 | +        name: Extract the package name to be used for the artifact name | 
|  | 78 | +        run: | | 
|  | 79 | +          cd distribution-scripts/darwin/build | 
|  | 80 | +          ls -la | 
|  | 81 | +          filename=$(ls -1 crystal-*.tar.gz) | 
|  | 82 | +          echo "ARTIFACT_NAME=${filename%.tar.gz}" >> "$GITHUB_ENV" | 
|  | 83 | +
 | 
|  | 84 | +      - # When an Artifact is uploaded, all the files are assembled into an immutable Zip archive. | 
|  | 85 | +        # https://github.com/actions/upload-artifact#zip-archives | 
|  | 86 | +        name: Upload artifact | 
|  | 87 | +        uses: actions/upload-artifact@v4 | 
|  | 88 | +        with: | 
|  | 89 | +          name: ${{ env.ARTIFACT_NAME }} | 
|  | 90 | +          path: distribution-scripts/darwin/build/* | 
|  | 91 | +          retention-days: 1 | 
|  | 92 | +          if-no-files-found: error | 
|  | 93 | +          compression-level: 0 # package is already compressed | 
0 commit comments