Skip to content

Commit d74db84

Browse files
committed
Shopify build workflow and local dev instructions
1 parent 4502796 commit d74db84

File tree

3 files changed

+116
-0
lines changed

3 files changed

+116
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Build and release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*-shopify-*'
7+
8+
jobs:
9+
build_and_release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Set up Go
15+
uses: actions/setup-go@v5
16+
with:
17+
go-version-file: go.mod
18+
19+
- name: Set up fpm
20+
shell: bash
21+
run: sudo gem install fpm
22+
23+
- name: Build
24+
shell: bash
25+
run: ./build.sh
26+
27+
- name: Get tag name
28+
run: echo "SOURCE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
29+
30+
- name: Checksum
31+
shell: bash
32+
run: |
33+
sha256sum /tmp/gh-ost-release/gh-ost*.deb /tmp/gh-ost-release/gh-ost*.tar.gz /tmp/gh-ost-release/gh-ost*.rpm > gh-ost-${{ env.SOURCE_TAG }}.sha256sum
34+
echo "sha256sum:"
35+
cat gh-ost-${{ env.SOURCE_TAG }}.sha256sum
36+
37+
- name: Upload action artifacts
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: gh-ost-${{ env.SOURCE_TAG }}
41+
path: /tmp/gh-ost-release/gh-ost*
42+
43+
- name: Create release
44+
run: gh release create --prerelease ${{ env.SOURCE_TAG }} /tmp/gh-ost-release/gh-ost*.deb /tmp/gh-ost-release/gh-ost*.tar.gz /tmp/gh-ost-release/gh-ost*.rpm
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README_Shopify.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
## Development setup for `gh-ost` at Shopify
2+
3+
Requirements:
4+
- podman, podman machine
5+
- docker client
6+
7+
Running go tests
8+
9+
```
10+
dev test
11+
```
12+
13+
Running `localtests` (integration test suite)
14+
15+
```
16+
dev localtests
17+
```
18+
19+
Run a single localtest
20+
```
21+
script/build
22+
23+
export PATH="${PATH}:$(pwd)/script"
24+
./localtests/test.sh -b bin/gh-ost -d swap-uk-uk
25+
```
26+
27+
## Git workflow
28+
29+
The following branched workflow ensures Shopify can contribute to the upstream repo, while maintaining a stable release channel and the ability to quickly iterate on features and patches to upstream `gh-ost`.
30+
31+
`master`: tracking `github/gh-ost@master`, our release branch where we merge new features and where we cut Shopify releases from using tags following a versioning scheme like `v1.1.7-shopify-1234567`, where the suffix is a short commit SHA. If there are changes in `github/gh-ost@master` that we synced but would not want release temporarily (e.g. until an official tagged release), we can create a new release branch to select the desired commits.
32+
33+
`username/feature-name`: feature branches where we open PRs both to `shopify/gh-ost@master` and `github/gh-ost@master`
34+
35+
Generally, Shopify-specific fixes should be avoided in favor of following the contributing guidelines of `github/gh-ost` and making sure all changes can be merged upstream. This ensures the fork won't diverge and the Shopify-specific build becomes the only long-term option to use it. Don't forget to open a GitHub issue (proposal) in `github/gh-ost` before opening upstream pull requests.
36+
37+
### Releasing gh-ost
38+
39+
1. `git tag v1.1.7-shopify-$(git rev-parse HEAD | cut -c1-7)`
40+
2. `git push your-shopify-remote --tags`
41+
3. A GitHub Actions workflow will build and release automatically.
42+
4. Go to the [releases](https://github.com/Shopify/gh-ost/releases) page, select your release and click the pencil icon and “Generate Release Notes”. This will automatically describe all PRs included, but may not include changes pulled from `master`, which you need to document manually.
43+
5. Grab the `.deb` file from the [releases](https://github.com/Shopify/gh-ost/releases) page. Find the corresponding checksum in the GitHub Action build logs.

dev.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: gh-ost
2+
3+
env:
4+
TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE: /var/run/docker.sock
5+
TESTCONTAINERS_RYUK_DISABLED: "true"
6+
7+
up:
8+
- go:
9+
version: "1.23.0"
10+
- podman
11+
- custom:
12+
name: Go Dependencies
13+
met?: go mod download
14+
meet: echo 'go mod failed to download dependencies'; false
15+
16+
commands:
17+
test:
18+
desc: Run all the tests.
19+
run: |
20+
export DOCKER_HOST=unix://$(podman machine inspect --format '{{.ConnectionInfo.PodmanSocket.Path}}')
21+
script/test
22+
localtests:
23+
desc: Run localtests.
24+
run: |
25+
export TEST_MYSQL_IMAGE="mysql:8.4"
26+
script/docker-gh-ost-replica-tests up
27+
script/docker-gh-ost-replica-tests run

0 commit comments

Comments
 (0)