Skip to content

Commit 46e517f

Browse files
committed
separated workflows
added workflow dispatch to all of builds added macos workflow
1 parent 471a7b2 commit 46e517f

File tree

6 files changed

+215
-115
lines changed

6 files changed

+215
-115
lines changed

.github/workflows/build-linux.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Build Linux
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
jobs:
8+
build-linux:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
platform:
13+
- linux/amd64
14+
- linux/arm64
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-python@v5
18+
with:
19+
python-version: 3.11.4
20+
- run: pip install -r Tools/mssql-proxy/requirements.txt pyinstaller
21+
- run: ./Tools/mssql-proxy/odbc-driver-installer.sh
22+
- run: pyinstaller mssql-proxy.linux.spec
23+
working-directory: Tools/mssql-proxy
24+
- id: name
25+
run: echo "platform_name=$(echo ${{ matrix.platform }} | sed 's:/:-:g')" >> $GITHUB_OUTPUT
26+
- run: tar -czf mssql-proxy-${{ github.ref_name }}-${{ steps.name.outputs.platform_name }}.tar.gz Tools/mssql-proxy/dist
27+
- uses: actions/upload-artifact@v4
28+
with:
29+
name: build-${{ steps.name.outputs.platform_name }}
30+
path: mssql-proxy-${{ github.ref_name }}-${{ steps.name.outputs.platform_name }}.tar.gz
31+

.github/workflows/build-macos.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Build MacOS
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
jobs:
8+
build-macos:
9+
runs-on: macos-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-python@v5
13+
with:
14+
python-version: 3.11.4
15+
- run: pip install -r Tools/mssql-proxy/requirements.txt pyinstaller
16+
- run: ./Tools/mssql-proxy/odbc-driver-installer.sh
17+
- run: pyinstaller mssql-proxy.mac.spec
18+
working-directory: Tools/mssql-proxy
19+
- run: tar -czf mssql-proxy-${{ github.ref_name }}-macos.tar.gz Tools/mssql-proxy/dist
20+
- uses: actions/upload-artifact@v4
21+
with:
22+
name: build-macos
23+
path: mssql-proxy-${{ github.ref_name }}-macos.tar.gz
24+
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Build And Publish Docker
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
env:
8+
REGISTRY: ghcr.io
9+
IMAGE_NAME: ${{ github.repository }}
10+
11+
jobs:
12+
publish-docker:
13+
runs-on: ubuntu-latest
14+
if: github.ref_type == 'tag'
15+
needs: [build-docker]
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Install cosign
21+
uses: sigstore/cosign-installer@v3
22+
23+
- name: Set up QEMU
24+
uses: docker/setup-qemu-action@v3
25+
26+
- name: Set up Docker Buildx
27+
uses: docker/setup-buildx-action@v3
28+
29+
- name: Log into registry ${{ env.REGISTRY }}
30+
uses: docker/login-action@v3
31+
with:
32+
registry: ${{ env.REGISTRY }}
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Build and push Docker image
37+
id: build-and-push
38+
uses: docker/build-push-action@v6
39+
with:
40+
context: .
41+
push: true
42+
tags: ${{ needs.build-docker.outputs.tags }}
43+
labels: ${{ needs.build-docker.outputs.labels }}
44+
platforms: linux/amd64, linux/arm64
45+
cache-from: type=gha
46+
cache-to: type=gha,mode=max
47+
48+
- name: Sign the published Docker image
49+
env:
50+
TAGS: ${{ needs.build-docker.outputs.tags }}
51+
DIGEST: ${{ steps.build-and-push.outputs.digest }}
52+
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
53+
54+
build-docker:
55+
runs-on: ubuntu-latest
56+
outputs:
57+
tags: ${{ steps.meta.outputs.tags }}
58+
labels: ${{ steps.meta.outputs.labels }}
59+
steps:
60+
- uses: actions/checkout@v4
61+
62+
- name: Set up QEMU
63+
uses: docker/setup-qemu-action@v3
64+
65+
- name: Set up Docker Buildx
66+
uses: docker/setup-buildx-action@v3
67+
68+
- name: Extract Docker metadata
69+
uses: docker/metadata-action@v5
70+
id: meta
71+
with:
72+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
73+
74+
- name: Build Docker images
75+
id: build-and-push
76+
uses: docker/build-push-action@v6
77+
with:
78+
context: .
79+
push: false
80+
tags: ${{ steps.meta.outputs.tags }}
81+
labels: ${{ steps.meta.outputs.labels }}
82+
platforms: linux/amd64, linux/arm64
83+
cache-from: type=gha
84+
cache-to: type=gha,mode=max
85+

.github/workflows/build-release.yml

Lines changed: 15 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -12,59 +12,32 @@ permissions:
1212
id-token: write
1313
packages: write
1414

15-
env:
16-
REGISTRY: ghcr.io
17-
IMAGE_NAME: ${{ github.repository }}
18-
1915
jobs:
2016
publish:
2117
uses: ./.github/workflows/publish.yml
2218
if: github.ref_type == 'tag'
2319

20+
build-linux:
21+
uses: ./.github/workflows/build-linux.yml
22+
23+
build-windows:
24+
uses: ./.github/workflows/build-windows.yml
25+
26+
build-macos:
27+
uses: ./.github/workflows/build-macos.yml
28+
29+
build-publish-docker:
30+
uses: ./.github/workflows/build-publish-docker.yml
31+
needs: [publish, build-linux, build-windows, build-macos]
32+
2433
release:
2534
runs-on: ubuntu-latest
2635
if: github.ref_type == 'tag'
27-
needs: [publish, build-linux, build-windows, build-docker]
36+
needs: [build-publish-docker]
2837
steps:
2938
- name: Checkout
3039
uses: actions/checkout@v4
3140

32-
# publish docker
33-
- name: Install cosign
34-
uses: sigstore/cosign-installer@v3
35-
36-
- name: Set up QEMU
37-
uses: docker/setup-qemu-action@v3
38-
39-
- name: Set up Docker Buildx
40-
uses: docker/setup-buildx-action@v3
41-
42-
- name: Log into registry ${{ env.REGISTRY }}
43-
uses: docker/login-action@v3
44-
with:
45-
registry: ${{ env.REGISTRY }}
46-
username: ${{ github.actor }}
47-
password: ${{ secrets.GITHUB_TOKEN }}
48-
49-
- name: Build and push Docker image
50-
id: build-and-push
51-
uses: docker/build-push-action@v6
52-
with:
53-
context: .
54-
push: true
55-
tags: ${{ needs.build-docker.outputs.tags }}
56-
labels: ${{ needs.build-docker.outputs.labels }}
57-
platforms: linux/amd64, linux/arm64
58-
cache-from: type=gha
59-
cache-to: type=gha,mode=max
60-
61-
- name: Sign the published Docker image
62-
env:
63-
TAGS: ${{ needs.build-docker.outputs.tags }}
64-
DIGEST: ${{ steps.build-and-push.outputs.digest }}
65-
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
66-
67-
# create release
6841
- run: tar -czf mssql-proxy-${{ github.ref_name }}-source.tar.gz Tools/mssql-proxy
6942
- uses: actions/download-artifact@v4
7043
with:
@@ -81,77 +54,4 @@ jobs:
8154
mssql-proxy-${{ github.ref_name }}-windows.zip
8255
mssql-proxy-${{ github.ref_name }}-linux-amd64.tar.gz
8356
mssql-proxy-${{ github.ref_name }}-linux-arm64.tar.gz
84-
85-
build-linux:
86-
runs-on: ubuntu-latest
87-
strategy:
88-
matrix:
89-
platform:
90-
- linux/amd64
91-
- linux/arm64
92-
steps:
93-
- uses: actions/checkout@v4
94-
- uses: actions/setup-python@v5
95-
with:
96-
python-version: 3.11.4
97-
- run: pip install -r Tools/mssql-proxy/requirements.txt pyinstaller
98-
- run: ./Tools/mssql-proxy/odbc-driver-installer.sh
99-
- run: pyinstaller mssql-proxy.linux.spec
100-
working-directory: Tools/mssql-proxy
101-
- id: name
102-
run: echo "platform_name=$(echo ${{ matrix.platform }} | sed 's:/:-:g')" >> $GITHUB_OUTPUT
103-
- run: tar -czf mssql-proxy-${{ github.ref_name }}-${{ steps.name.outputs.platform_name }}.tar.gz Tools/mssql-proxy/dist
104-
- uses: actions/upload-artifact@v4
105-
with:
106-
name: build-${{ steps.name.outputs.platform_name }}
107-
path: mssql-proxy-${{ github.ref_name }}-${{ steps.name.outputs.platform_name }}.tar.gz
108-
109-
build-windows:
110-
runs-on: windows-latest
111-
steps:
112-
- uses: actions/checkout@v4
113-
- uses: actions/setup-python@v5
114-
with:
115-
python-version: 3.11.4
116-
- run: pip install -r Tools/mssql-proxy/requirements.txt pyinstaller
117-
- run: pyinstaller mssql-proxy.win.spec
118-
working-directory: Tools/mssql-proxy
119-
- run: tar -a -c -f mssql-proxy-${{ github.ref_name }}-windows.zip Tools/mssql-proxy/dist
120-
- uses: actions/upload-artifact@v4
121-
with:
122-
name: build-windows
123-
path: mssql-proxy-${{ github.ref_name }}-windows.zip
124-
125-
# build-macos:
126-
127-
build-docker:
128-
runs-on: ubuntu-latest
129-
outputs:
130-
tags: ${{ steps.meta.outputs.tags }}
131-
labels: ${{ steps.meta.outputs.labels }}
132-
steps:
133-
- uses: actions/checkout@v4
134-
135-
- name: Set up QEMU
136-
uses: docker/setup-qemu-action@v3
137-
138-
- name: Set up Docker Buildx
139-
uses: docker/setup-buildx-action@v3
140-
141-
- name: Extract Docker metadata
142-
uses: docker/metadata-action@v5
143-
id: meta
144-
with:
145-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
146-
147-
- name: Build Docker images
148-
id: build-and-push
149-
uses: docker/build-push-action@v6
150-
with:
151-
context: .
152-
push: false
153-
tags: ${{ steps.meta.outputs.tags }}
154-
labels: ${{ steps.meta.outputs.labels }}
155-
platforms: linux/amd64, linux/arm64
156-
cache-from: type=gha
157-
cache-to: type=gha,mode=max
57+
mssql-proxy-${{ github.ref_name }}-macos.tar.gz
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Build Windows
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
jobs:
8+
build-windows:
9+
runs-on: windows-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-python@v5
13+
with:
14+
python-version: 3.11.4
15+
- run: pip install -r Tools/mssql-proxy/requirements.txt pyinstaller
16+
- run: pyinstaller mssql-proxy.win.spec
17+
working-directory: Tools/mssql-proxy
18+
- run: tar -a -c -f mssql-proxy-${{ github.ref_name }}-windows.zip Tools/mssql-proxy/dist
19+
- uses: actions/upload-artifact@v4
20+
with:
21+
name: build-windows
22+
path: mssql-proxy-${{ github.ref_name }}-windows.zip
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# -*- mode: python ; coding: utf-8 -*-
2+
3+
4+
a = Analysis(
5+
['mssql-proxy.py'],
6+
pathex=[],
7+
binaries=[],
8+
datas=[],
9+
hiddenimports=[],
10+
hookspath=[],
11+
hooksconfig={},
12+
runtime_hooks=[],
13+
excludes=[],
14+
noarchive=False,
15+
optimize=0,
16+
)
17+
pyz = PYZ(a.pure)
18+
19+
exe = EXE(
20+
pyz,
21+
a.scripts,
22+
a.binaries,
23+
a.datas,
24+
[],
25+
name='mssql-proxy',
26+
debug=False,
27+
bootloader_ignore_signals=False,
28+
strip=False,
29+
upx=True,
30+
upx_exclude=[],
31+
runtime_tmpdir=None,
32+
console=True,
33+
disable_windowed_traceback=False,
34+
argv_emulation=False,
35+
target_arch=None,
36+
codesign_identity=None,
37+
entitlements_file=None,
38+
)

0 commit comments

Comments
 (0)