Skip to content

Commit fa8d30d

Browse files
authored
*BSD (#4)
1 parent c9a1fbf commit fa8d30d

File tree

11 files changed

+381
-20
lines changed

11 files changed

+381
-20
lines changed

.github/workflows/REUSABLE-bsd.yml

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
name: Build
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
7+
machine_host:
8+
required: true
9+
type: string
10+
11+
osname:
12+
required: true
13+
type: string
14+
15+
osversion:
16+
required: true
17+
type: string
18+
19+
# short version of the OS (ubuntu20.04, rhel7, etc)
20+
osnick:
21+
required: true
22+
type: string
23+
24+
deps:
25+
required: true
26+
type: string
27+
28+
outside_deps:
29+
required: false
30+
type: string
31+
default: "echo"
32+
33+
##### optioanl inputs #####
34+
35+
# architecture
36+
arch:
37+
required: false
38+
type: string
39+
default: x86_64
40+
41+
build_script:
42+
required: false
43+
type: string
44+
default: scripts/build-bsd.sh
45+
46+
jobs:
47+
48+
build:
49+
runs-on: ${{inputs.machine_host}}
50+
51+
steps:
52+
53+
- uses: actions/checkout@v3
54+
with:
55+
path: redis-builder
56+
57+
- name: load envvars
58+
id: get_config_versions
59+
run: |
60+
. redis-builder/vars
61+
echo VERSION=$REDISVERSION >> $GITHUB_OUTPUT
62+
echo PACKAGEDREDISVERSION=$PACKAGEDREDISVERSION >> $GITHUB_OUTPUT
63+
echo S3BASE=$S3BASE >> $GITHUB_OUTPUT
64+
echo HTTPS3BASE=$HTTPS3BASE >> $GITHUB_OUTPUT
65+
66+
- name: check if already built
67+
id: redis-already-built
68+
continue-on-error: true
69+
run: |
70+
wget -q ${{steps.get_config_versions.outputs.HTTPS3BASE}}/redis-${{steps.get_config_versions.outputs.PACKAGEDREDISVERSION}}-${{inputs.osnick}}-${{inputs.arch}}.tgz
71+
72+
- uses: actions/checkout@v3
73+
if: steps.redis-already-built.outcome != 'success'
74+
with:
75+
repository: redis/redis
76+
path: redis
77+
ref: ${{steps.get_config_versions.outputs.VERSION}}
78+
79+
- name: Cache dependencies
80+
uses: actions/cache@v3
81+
with:
82+
path: |
83+
/var/cache/apt/archives/**.deb
84+
/var/cache/yum
85+
key: cache-${{hashFiles('.github/workflows/*.yml')}}-${{inputs.arch}}-build
86+
87+
- name: make
88+
uses: cross-platform-actions/action@v0.21.1
89+
if: steps.redis-already-built.outcome != 'success'
90+
with:
91+
operating_system: ${{inputs.osname}}
92+
version: ${{inputs.osversion}}
93+
shell: bash
94+
architecture: ${{inputs.arch}}
95+
run: |
96+
${{inputs.deps}}
97+
bash redis-builder/${{inputs.build_script}}
98+
99+
- name: package redis for s3
100+
if: steps.redis-already-built.outcome != 'success'
101+
run: |
102+
mkdir redis-${{steps.get_config_versions.outputs.PACKAGEDREDISVERSION}}-${{inputs.osnick}}-${{inputs.arch}}
103+
cp redis/src/redis-server \
104+
redis/src/redis-sentinel \
105+
redis/src/redis-check-aof \
106+
redis/src/redis-check-rdb \
107+
redis/src/redis-benchmark \
108+
redis/src/redis-cli \
109+
redis-${{steps.get_config_versions.outputs.PACKAGEDREDISVERSION}}-${{inputs.osnick}}-${{inputs.arch}}
110+
tar -czvf redis-${{steps.get_config_versions.outputs.PACKAGEDREDISVERSION}}-${{inputs.osnick}}-${{inputs.arch}}.tgz \
111+
redis-${{steps.get_config_versions.outputs.PACKAGEDREDISVERSION}}-${{inputs.osnick}}-${{inputs.arch}}
112+
113+
- name: perist redis
114+
if: steps.redis-already-built.outcome != 'success'
115+
uses: actions/upload-artifact@v3
116+
with:
117+
name: redis-${{steps.get_config_versions.outputs.PACKAGEDREDISVERSION}}-${{inputs.arch}}
118+
path: |
119+
redis/src/redis-server
120+
redis/src/redis-sentinel
121+
redis/src/redis-check-aof
122+
redis/src/redis-check-rdb
123+
redis/src/redis-benchmark
124+
redis/src/redis-cli
125+
126+
- name: install s3cmd
127+
if: steps.redis-already-built.outcome != 'success'
128+
run: |
129+
pip3 install s3cmd
130+
131+
- name: install dependencies
132+
run: ${{inputs.outside_deps}}
133+
134+
- name: determine if in fork
135+
id: iamafork
136+
run: |
137+
amfork=`jq '.pull_request.head.repo.fork' $GITHUB_EVENT_PATH`
138+
echo "am I fork: ${amfork}"
139+
echo "IAMAFORK=$amfork" >> $GITHUB_OUTPUT
140+
141+
- name: persist redis to s3
142+
if: steps.redis-already-built.outcome != 'success' && steps.iamafork.outputs.IAMAFORK != 'false'
143+
run: |
144+
s3cmd --access_key=${{secrets.AWS_ACCESS_KEY_ID}} --secret_key=${{secrets.AWS_SECRET_ACCESS_KEY}} --region=us-east-1 put -P redis-${{steps.get_config_versions.outputs.PACKAGEDREDISVERSION}}-${{inputs.osnick}}-${{inputs.arch}}.tgz \
145+
${{steps.get_config_versions.outputs.S3BASE}}/redis-${{steps.get_config_versions.outputs.PACKAGEDREDISVERSION}}-${{inputs.osnick}}-${{inputs.arch}}.tgz

.github/workflows/BUILD-REUSABLE.yml renamed to .github/workflows/REUSABLE-linux.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and Publish
1+
name: Build
22

33
on:
44
workflow_call:
@@ -26,15 +26,10 @@ on:
2626
type: string
2727
default: x86_64
2828

29-
osname:
30-
required: false
31-
type: string
32-
default: Linux
33-
3429
build_script:
3530
required: false
3631
type: string
37-
default: build.sh
32+
default: scripts/build.sh
3833

3934
jobs:
4035

.github/workflows/REUSABLE-osx.yml

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
name: Build Mac
2+
3+
on:
4+
5+
workflow_call:
6+
inputs:
7+
8+
macos_type:
9+
required: true
10+
type: string
11+
12+
# short version of the OS (ubuntu20.04, rhel7, etc)
13+
osnick:
14+
required: true
15+
type: string
16+
17+
deps:
18+
required: true
19+
type: string
20+
21+
##### optioanl inputs #####
22+
23+
# architecture
24+
arch:
25+
required: false
26+
type: string
27+
default: x86_64
28+
29+
osname:
30+
required: false
31+
type: string
32+
default: macos
33+
34+
build_script:
35+
required: false
36+
type: string
37+
default: scripts/build-osx.sh
38+
39+
jobs:
40+
build:
41+
runs-on: ${{inputs.macos_type}}
42+
43+
steps:
44+
- name: install dependencies
45+
run: ${{inputs.deps}}
46+
47+
- name: determine if in fork
48+
id: iamafork
49+
run: |
50+
amfork=`jq '.pull_request.head.repo.fork' $GITHUB_EVENT_PATH`
51+
echo "am I fork: ${amfork}"
52+
echo "IAMAFORK=$amfork" >> $GITHUB_OUTPUT
53+
54+
- uses: actions/checkout@v3
55+
with:
56+
path: redis-builder
57+
58+
- name: load envvars
59+
id: get_config_versions
60+
run: |
61+
. redis-builder/vars
62+
echo VERSION=$REDISVERSION >> $GITHUB_OUTPUT
63+
echo PACKAGEDREDISVERSION=$PACKAGEDREDISVERSION >> $GITHUB_OUTPUT
64+
echo S3BASE=$S3BASE >> $GITHUB_OUTPUT
65+
echo HTTPS3BASE=$HTTPS3BASE >> $GITHUB_OUTPUT
66+
67+
- name: check if already built
68+
id: redis-already-built
69+
continue-on-error: true
70+
run: |
71+
wget -q ${{steps.get_config_versions.outputs.HTTPS3BASE}}/redis-${{steps.get_config_versions.outputs.PACKAGEDREDISVERSION}}-${{inputs.osnick}}-${{inputs.arch}}.tgz
72+
73+
- uses: actions/checkout@v3
74+
if: steps.redis-already-built.outcome != 'success'
75+
with:
76+
repository: redis/redis
77+
path: redis
78+
ref: ${{steps.get_config_versions.outputs.VERSION}}
79+
80+
- name: make
81+
if: steps.redis-already-built.outcome != 'success'
82+
run: bash redis-builder/${{inputs.build_script}}
83+
84+
- name: package redis for s3
85+
if: steps.redis-already-built.outcome != 'success'
86+
run: |
87+
mkdir redis-${{steps.get_config_versions.outputs.PACKAGEDREDISVERSION}}-${{inputs.osnick}}-${{inputs.arch}}
88+
cp redis/src/redis-server \
89+
redis/src/redis-sentinel \
90+
redis/src/redis-check-aof \
91+
redis/src/redis-check-rdb \
92+
redis/src/redis-benchmark \
93+
redis/src/redis-cli \
94+
redis-${{steps.get_config_versions.outputs.PACKAGEDREDISVERSION}}-${{inputs.osnick}}-${{inputs.arch}}
95+
tar -czvf redis-${{steps.get_config_versions.outputs.PACKAGEDREDISVERSION}}-${{inputs.osnick}}-${{inputs.arch}}.tgz \
96+
redis-${{steps.get_config_versions.outputs.PACKAGEDREDISVERSION}}-${{inputs.osnick}}-${{inputs.arch}}
97+
98+
- name: perist redis
99+
if: steps.redis-already-built.outcome != 'success'
100+
uses: actions/upload-artifact@v3
101+
with:
102+
name: redis-${{steps.get_config_versions.outputs.PACKAGEDREDISVERSION}}-${{inputs.arch}}
103+
path: |
104+
redis/src/redis-server
105+
redis/src/redis-sentinel
106+
redis/src/redis-check-aof
107+
redis/src/redis-check-rdb
108+
redis/src/redis-benchmark
109+
redis/src/redis-cli
110+
111+
- name: install s3cmd
112+
if: steps.redis-already-built.outcome != 'success'
113+
run: |
114+
pip3 install s3cmd
115+
116+
- name: persist redis to s3
117+
if: steps.redis-already-built.outcome != 'success' && steps.iamafork.outputs.IAMAFORK != 'false'
118+
run: |
119+
s3cmd --access_key=${{secrets.AWS_S3_ACCESS_KEY_ID}} \
120+
--secret_key=${{secrets.AWS_S3_SECRET_ACCESS_KEY}} \
121+
--region=us-east-1 \
122+
put -P redis-${{steps.get_config_versions.outputs.PACKAGEDREDISVERSION}}-${{inputs.osnick}}-${{inputs.arch}}.tgz \
123+
${{steps.get_config_versions.outputs.S3BASE}}/redis-${{steps.get_config_versions.outputs.PACKAGEDREDISVERSION}}-${{inputs.osnick}}-${{inputs.arch}}.tgz

.github/workflows/build-bsd.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Build (bsd) redis
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- 'docs/**'
7+
- 'README.md'
8+
branches:
9+
- master
10+
- '[0-9].[0-9]'
11+
- '[0-9].[0-9].[0-9]'
12+
pull_request:
13+
workflow_dispatch:
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-bsd
17+
cancel-in-progress: true
18+
19+
permissions:
20+
contents: read
21+
packages: write
22+
23+
jobs:
24+
25+
freebsd-13_2-x86-64:
26+
uses: ./.github/workflows/REUSABLE-bsd.yml
27+
secrets: inherit
28+
with:
29+
osversion: 13.2
30+
osname: freebsd
31+
machine_host: ubuntu-latest
32+
osnick: freebsd13.2
33+
outside_deps: sudo apt-get update -qq && sudo apt-get install -qqy jq
34+
deps: sudo pkg install -y bash gmake
35+
36+
freebsd-13_2-arm64:
37+
uses: ./.github/workflows/REUSABLE-bsd.yml
38+
secrets: inherit
39+
with:
40+
osversion: 13.2
41+
osname: freebsd
42+
machine_host: ubuntu-latest
43+
arch: arm64
44+
osnick: freebsd13.2
45+
outside_deps: sudo apt-get update -qq && sudo apt-get install -qqy jq
46+
deps: sudo pkg install -y bash gmake

.github/workflows/build-aarch64.yml renamed to .github/workflows/build-linux-aarch64.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: arm flow
1+
name: Build (arm64) redis
22

33
on:
44
push:
@@ -42,13 +42,13 @@ jobs:
4242
mode: start
4343
github-token: ${{ secrets.GH_ACCESS_TOKEN }}
4444
ec2-image-id: ${{ secrets.AWS_AMI_ID }}
45-
ec2-instance-type: t4g.medium
45+
ec2-instance-type: t4g.small
4646
subnet-id: ${{ secrets.AWS_SUBNET_ID }}
4747
security-group-id: ${{ secrets.AWS_SECGROUP_ID }}
4848

4949
ubuntu-bionic-arm64:
5050
needs: start-arm64-runner
51-
uses: ./.github/workflows/BUILD-REUSABLE.yml
51+
uses: ./.github/workflows/REUSABLE-linux.yml
5252
with:
5353
docker_image: ubuntu:18.04
5454
deps: apt-get update -qq && apt-get install -qqy build-essential libssl-dev python3 python3-pip jq wget
@@ -58,7 +58,7 @@ jobs:
5858

5959
ubuntu-focal-arm64:
6060
needs: start-arm64-runner
61-
uses: ./.github/workflows/BUILD-REUSABLE.yml
61+
uses: ./.github/workflows/REUSABLE-linux.yml
6262
with:
6363
docker_image: ubuntu:20.04
6464
deps: apt-get update -qq && apt-get install -qqy build-essential libssl-dev python3 python3-pip jq wget

0 commit comments

Comments
 (0)