Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

16 macos binary build workflow #36

Merged
merged 13 commits into from
Dec 2, 2024
31 changes: 31 additions & 0 deletions .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build Linux

on:
workflow_call:
workflow_dispatch:

jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
matrix:
platform:
- linux/amd64
- linux/arm64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.11.4
- run: ./Tools/mssql-proxy/odbc-driver-installer.sh
- run: pip install -r Tools/mssql-proxy/requirements.txt pyinstaller
- run: pyinstaller mssql-proxy.linux.spec
working-directory: Tools/mssql-proxy
- id: name
run: echo "platform_name=$(echo ${{ matrix.platform }} | sed 's:/:-:g')" >> $GITHUB_OUTPUT
- run: tar -czf mssql-proxy-${{ github.ref_name }}-${{ steps.name.outputs.platform_name }}.tar.gz Tools/mssql-proxy/dist
- uses: actions/upload-artifact@v4
with:
name: build-${{ steps.name.outputs.platform_name }}
path: mssql-proxy-${{ github.ref_name }}-${{ steps.name.outputs.platform_name }}.tar.gz

30 changes: 30 additions & 0 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build MacOS

on:
workflow_call:
workflow_dispatch:

jobs:
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.11.4

- name: Install UnixODBC and MSODBCSQL18
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
HOMEBREW_SANDBOX=1 HOMEBREW_ACCEPT_EULA=Y brew install unixodbc msodbcsql18

- run: pip install -r Tools/mssql-proxy/requirements.txt pyinstaller
- run: pyinstaller mssql-proxy.mac.spec
working-directory: Tools/mssql-proxy
- run: tar -czf mssql-proxy-${{ github.ref_name }}-macos.tar.gz Tools/mssql-proxy/dist
- uses: actions/upload-artifact@v4
with:
name: build-macos
path: mssql-proxy-${{ github.ref_name }}-macos.tar.gz

85 changes: 85 additions & 0 deletions .github/workflows/build-publish-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Build And Publish Docker

on:
workflow_call:
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
publish-docker:
runs-on: ubuntu-latest
if: github.ref_type == 'tag'
needs: [build-docker]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install cosign
uses: sigstore/cosign-installer@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ needs.build-docker.outputs.tags }}
labels: ${{ needs.build-docker.outputs.labels }}
platforms: linux/amd64, linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Sign the published Docker image
env:
TAGS: ${{ needs.build-docker.outputs.tags }}
DIGEST: ${{ steps.build-and-push.outputs.digest }}
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}

build-docker:
runs-on: ubuntu-latest
outputs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
steps:
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Extract Docker metadata
uses: docker/metadata-action@v5
id: meta
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build Docker images
id: build-and-push
uses: docker/build-push-action@v6
with:
context: .
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64, linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max

130 changes: 15 additions & 115 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,59 +12,32 @@ permissions:
id-token: write
packages: write

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
publish:
uses: ./.github/workflows/publish.yml
if: github.ref_type == 'tag'

build-linux:
uses: ./.github/workflows/build-linux.yml

build-windows:
uses: ./.github/workflows/build-windows.yml

build-macos:
uses: ./.github/workflows/build-macos.yml

build-publish-docker:
uses: ./.github/workflows/build-publish-docker.yml
needs: [publish, build-linux, build-windows, build-macos]

release:
runs-on: ubuntu-latest
if: github.ref_type == 'tag'
needs: [publish, build-linux, build-windows, build-docker]
needs: [build-publish-docker]
steps:
- name: Checkout
uses: actions/checkout@v4

# publish docker
- name: Install cosign
uses: sigstore/cosign-installer@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ needs.build-docker.outputs.tags }}
labels: ${{ needs.build-docker.outputs.labels }}
platforms: linux/amd64, linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Sign the published Docker image
env:
TAGS: ${{ needs.build-docker.outputs.tags }}
DIGEST: ${{ steps.build-and-push.outputs.digest }}
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}

# create release
- run: tar -czf mssql-proxy-${{ github.ref_name }}-source.tar.gz Tools/mssql-proxy
- uses: actions/download-artifact@v4
with:
Expand All @@ -81,77 +54,4 @@ jobs:
mssql-proxy-${{ github.ref_name }}-windows.zip
mssql-proxy-${{ github.ref_name }}-linux-amd64.tar.gz
mssql-proxy-${{ github.ref_name }}-linux-arm64.tar.gz

build-linux:
runs-on: ubuntu-latest
strategy:
matrix:
platform:
- linux/amd64
- linux/arm64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.11.4
- run: pip install -r Tools/mssql-proxy/requirements.txt pyinstaller
- run: ./Tools/mssql-proxy/odbc-driver-installer.sh
- run: pyinstaller mssql-proxy.linux.spec
working-directory: Tools/mssql-proxy
- id: name
run: echo "platform_name=$(echo ${{ matrix.platform }} | sed 's:/:-:g')" >> $GITHUB_OUTPUT
- run: tar -czf mssql-proxy-${{ github.ref_name }}-${{ steps.name.outputs.platform_name }}.tar.gz Tools/mssql-proxy/dist
- uses: actions/upload-artifact@v4
with:
name: build-${{ steps.name.outputs.platform_name }}
path: mssql-proxy-${{ github.ref_name }}-${{ steps.name.outputs.platform_name }}.tar.gz

build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.11.4
- run: pip install -r Tools/mssql-proxy/requirements.txt pyinstaller
- run: pyinstaller mssql-proxy.win.spec
working-directory: Tools/mssql-proxy
- run: tar -a -c -f mssql-proxy-${{ github.ref_name }}-windows.zip Tools/mssql-proxy/dist
- uses: actions/upload-artifact@v4
with:
name: build-windows
path: mssql-proxy-${{ github.ref_name }}-windows.zip

# build-macos:

build-docker:
runs-on: ubuntu-latest
outputs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
steps:
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Extract Docker metadata
uses: docker/metadata-action@v5
id: meta
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build Docker images
id: build-and-push
uses: docker/build-push-action@v6
with:
context: .
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64, linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
mssql-proxy-${{ github.ref_name }}-macos.tar.gz
6 changes: 1 addition & 5 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,13 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node: [ 20 ]

name: Node ${{ matrix.node }} sample
steps:
- uses: actions/checkout@v4
- name: Building rules and tests
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
node-version: 20
- run: npm ci
working-directory: Frontend
- run: npm run test-ci
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Build Windows

on:
workflow_call:
workflow_dispatch:

jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.11.4
- run: pip install -r Tools/mssql-proxy/requirements.txt pyinstaller
- run: pyinstaller mssql-proxy.win.spec
working-directory: Tools/mssql-proxy
- run: tar -a -c -f mssql-proxy-${{ github.ref_name }}-windows.zip Tools/mssql-proxy/dist
- uses: actions/upload-artifact@v4
with:
name: build-windows
path: mssql-proxy-${{ github.ref_name }}-windows.zip
2 changes: 1 addition & 1 deletion Frontend/src/app/downloads/downloads.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h2 class="bi bi-database"> MSSQl proxy server</h2>
<a role="button" class="bi bi-windows btn btn-success text-no-wrap" href="https://github.com/IPdotSetAF/CodeChef/releases/download/{{version}}/mssql-proxy-{{version}}-windows.zip"> Windows</a>
<a role="button" class="bi bi-ubuntu btn btn-success text-no-wrap" href="https://github.com/IPdotSetAF/CodeChef/releases/download/{{version}}/mssql-proxy-{{version}}-linux-amd64.tar.gz"> Linux - AMD64</a>
<a role="button" class="bi bi-ubuntu btn btn-success text-no-wrap" href="https://github.com/IPdotSetAF/CodeChef/releases/download/{{version}}/mssql-proxy-{{version}}-linux-arm64.tar.gz"> Linux - ARM64</a>
<a role="button" class="bi bi-apple btn btn-success text-no-wrap disabled" href="https://github.com/IPdotSetAF/CodeChef/releases/download/{{version}}/mssql-proxy-{{version}}-macos.tar.gz"> Mac OS</a>
<a role="button" class="bi bi-apple btn btn-success text-no-wrap" href="https://github.com/IPdotSetAF/CodeChef/releases/download/{{version}}/mssql-proxy-{{version}}-macos.tar.gz"> Mac OS</a>
<a role="button" class="bi bi-filetype-py btn btn-success text-no-wrap" href="https://github.com/IPdotSetAF/CodeChef/releases/download/{{version}}/mssql-proxy-{{version}}-source.tar.gz"> Python Source Code</a>
</div>
</div>
Expand Down
40 changes: 40 additions & 0 deletions Tools/mssql-proxy/mssql-proxy.mac.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# -*- mode: python ; coding: utf-8 -*-


a = Analysis(
['mssql-proxy.py'],
pathex=[],
binaries=[],
datas=[
('/opt/homebrew/Cellar/msodbcsql18', 'drivers/msodbcsql18')
],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
optimize=0,
)
pyz = PYZ(a.pure)

exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
[],
name='mssql-proxy',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)
Loading