name: "test" on: [pull_request] jobs: changes: runs-on: ubuntu-latest outputs: desktop: ${{steps.desktop.outputs.src}} preview_folder: ${{steps.preview.outputs.folder}} steps: - uses: actions/checkout@v3 - uses: dorny/paths-filter@v2 id: desktop with: filters: | src: - 'modules/desktop/**' - 'modules/ui/**' - name: get s3 preview folder id: preview run: echo "folder=${{ github.event.number }}-merge" >> $GITHUB_OUTPUT no_preview: needs: changes if: needs.changes.outputs.desktop == 'false' runs-on: ubuntu-latest steps: - name: comment preview site uses: mshick/add-pr-comment@v2 with: message-id: preview-comment-${{needs.changes.outputs.preview_folder}} message: | no preview or changes related to UI test: needs: changes runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: persist-credentials: false - uses: pnpm/action-setup@v2 with: version: 7 - name: setup node uses: actions/setup-node@v1 with: node-version: 18 cache: 'pnpm' cache-dependency-path: pnpm-lock.yaml - name: install app dependencies run: pnpm install - name: unit test run: pnpm --filter gui run coverage - name: lint run: pnpm -r lint build_svelte: needs: changes if: needs.changes.outputs.svelte == 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: cache gui linux uses: actions/cache@v3 with: key: linux+x86-64-20-pnpm-cargo path: | ./pnpm ./target - name: build tauri for Linux uses: ./devops/linux-builder - uses: aws-actions/configure-aws-credentials@v1 with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: us-east-1 - name: sync web files into preview folder env: prefix: ${{ needs.changes.outputs.preview_folder }} run: | aws s3 sync ./modules/gui/build \ "s3://preview.gui.tea.xyz/$prefix" - name: Install package run: sudo apt-get install -y jq coreutils - name: setup preview id: preview_setup run: .github/create-invalidate-preview.sh ${{ needs.changes.outputs.preview_folder }} - name: comment preview site uses: mshick/add-pr-comment@v2 with: message-id: preview-comment-${{needs.changes.outputs.preview_folder}} message: | **preview is at**: here ```bash https://${{steps.preview_setup.outputs.domain}} ``` copy-paste into a browser to view build_desktop: needs: changes if: needs.changes.outputs.desktop == 'true' runs-on: ${{ matrix.platform.os }} strategy: matrix: platform: - os: macos-11 name: darwin+x86-64 # TODO: #181 build for linux # - os: ubuntu-latest # name: linux+x86-64 - os: [self-hosted, macOS, ARM64] name: darwin+aarch64 # err: Package atk was not found in the pkg-config search path. # requires atk >= 2.18 # - os: [self-hosted, linux, ARM64] # name: linux+aarch64 steps: - uses: actions/checkout@v3 - uses: teaxyz/setup@v0 - name: cache gui build # TODO: cache issue in our self-hosted macos runner ESPIPE: invalid seek, read # but its ok to ignore, its still the fastest builder # NOTE: enabling cache in the self hosted runner slows down the pipeline by 4m because post-cache builder error ^ if: startsWith(matrix.platform.name, 'linux') || matrix.platform.name == 'darwin+x86-64' uses: actions/cache@v3 with: key: ${{matrix.platform.name}}-pnpm-cargo path: | ./pnpm - name: build if: startsWith(matrix.platform.name, 'darwin') run: tea -ES xc dist env: # PUBLISH_FOR_PULL_REQUEST: true USE_HARD_LINKS: false CSC_FOR_PULL_REQUEST: true CSC_LINK: ${{ secrets.GUI_APPLE_CERTIFICATE }} CSC_KEY_PASSWORD: ${{ secrets.GUI_APPLE_CERTIFICATE_PASSWORD }} CSC_NAME: ${{ secrets.APPLE_IDENTITY_NO_PREFIX }} # APPLE_ID: ${{ secrets.APPLE_ID }} # APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_PASSWORD }} - run: mkdir -p target - run: cp ./modules/desktop/dist/*.zip ./target/tea.zip - run: tar -czvf artifacts.tgz -C ./target/ . - name: upload artifacts uses: actions/upload-artifact@v3 with: name: ${{ matrix.platform.name }} path: artifacts.tgz if-no-files-found: error notorize_tauri: needs: [build_desktop] # NOTE: atm notarization is only doable in gh macos-11 not in our self-hosted runner runs-on: macos-11 strategy: matrix: platform: - darwin+x86-64 - darwin+aarch64 steps: - uses: actions/download-artifact@v3 with: name: ${{ matrix.platform }} - run: tar xzf artifacts.tgz # Notarize. Can take up to 10 minutes (and fail) asynchronously - run: xcrun altool --notarize-app --username "$APPLE_ID" --password "$APPLE_PASSWORD" --primary-bundle-id "xyz.tea.gui" --file ./tea.zip env: APPLE_ID: ${{ secrets.APPLE_ID }} APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} upload: needs: [notorize_tauri] runs-on: ubuntu-latest strategy: matrix: platform: - name: darwin+x86-64 id: mac_latest # - name: linux+x86-64 # id: linux - name: darwin+aarch64 id: mac_m1 # - name: linux+aarch64 # id: linux_arm64 steps: - uses: actions/download-artifact@v3 with: name: ${{ matrix.platform.name }} - run: tar xzf artifacts.tgz - name: build platform output id: build_platform env: platform: ${{ matrix.platform.name }} run: | BUILD_PLATFORM=$(echo $platform | sed -e "s/darwin+//g" | sed -e "s/linux+//g") EXTENSION=dmg case $platform in "linux+x86-64") BUILD_PLATFORM="amd64" EXTENSION="deb" ;; "linux+aarch64") BUILD_PLATFORM="aarch64" EXTENSION="deb" ;; "darwin+aarch64") BUILD_PLATFORM="aarch64" EXTENSION="zip" ;; "darwin+x86-64") BUILD_PLATFORM="x64" EXTENSION="zip" ;; *) echo "Unknown platform $platform" exit 1 ;; esac echo "build_platform=$BUILD_PLATFORM" >> $GITHUB_OUTPUT echo "extension=$EXTENSION" >> $GITHUB_OUTPUT - uses: aws-actions/configure-aws-credentials@v1 with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: us-east-1 - name: cp package images from prod to preview bucket env: prefix: ${{ needs.changes.outputs.preview_folder }} platform: ${{ steps.build_platform.outputs.build_platform }} extension: ${{ steps.build_platform.outputs.extension }} run: | aws s3 cp \ "./tea.$extension" \ "s3://preview.gui.tea.xyz/$prefix/tea_$platform.$extension" - name: comment install for Linux if: startsWith(matrix.platform.name, 'linux') uses: mshick/add-pr-comment@v2 with: message-id: ${{ matrix.platform.id }}-comment message: | **installer for Linux ${{ matrix.platform.name }} is at**: ```bash http://preview.gui.tea.xyz.s3-website-us-east-1.amazonaws.com/${{ needs.changes.outputs.preview_folder }}/tea_${{ steps.build_platform.outputs.build_platform }}.${{ steps.build_platform.outputs.extension }} ``` copy-paste into a browser to download - name: comment install for MacOS if: startsWith(matrix.platform.name, 'darwin') uses: mshick/add-pr-comment@v2 with: message-id: ${{ matrix.platform.id }}-comment message: | **installers for MacOS ${{ matrix.platform.name }} is at**: ```bash http://preview.gui.tea.xyz.s3-website-us-east-1.amazonaws.com/${{ needs.changes.outputs.preview_folder }}/tea_${{ steps.build_platform.outputs.build_platform }}.zip ``` copy-paste into a browser to download