Skip to content

Commit

Permalink
chore(ci): fix runners for macos
Browse files Browse the repository at this point in the history
  • Loading branch information
everpcpc committed Jul 3, 2024
1 parent 7658a59 commit a87cfdd
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 117 deletions.
21 changes: 7 additions & 14 deletions .github/workflows/bindings.nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ on:
branches:
- main
paths:
- 'sql/**'
- 'bindings/nodejs/**'
- "sql/**"
- "bindings/nodejs/**"
- ".github/workflows/bindings.nodejs.yml"

concurrency:
Expand All @@ -30,7 +30,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: "18"
- name: Corepack
working-directory: bindings/nodejs
run: corepack enable
Expand Down Expand Up @@ -60,8 +60,8 @@ jobs:
- { target: aarch64-unknown-linux-musl, runner: ubuntu-latest }
- { target: x86_64-unknown-linux-musl, runner: ubuntu-latest }
- { target: x86_64-pc-windows-msvc, runner: windows-2019 }
- { target: x86_64-apple-darwin, runner: macos-11 }
- { target: aarch64-apple-darwin, runner: macos-11 }
- { target: x86_64-apple-darwin, runner: macos-13 }
- { target: aarch64-apple-darwin, runner: macos-13-arm64 }
steps:
- uses: actions/checkout@v4
- name: Setup Rust toolchain
Expand All @@ -72,7 +72,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: "18"
- name: Install ziglang
uses: goto-bus-stop/setup-zig@v2
with:
Expand All @@ -87,13 +87,6 @@ jobs:
working-directory: bindings/nodejs
shell: bash
run: |
if [[ "${{ matrix.target }}" == 'aarch64-apple-darwin' ]]; then
sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/*
export CC=$(xcrun -f clang)
export CXX=$(xcrun -f clang++)
SYSROOT=$(xcrun --sdk macosx --show-sdk-path)
export CFLAGS="-isysroot $SYSROOT -isystem $SYSROOT"
fi
export NAPI_TARGET=${{ matrix.target }}
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
yarn build:debug
Expand Down Expand Up @@ -125,7 +118,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: "18"
- name: Corepack
working-directory: bindings/nodejs
run: corepack enable
Expand Down
37 changes: 26 additions & 11 deletions .github/workflows/bindings.python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ on:
branches:
- main
paths:
- 'sql/**'
- 'bindings/python/**'
- "sql/**"
- "bindings/python/**"
- ".github/workflows/bindings.python.yml"

concurrency:
Expand All @@ -30,9 +30,9 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pipenv'
cache-dependency-path: 'bindings/python/Pipfile.lock'
python-version: "3.11"
cache: "pipenv"
cache-dependency-path: "bindings/python/Pipfile.lock"
- name: Install pipenv
run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python
- name: Install dependencies
Expand All @@ -53,11 +53,26 @@ jobs:
strategy:
matrix:
include:
- { os: linux, arch: x86_64, target: x86_64-unknown-linux-gnu, runner: ubuntu-latest }
- { os: linux, arch: aarch64, target: aarch64-unknown-linux-gnu, runner: ubuntu-latest }
- { os: windows, arch: x86_64, target: x86_64-pc-windows-msvc, runner: windows-2019 }
- { os: macos, arch: x86_64, target: x86_64-apple-darwin, runner: macos-11 }
- { os: macos, arch: aarch64, target: aarch64-apple-darwin, runner: macos-11 }
- os: linux
arch: x86_64
target: x86_64-unknown-linux-musl
runner: ubuntu-latest
- os: linux
arch: aarch64
target: aarch64-unknown-linux-musl
runner: ubuntu-latest
- os: windows
arch: x86_64
target: x86_64-pc-windows-msvc
runner: windows-2019
- os: macos
arch: x86_64
target: x86_64-apple-darwin
runner: macos-13
- os: macos
arch: aarch64
target: aarch64-apple-darwin
runner: macos-13-arm64
steps:
- uses: actions/checkout@v4
- name: Get opts
Expand Down Expand Up @@ -85,7 +100,7 @@ jobs:
working-directory: bindings/python
target: ${{ matrix.target }}
manylinux: ${{ steps.opts.outputs.MANYLINUX }}
sccache: 'true'
sccache: "true"
args: ${{ steps.opts.outputs.BUILD_ARGS }}
- name: Upload artifact
uses: actions/upload-artifact@v4
Expand Down
192 changes: 100 additions & 92 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Release
on:
push:
tags:
- 'v*'
- "v*"

jobs:
build_linux:
Expand All @@ -17,33 +17,33 @@ jobs:
- aarch64-unknown-linux-musl
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.target }}
- name: Setup Cross
shell: bash
run: |
curl -sSfLo /tmp/cross.tar.gz https://github.com/cross-rs/cross/releases/download/v0.2.5/cross-x86_64-unknown-linux-gnu.tar.gz
tar -xzf /tmp/cross.tar.gz -C /tmp
sudo mv /tmp/cross /usr/local/bin/cross
- name: Build
shell: bash
run: |
cross build --release --target=${{ matrix.target }} --bin=bendsql
- name: Publish Binary
uses: ./.github/actions/publish_binary
env:
GH_TOKEN: ${{ github.token }}
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: auto
AWS_ENDPOINT_URL: ${{ secrets.R2_ENDPOINT_URL }}
with:
os: linux
target: ${{ matrix.target }}
version: ${{ github.ref_name }}
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.target }}
- name: Setup Cross
shell: bash
run: |
curl -sSfLo /tmp/cross.tar.gz https://github.com/cross-rs/cross/releases/download/v0.2.5/cross-x86_64-unknown-linux-gnu.tar.gz
tar -xzf /tmp/cross.tar.gz -C /tmp
sudo mv /tmp/cross /usr/local/bin/cross
- name: Build
shell: bash
run: |
cross build --release --target=${{ matrix.target }} --bin=bendsql
- name: Publish Binary
uses: ./.github/actions/publish_binary
env:
GH_TOKEN: ${{ github.token }}
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: auto
AWS_ENDPOINT_URL: ${{ secrets.R2_ENDPOINT_URL }}
with:
os: linux
target: ${{ matrix.target }}
version: ${{ github.ref_name }}

build_other:
name: build ${{ matrix.target }}
Expand All @@ -56,46 +56,46 @@ jobs:
- { os: windows, target: x86_64-pc-windows-msvc }
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.target }}
- name: Build
shell: bash
run: |
cargo build --release --target=${{ matrix.target }} --bin=bendsql
- name: Publish Binary
uses: ./.github/actions/publish_binary
env:
GH_TOKEN: ${{ github.token }}
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: auto
AWS_ENDPOINT_URL: ${{ secrets.R2_ENDPOINT_URL }}
with:
os: ${{ matrix.os }}
target: ${{ matrix.target }}
version: ${{ github.ref_name }}
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.target }}
- name: Build
shell: bash
run: |
cargo build --release --target=${{ matrix.target }} --bin=bendsql
- name: Publish Binary
uses: ./.github/actions/publish_binary
env:
GH_TOKEN: ${{ github.token }}
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: auto
AWS_ENDPOINT_URL: ${{ secrets.R2_ENDPOINT_URL }}
with:
os: ${{ matrix.os }}
target: ${{ matrix.target }}
version: ${{ github.ref_name }}

update_repo:
needs: [build_linux, build_other]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update Release and Tags
shell: bash
env:
GH_TOKEN: ${{ github.token }}
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: auto
AWS_ENDPOINT_URL: ${{ secrets.R2_ENDPOINT_URL }}
run: |
gh api '/repos/datafuselabs/bendsql/tags' > tags.json
aws s3 cp tags.json s3://repo/bendsql/tags.json
gh api '/repos/datafuselabs/bendsql/releases' > releases.json
aws s3 cp releases.json s3://repo/bendsql/releases.json
- uses: actions/checkout@v4
- name: Update Release and Tags
shell: bash
env:
GH_TOKEN: ${{ github.token }}
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: auto
AWS_ENDPOINT_URL: ${{ secrets.R2_ENDPOINT_URL }}
run: |
gh api '/repos/datafuselabs/bendsql/tags' > tags.json
aws s3 cp tags.json s3://repo/bendsql/tags.json
gh api '/repos/datafuselabs/bendsql/releases' > releases.json
aws s3 cp releases.json s3://repo/bendsql/releases.json
distribution:
needs: build_linux
Expand All @@ -109,33 +109,41 @@ jobs:
- { packager: deb, arch: arm64, target: aarch64-unknown-linux-musl }
- { packager: rpm, arch: amd64, target: x86_64-unknown-linux-musl }
- { packager: rpm, arch: arm64, target: aarch64-unknown-linux-musl }
- { packager: archlinux, arch: amd64, target: x86_64-unknown-linux-gnu }
- { packager: archlinux, arch: arm64, target: aarch64-unknown-linux-gnu }
- {
packager: archlinux,
arch: amd64,
target: x86_64-unknown-linux-gnu,
}
- {
packager: archlinux,
arch: arm64,
target: aarch64-unknown-linux-gnu,
}
steps:
- uses: actions/checkout@v4
- name: Setup nfpm
shell: bash
run: |
curl -sSfLo /tmp/nfpm.tar.gz https://github.com/goreleaser/nfpm/releases/download/v2.28.0/nfpm_2.28.0_Linux_x86_64.tar.gz
tar -xzf /tmp/nfpm.tar.gz -C /tmp
sudo mv /tmp/nfpm /usr/local/bin/nfpm
- name: Download
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
mkdir -p dist/pkg
gh release download ${{ github.ref_name }} --pattern "bendsql-${{ matrix.target }}.tar.gz" --dir dist/
tar -xzf dist/bendsql-${{ matrix.target }}.tar.gz -C dist/
- name: Package
shell: bash
run: |
export arch=${{ matrix.arch }}
export version=${{ github.ref_name }}
nfpm package --packager ${{ matrix.packager }} --target dist/pkg/ -f <(envsubst '${arch} ${version}' < nfpm.yaml)
- name: Publish
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release upload ${{ github.ref_name }} dist/pkg/* --clobber
- uses: actions/checkout@v4
- name: Setup nfpm
shell: bash
run: |
curl -sSfLo /tmp/nfpm.tar.gz https://github.com/goreleaser/nfpm/releases/download/v2.28.0/nfpm_2.28.0_Linux_x86_64.tar.gz
tar -xzf /tmp/nfpm.tar.gz -C /tmp
sudo mv /tmp/nfpm /usr/local/bin/nfpm
- name: Download
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
mkdir -p dist/pkg
gh release download ${{ github.ref_name }} --pattern "bendsql-${{ matrix.target }}.tar.gz" --dir dist/
tar -xzf dist/bendsql-${{ matrix.target }}.tar.gz -C dist/
- name: Package
shell: bash
run: |
export arch=${{ matrix.arch }}
export version=${{ github.ref_name }}
nfpm package --packager ${{ matrix.packager }} --target dist/pkg/ -f <(envsubst '${arch} ${version}' < nfpm.yaml)
- name: Publish
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release upload ${{ github.ref_name }} dist/pkg/* --clobber

0 comments on commit a87cfdd

Please sign in to comment.