diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 24acc1fe0..624fd21e8 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -57,36 +57,46 @@ jobs: target: x86_64-apple-darwin - os: macos-13-xlarge target: aarch64-apple-darwin - name: Build Kernel Release (${{ matrix.target }}) runs-on: ${{ matrix.os }} container: ${{ matrix.container }} env: DIST_TARGET_TRIPLE: ${{ matrix.target }} steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Rust toolchain - uses: dtolnay/rust-toolchain@1.75.0 + - uses: actions/checkout@v4 + - uses: ilammy/setup-nasm@v1 + if: matrix.target == 'x86_64-pc-windows-msvc' + - uses: egor-tensin/setup-gcc@v1 + if: matrix.target == 'x86_64-unknown-linux-gnu' + with: + version: 11 + - uses: dtolnay/rust-toolchain@1.75.0 with: targets: ${{ matrix.target }} - uses: extractions/setup-just@v2 with: just-version: "1.23.0" - - name: Build - run: just dist - - name: Upload artifacts - uses: actions/upload-artifact@v3 + - run: just dist + - uses: actions/upload-artifact@v3 with: name: dist-${{ matrix.target }} path: ./target/dist/ - - name: Post to slack - uses: slackapi/slack-github-action@v1.26.0 + - uses: slackapi/slack-github-action@v1.26.0 if: ${{ always() }} with: payload: | { - "text": "Build Kernel Binary (${{ matrix.target }}): ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}" + "text": "Build Kernel Binary: ${{ job.status }}", + "attachments": [ + { + "fields": [ + { "title": "target", "value": "${{ matrix.target }}", "short": true }, + { "title": "status", "value": "${{ job.status }}", "short": true }, + { "title": "trigger", "value": "${{ github.triggering_actor}}", "short": true }, + { "title": "link", "value": "${{ github.event.pull_request.html_url || github.event.push.head_commit.url || github.event.workflow_run.html_url }}", "short": true } + ] + } + ] } docker-push: @@ -99,14 +109,11 @@ jobs: env: GCP_PROJECT_ID: glaredb-artifacts steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: Authenticate to Google Cloud - uses: google-github-actions/auth@v2 + - uses: actions/checkout@v4 + - uses: google-github-actions/auth@v2 with: credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_JSON }} - - name: Setup gcloud - uses: google-github-actions/setup-gcloud@v2 + - uses: google-github-actions/setup-gcloud@v2 - run: gcloud auth configure-docker -q - run: ./scripts/build-and-push-images.sh # TODO: this should pull the binary that was built in kernel-dist. @@ -133,18 +140,25 @@ jobs: name: dist-x86_64-pc-windows-msvc path: dist - run: ls -al ./dist - - name: Upload artifacts - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v3 with: name: releases path: ./dist - - name: Post to slack - uses: slackapi/slack-github-action@v1.26.0 + - uses: slackapi/slack-github-action@v1.26.0 if: ${{ always() }} with: payload: | { - "text": "Publish Kernal Binary: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}" + "text": "Push Kernel Release: ${{ job.status }}", + "attachments": [ + { + "fields": [ + { "title": "status", "value": "${{ job.status }}", "short": true }, + { "title": "trigger", "value": "${{ github.triggering_actor}}", "short": true }, + { "title": "link", "value": "${{ github.event.pull_request.html_url || github.event.push.head_commit.url || github.event.workflow_run.html_url }}", "short": true } + ] + } + ] } ######################################################################## @@ -164,34 +178,43 @@ jobs: target: [x86_64] steps: - uses: actions/checkout@v4 + - uses: egor-tensin/setup-gcc@v1 + with: + version: 11 - uses: extractions/setup-just@v2 with: just-version: "1.23.0" - - name: install protoc - run: just protoc + - run: just protoc - uses: actions/setup-python@v5 with: python-version: ${{ env.PYTHON_VERSION }} - - name: Build wheels + - name: maturin build uses: PyO3/maturin-action@v1 with: manylinux: "auto" docker-options: "--env PROTOC=${{ env.PROTOC }}" target: ${{ matrix.target }} args: --release --out dist -m bindings/python/Cargo.toml - - name: Upload wheels - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v3 with: name: wheels path: dist - - - name: Post to slack - uses: slackapi/slack-github-action@v1.26.0 + - uses: slackapi/slack-github-action@v1.26.0 if: ${{ always() }} with: payload: | { - "text": "Build Python Bindings (linux ${{ matrix.target }}): ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}" + "text": "Build Linux Python Bindings: ${{ job.status }}", + "attachments": [ + { + "fields": [ + { "title": "target", "value": "${{ matrix.target }}", "short": true }, + { "title": "status", "value": "${{ job.status }}", "short": true }, + { "title": "trigger", "value": "${{ github.triggering_actor}}", "short": true }, + { "title": "link", "value": "${{ github.event.pull_request.html_url || github.event.push.head_commit.url || github.event.workflow_run.html_url }}", "short": true } + ] + } + ] } python-windows: @@ -205,45 +228,53 @@ jobs: target: [x64] steps: - uses: actions/checkout@v4 + - uses: ilammy/setup-nasm@v1 - uses: extractions/setup-just@v2 with: just-version: "1.23.0" - - name: install protoc - run: just protoc + - run: just protoc - uses: actions/setup-python@v5 with: python-version: ${{ env.PYTHON_VERSION }} architecture: ${{ matrix.target }} - - name: Build wheels + - name: maturin build uses: PyO3/maturin-action@v1 with: target: ${{ matrix.target }} args: --release --out dist working-directory: bindings/python container: "off" - - name: Upload wheels - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v3 with: name: wheels path: bindings/python/dist - - name: Post to slack - uses: slackapi/slack-github-action@v1.26.0 + - uses: slackapi/slack-github-action@v1.26.0 if: ${{ always() }} with: payload: | { - "text": "Build Python Bindings (windows ${{ matrix.target }}): ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}" + "text": "Build Windows Python Bindings: ${{ job.status }}", + "attachments": [ + { + "fields": [ + { "title": "target", "value": "Windows ${{ matrix.target }}", "short": true }, + { "title": "trigger", "value": "${{ github.triggering_actor}}", "short": true }, + { "title": "status", "value": "${{ job.status }}", "short": true }, + { "title": "link", "value": "${{ github.event.pull_request.html_url || github.event.push.head_commit.url || github.event.workflow_run.html_url }}", "short": true } + ] + } + ] } python-macos: - name: Build Python Bindings (macos ${{ matrix.config.target }}) - runs-on: ${{ matrix.config.runner }} + name: Build Python Bindings (macos ${{ matrix.target }}) + runs-on: ${{ matrix.runner }} permissions: contents: read strategy: fail-fast: true matrix: - config: + include: - target: x86_64-apple-darwin runner: macos-13-large - target: aarch64-apple-darwin @@ -257,26 +288,33 @@ jobs: - uses: actions/setup-python@v5 with: python-version: ${{ env.PYTHON_VERSION }} - - name: Build wheels + - name: maturin build uses: PyO3/maturin-action@v1 with: - target: ${{ matrix.config.target }} + target: ${{ matrix.target }} args: --release --out dist working-directory: bindings/python container: "off" - - name: Upload wheels - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v3 with: name: wheels path: bindings/python/dist - - - name: Post to slack - uses: slackapi/slack-github-action@v1.26.0 + - uses: slackapi/slack-github-action@v1.26.0 if: ${{ always() }} with: payload: | { - "text": "Build Python Bindings (macos ${{ matrix.config.target }}): ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}" + "text": "Build macOS Python Bindings: ${{ job.status }}", + "attachments": [ + { + "fields": [ + { "title": "status", "value": "${{ job.status }}", "short": true }, + { "title": "target", "value": "${{ matrix.target }}", "short": true }, + { "title": "trigger", "value": "${{ github.triggering_actor}}", "short": true }, + { "title": "link", "value": "${{ github.event.pull_request.html_url || github.event.push.head_commit.url || github.event.workflow_run.html_url }}", "short": true } + ] + } + ] } python-push: @@ -290,20 +328,28 @@ jobs: - uses: actions/download-artifact@v3 with: name: wheels - - name: Publish to PyPI + - name: maturin publish uses: PyO3/maturin-action@v1 env: MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} with: command: upload args: --skip-existing * - - name: Post to slack - uses: slackapi/slack-github-action@v1.26.0 + - uses: slackapi/slack-github-action@v1.26.0 if: ${{ always() }} with: payload: | { - "text": "Push Python Bindings: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}" + "text": "Push Python Bindings: ${{ job.status }}", + "attachments": [ + { + "fields": [ + { "title": "status", "value": "${{ job.status }}", "short": true }, + { "title": "trigger", "value": "${{ github.triggering_actor}}", "short": true }, + { "title": "link", "value": "${{ github.event.pull_request.html_url || github.event.push.head_commit.url || github.event.workflow_run.html_url }}", "short": true } + ] + } + ] } ######################################################################## @@ -322,7 +368,7 @@ jobs: strategy: fail-fast: true matrix: - settings: + include: - host: macos-12-xl target: x86_64-apple-darwin build: | @@ -355,8 +401,8 @@ jobs: export CFLAGS="-isysroot $SYSROOT -isystem $SYSROOT"; yarn build --target aarch64-apple-darwin strip -x *.node - name: Build Node.JS Bindings (stable - ${{ matrix.settings.target }} - node@18) - runs-on: ${{ matrix.settings.host }} + name: Build Node.JS Bindings ${{ matrix.target }} + runs-on: ${{ matrix.host }} env: DEBUG: napi:* APP_NAME: "glaredb" @@ -364,24 +410,27 @@ jobs: PROTOC: "${{ github.workspace }}/deps/protoc/bin/protoc" steps: - uses: actions/checkout@v4 + - uses: ilammy/setup-nasm@v1 + if: matrix.target == 'x86_64-pc-windows-msvc' + - uses: egor-tensin/setup-gcc@v1 + if: matrix.target == 'x86_64-unknown-linux-gnu' + with: + version: 11 - uses: extractions/setup-just@v2 with: just-version: "1.23.0" - run: just protoc - - name: Setup node - uses: actions/setup-node@v4 - if: ${{ !matrix.settings.docker }} + - uses: actions/setup-node@v4 + if: ${{ !matrix.docker }} with: node-version: 20 check-latest: true - - name: Install - uses: dtolnay/rust-toolchain@stable - if: ${{ !matrix.settings.docker }} + - uses: dtolnay/rust-toolchain@stable + if: ${{ !matrix.docker }} with: toolchain: stable - targets: ${{ matrix.settings.target }} - - name: Cache cargo - uses: actions/cache@v4 + targets: ${{ matrix.target }} + - uses: actions/cache@v4 with: path: | ~/.cargo/registry/index/ @@ -389,52 +438,54 @@ jobs: ~/.cargo/git/db/ .cargo-cache target/ - key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }} + key: ${{ matrix.target }}-cargo-${{ matrix.host }} - uses: goto-bus-stop/setup-zig@v2 - if: ${{ matrix.settings.target == 'armv7-unknown-linux-gnueabihf' }} + if: ${{ matrix.target == 'armv7-unknown-linux-gnueabihf' }} with: version: 0.10.1 - - name: Setup toolchain - run: ${{ matrix.settings.setup }} - if: ${{ matrix.settings.setup }} + - run: ${{ matrix.setup }} + if: ${{ matrix.setup }} shell: bash - - name: Setup node x86 - if: matrix.settings.target == 'i686-pc-windows-msvc' + - if: matrix.target == 'i686-pc-windows-msvc' run: yarn config set supportedArchitectures.cpu "ia32" shell: bash - - name: Install dependencies - run: yarn install --frozen-lockfile - - name: Setup node x86 - uses: actions/setup-node@v4 - if: matrix.settings.target == 'i686-pc-windows-msvc' + - run: yarn install --frozen-lockfile + - uses: actions/setup-node@v4 + if: matrix.target == 'i686-pc-windows-msvc' with: node-version: 20 check-latest: true architecture: x86 - - name: Build in docker - uses: addnab/docker-run-action@v3 - if: ${{ matrix.settings.docker }} + - uses: addnab/docker-run-action@v3 + if: ${{ matrix.docker }} with: - image: ${{ matrix.settings.docker }} + image: ${{ matrix.docker }} options: "--user 0:0 -v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index -v ${{ github.workspace }}:/build -w /build" - run: ${{ matrix.settings.build }} - - name: Build - run: ${{ matrix.settings.build }} - if: ${{ !matrix.settings.docker }} + run: ${{ matrix.build }} + - run: ${{ matrix.build }} + if: ${{ !matrix.docker }} shell: bash - - name: Upload artifact - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v3 with: - name: bindings-${{ matrix.settings.target }} + name: bindings-${{ matrix.target }} path: bindings/nodejs/${{ env.APP_NAME }}.*.node if-no-files-found: error - - name: Post to slack - uses: slackapi/slack-github-action@v1.26.0 + - uses: slackapi/slack-github-action@v1.26.0 if: ${{ always() }} with: payload: | { - "text": "Build Node.JS Bindings (stable - ${{ matrix.settings.target }} - node@18): ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}" + "text": "Build Node Bindings ${{ matrix.target }}: ${{ job.status }}", + "attachments": [ + { + "fields": [ + { "title": "target", "value": "${{ matrix.target }}", "short": true }, + { "title": "status", "value": "${{ job.status }}", "short": true }, + { "title": "trigger", "value": "${{ github.triggering_actor}}", "short": true }, + { "title": "link", "value": "${{ github.event.pull_request.html_url || github.event.push.head_commit.url || github.event.workflow_run.html_url }}", "short": true } + ] + } + ] } node-push: @@ -457,24 +508,19 @@ jobs: - uses: actions/checkout@v4 - uses: extractions/setup-just@v2 - run: just protoc - - name: Setup node - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: node-version: 20 check-latest: true registry-url: "https://registry.npmjs.org" - - name: Install dependencies - run: yarn install --frozen-lockfile - - name: Download all artifacts - uses: actions/download-artifact@v3 + - run: yarn install --frozen-lockfile + - uses: actions/download-artifact@v3 with: path: bindings/nodejs/artifacts - - name: Move artifacts - run: yarn artifacts - - name: List packages - run: ls -R ./npm + - run: yarn artifacts + - run: ls -R ./npm shell: bash - - name: Publish + - name: publish run: | echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc npm publish @@ -482,11 +528,19 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - name: Post to slack - uses: slackapi/slack-github-action@v1.26.0 + - uses: slackapi/slack-github-action@v1.26.0 if: ${{ always() }} with: payload: | { - "text": "Push Node.js Bindings: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}" + "text": "Push Node Bindings: ${{ job.status }}", + "attachments": [ + { + "fields": [ + { "title": "status", "value": "${{ job.status }}", "short": true }, + { "title": "trigger", "value": "${{ github.triggering_actor}}", "short": true }, + { "title": "link", "value": "${{ github.event.pull_request.html_url || github.event.push.head_commit.url || github.event.workflow_run.html_url }}", "short": true } + ] + } + ] }