Skip to content

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
vnghia committed Apr 4, 2024
1 parent 307afc9 commit 6215ca3
Showing 1 changed file with 109 additions and 109 deletions.
218 changes: 109 additions & 109 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ jobs:
platform:
- target: x86_64-unknown-linux-gnu
command: cargo
- target: aarch64-unknown-linux-gnu
command: cross
- target: x86_64-unknown-linux-musl
command: cross
- target: aarch64-unknown-linux-musl
command: cross
# - target: aarch64-unknown-linux-gnu
# command: cross
# - target: x86_64-unknown-linux-musl
# command: cross
# - target: aarch64-unknown-linux-musl
# command: cross

runs-on: ubuntu-latest

Expand Down Expand Up @@ -72,8 +72,8 @@ jobs:
echo "env=${TARGET##*-}" >> "$GITHUB_OUTPUT"
echo "arch=$(echo $TARGET | awk '{print $1}')" >> "$GITHUB_OUTPUT"
echo "docker-arch=${{ startsWith(matrix.platform.target, 'x86_64') && 'amd64' || 'arm64' }}" >> "$GITHUB_OUTPUT"
echo "profile=dev" >> "$GITHUB_OUTPUT"
echo "output-dir=debug" >> "$GITHUB_OUTPUT"
echo "profile=release" >> "$GITHUB_OUTPUT"
echo "output-dir=release" >> "$GITHUB_OUTPUT"
- name: Increase postgres max connection
run: |
docker exec -i postgres bash << EOF
Expand Down Expand Up @@ -175,119 +175,119 @@ jobs:
build-args: |
BASE_IMAGE=debian:12.5-slim
TARGET_ENV=gnu
platforms: linux/amd64,linux/arm64
platforms: linux/amd64
push: true
tags: ${{ steps.meta-gnu.outputs.tags }}

# Musl
- name: Extract metadata for Docker musl
id: meta-musl
uses: docker/metadata-action@v5
with:
images: |
name=ghcr.io/${{ github.repository }}-musl
tags: |
type=ref,event=pr
type=raw,value=develop,enable={{is_default_branch}}
- name: Build and push musl
uses: docker/build-push-action@v5
with:
context: .
file: ci/docker/Dockerfile
build-args: |
BASE_IMAGE=alpine:3.19.1
TARGET_ENV=musl
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta-musl.outputs.tags }}
# # Musl
# - name: Extract metadata for Docker musl
# id: meta-musl
# uses: docker/metadata-action@v5
# with:
# images: |
# name=ghcr.io/${{ github.repository }}-musl
# tags: |
# type=ref,event=pr
# type=raw,value=develop,enable={{is_default_branch}}
# - name: Build and push musl
# uses: docker/build-push-action@v5
# with:
# context: .
# file: ci/docker/Dockerfile
# build-args: |
# BASE_IMAGE=alpine:3.19.1
# TARGET_ENV=musl
# platforms: linux/amd64,linux/arm64
# push: true
# tags: ${{ steps.meta-musl.outputs.tags }}

build-windows:
runs-on: windows-latest
# build-windows:
# runs-on: windows-latest

steps:
- uses: actions/checkout@v4
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
- uses: cargo-bins/cargo-binstall@main
# steps:
# - uses: actions/checkout@v4
# - name: Export GitHub Actions cache environment variables
# uses: actions/github-script@v7
# with:
# script: |
# core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
# core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
# - uses: dtolnay/rust-toolchain@master
# with:
# toolchain: ${{ env.RUST_TOOLCHAIN }}
# - uses: cargo-bins/cargo-binstall@main

- uses: ikalnytskyi/action-setup-postgres@v5
id: postgres
- name: Install libpq
run: |
vcpkg install libpq[core]:x64-windows-release
cp "C:/vcpkg/installed/x64-windows-release/lib/*" "C:/Users/runneradmin/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/x86_64-pc-windows-msvc/lib/"
cp "C:/vcpkg/installed/x64-windows-release/bin/*" "C:/Users/runneradmin/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/x86_64-pc-windows-msvc/bin/"
# - uses: ikalnytskyi/action-setup-postgres@v5
# id: postgres
# - name: Install libpq
# run: |
# vcpkg install libpq[core]:x64-windows-release
# cp "C:/vcpkg/installed/x64-windows-release/lib/*" "C:/Users/runneradmin/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/x86_64-pc-windows-msvc/lib/"
# cp "C:/vcpkg/installed/x64-windows-release/bin/*" "C:/Users/runneradmin/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/x86_64-pc-windows-msvc/bin/"

- name: Install cargo-vcpkg
run: cargo binstall cargo-vcpkg --no-confirm
- name: Build vcpkg dependencies
run: |
cargo vcpkg --verbose build --target x86_64-pc-windows-msvc
# - name: Install cargo-vcpkg
# run: cargo binstall cargo-vcpkg --no-confirm
# - name: Build vcpkg dependencies
# run: |
# cargo vcpkg --verbose build --target x86_64-pc-windows-msvc

- name: Build and test
run: cargo test --locked --target x86_64-pc-windows-msvc -- --test-threads=1
env:
DATABASE_URL: ${{ steps.postgres.outputs.connection-uri }}
# - name: Build and test
# run: cargo test --locked --target x86_64-pc-windows-msvc -- --test-threads=1
# env:
# DATABASE_URL: ${{ steps.postgres.outputs.connection-uri }}

build-macos:
strategy:
fail-fast: false
matrix:
platform:
- target: x86_64-apple-darwin
os: macos-13
vcpkg-target: x64-osx-release
- target: aarch64-apple-darwin
os: macos-14
vcpkg-target: arm64-osx-release
# build-macos:
# strategy:
# fail-fast: false
# matrix:
# platform:
# - target: x86_64-apple-darwin
# os: macos-13
# vcpkg-target: x64-osx-release
# - target: aarch64-apple-darwin
# os: macos-14
# vcpkg-target: arm64-osx-release

runs-on: ${{ matrix.platform.os }}
# runs-on: ${{ matrix.platform.os }}

env:
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
# env:
# HOMEBREW_NO_AUTO_UPDATE: 1
# HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1

steps:
- uses: actions/checkout@v4
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
- uses: cargo-bins/cargo-binstall@main
# steps:
# - uses: actions/checkout@v4
# - name: Export GitHub Actions cache environment variables
# uses: actions/github-script@v7
# with:
# script: |
# core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
# core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
# - uses: dtolnay/rust-toolchain@master
# with:
# toolchain: ${{ env.RUST_TOOLCHAIN }}
# - uses: cargo-bins/cargo-binstall@main

- name: Install postgres
run: brew install postgresql@14
- uses: ikalnytskyi/action-setup-postgres@v5
id: postgres
- name: Increase postgres max connection
run: |
psql -c "ALTER SYSTEM SET max_connections = 1000"
psql -c "ALTER SYSTEM SET shared_buffers = '2GB'"
brew services restart postgresql
env:
PGSERVICE: ${{ steps.postgres.outputs.service-name }}
# - name: Install postgres
# run: brew install postgresql@14
# - uses: ikalnytskyi/action-setup-postgres@v5
# id: postgres
# - name: Increase postgres max connection
# run: |
# psql -c "ALTER SYSTEM SET max_connections = 1000"
# psql -c "ALTER SYSTEM SET shared_buffers = '2GB'"
# brew services restart postgresql
# env:
# PGSERVICE: ${{ steps.postgres.outputs.service-name }}

- name: Install ffmpeg build deps
run: brew install nasm
- name: Install cargo-vcpkg
run: cargo binstall cargo-vcpkg --no-confirm
- name: Build vcpkg dependencies
run: |
cargo vcpkg --verbose build --target ${{ matrix.platform.target }}
# - name: Install ffmpeg build deps
# run: brew install nasm
# - name: Install cargo-vcpkg
# run: cargo binstall cargo-vcpkg --no-confirm
# - name: Build vcpkg dependencies
# run: |
# cargo vcpkg --verbose build --target ${{ matrix.platform.target }}

- name: Build and test
run: cargo test --locked --target ${{ matrix.platform.target }}
env:
DATABASE_URL: ${{ steps.postgres.outputs.connection-uri }}
# - name: Build and test
# run: cargo test --locked --target ${{ matrix.platform.target }}
# env:
# DATABASE_URL: ${{ steps.postgres.outputs.connection-uri }}

0 comments on commit 6215ca3

Please sign in to comment.