Skip to content

Commit

Permalink
osx
Browse files Browse the repository at this point in the history
  • Loading branch information
chayim committed Nov 26, 2023
1 parent 2fbfbb7 commit 0938a90
Show file tree
Hide file tree
Showing 7 changed files with 176 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .github/scripts/build-osx-arm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

make -C redis/src all BUILD_TLS=yes \
FINAL_LIBS="-lm -ldl ../deps/hiredis/libhiredis_ssl.a /opt/homebrew/opt/openssl/lib/libssl.a /opt/homebrew/opt/openssl/lib/libcrypto.a" \
CFLAGS="-I /opt/homebrew/opt/openssl@3/include"
5 changes: 5 additions & 0 deletions .github/scripts/build-osx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

make all \
BUILD_TLS=yes \
FINAL_LIBS="-lm -ldl ../deps/hiredis/libhiredis_ssl.a /usr/local/opt/openssl/lib/libssl.a /usr/local/opt/openssl/lib/libcrypto.a"
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Publish
name: Build

on:
workflow_call:
Expand Down Expand Up @@ -26,15 +26,10 @@ on:
type: string
default: x86_64

osname:
required: false
type: string
default: Linux

build_script:
required: false
type: string
default: build.sh
default: scripts/build.sh

jobs:

Expand Down
123 changes: 123 additions & 0 deletions .github/workflows/REUSABLE-osx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: Build Mac

on:

workflow_call:
inputs:

macos_type:
required: true
type: string

# short version of the OS (ubuntu20.04, rhel7, etc)
osnick:
required: true
type: string

deps:
required: true
type: string

##### optioanl inputs #####

# architecture
arch:
required: false
type: string
default: x86_64

osname:
required: false
type: string
default: macos

build_script:
required: false
type: string
default: scripts/build-osx.sh

jobs:
build:
runs-on: ${{inputs.macos_type}}

steps:
- name: install dependencies
run: ${{inputs.deps}}

- name: determine if in fork
id: iamafork
run: |
amfork=`jq '.pull_request.head.repo.fork' $GITHUB_EVENT_PATH`
echo "am I fork: ${amfork}"
echo "IAMAFORK=$amfork" >> $GITHUB_OUTPUT
- uses: actions/checkout@v3
with:
path: redis-builder

- name: load envvars
id: get_config_versions
run: |
. redis-builder/vars
echo VERSION=$REDISVERSION >> $GITHUB_OUTPUT
echo PACKAGEDREDISVERSION=$PACKAGEDREDISVERSION >> $GITHUB_OUTPUT
echo S3BASE=$S3BASE >> $GITHUB_OUTPUT
echo HTTPS3BASE=$HTTPS3BASE >> $GITHUB_OUTPUT
- name: check if already built
id: redis-already-built
continue-on-error: true
run: |
wget -q ${{steps.get_config_versions.outputs.HTTPS3BASE}}/redis-${{steps.get_config_versions.outputs.PACKAGEDREDISVERSION}}-${{inputs.osnick}}-${{inputs.arch}}.tgz
- uses: actions/checkout@v3
if: steps.redis-already-built.outcome != 'success'
with:
repository: redis/redis
path: redis
ref: ${{steps.get_config_versions.outputs.VERSION}}

- name: make
if: steps.redis-already-built.outcome != 'success'
run: bash redis-builder/${{inputs.build_script}}

- name: package redis for s3
if: steps.redis-already-built.outcome != 'success'
run: |
mkdir redis-${{steps.get_config_versions.outputs.PACKAGEDREDISVERSION}}-${{inputs.osnick}}-${{inputs.arch}}
cp redis/src/redis-server \
redis/src/redis-sentinel \
redis/src/redis-check-aof \
redis/src/redis-check-rdb \
redis/src/redis-benchmark \
redis/src/redis-cli \
redis-${{steps.get_config_versions.outputs.PACKAGEDREDISVERSION}}-${{inputs.osnick}}-${{inputs.arch}}
tar -czvf redis-${{steps.get_config_versions.outputs.PACKAGEDREDISVERSION}}-${{inputs.osnick}}-${{inputs.arch}}.tgz \
redis-${{steps.get_config_versions.outputs.PACKAGEDREDISVERSION}}-${{inputs.osnick}}-${{inputs.arch}}
- name: perist redis
if: steps.redis-already-built.outcome != 'success'
uses: actions/upload-artifact@v3
with:
name: redis-${{steps.get_config_versions.outputs.PACKAGEDREDISVERSION}}-${{inputs.arch}}
path: |
redis/src/redis-server
redis/src/redis-sentinel
redis/src/redis-check-aof
redis/src/redis-check-rdb
redis/src/redis-benchmark
redis/src/redis-cli
- name: install s3cmd
if: steps.redis-already-built.outcome != 'success'
run: |
pip3 install s3cmd
- name: persist redis to s3
if: steps.redis-already-built.outcome != 'success' && steps.iamafork.outputs.IAMAFORK != 'false'
run: |
s3cmd --access_key=${{secrets.AWS_S3_ACCESS_KEY_ID}} \
--secret_key=${{secrets.AWS_S3_SECRET_ACCESS_KEY}} \
--region=us-east-1 \
put -P redis-${{steps.get_config_versions.outputs.PACKAGEDREDISVERSION}}-${{inputs.osnick}}-${{inputs.arch}}.tgz \
${{steps.get_config_versions.outputs.S3BASE}}/redis-${{steps.get_config_versions.outputs.PACKAGEDREDISVERSION}}-${{inputs.osnick}}-${{inputs.arch}}.tgz
37 changes: 37 additions & 0 deletions .github/workflows/build-osx.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build redis

on:
push:
paths-ignore:
- 'docs/**'
- 'README.md'
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-linuxx64
cancel-in-progress: true


permissions:
contents: read
packages: write

jobs:

macos-arm64:
uses: ./.github/workflows/REUSABLE-osx.yml
with:
macos_type: macos-latest-large
deps: brew install openssl@3 coreutils
arch: arm64
build_script: scripts/build-osx-arm.sh
osnick: monterey

macos-x86_64:
uses: ./.github/workflows/REUSABLE-osx.yml
with:
macos_type: macos-latest-large
deps: brew install openssl@3 coreutils
build_script: scripts/build-osx.sh
osnick: monterey
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-linuxx64
cancel-in-progress: true


Expand All @@ -20,15 +20,15 @@ permissions:
jobs:

ubuntu-bionic-x86-64:
uses: ./.github/workflows/BUILD-REUSABLE.yml
uses: ./.github/workflows/REUSABLE-linux.yml
with:
docker_image: ubuntu:18.04
deps: apt-get update -qq && apt-get install -qqy build-essential libssl-dev python3 python3-pip jq wget
osnick: ubuntu18.04
secrets: inherit

rhel7-x86-64:
uses: ./.github/workflows/BUILD-REUSABLE.yml
uses: ./.github/workflows/REUSABLE-linux.yml
with:
docker_image: centos:7
deps: |
Expand All @@ -38,7 +38,7 @@ jobs:
secrets: inherit

rhel8-x86-64:
uses: ./.github/workflows/BUILD-REUSABLE.yml
uses: ./.github/workflows/REUSABLE-linux.yml
with:
docker_image: oraclelinux:8
deps: |
Expand Down

0 comments on commit 0938a90

Please sign in to comment.