Skip to content

Commit

Permalink
ci: test publish on macos arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
GenjiruSUchiwa committed Nov 24, 2024
1 parent fa1dd20 commit 3a56b16
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 8 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: publish

on:
push:
branches: [ develop ]

env:
DOTNET_VERSION: '9.0.100'
APP_NAME: Place.API
SOLUTION: Place.sln
API_PROJECT: src/Place.API/Place.API.csproj

jobs:
publish:
strategy:
matrix:
os: [macos-latest ]
include:
- os: macos-latest
runtime: osx
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

# Build and Test
- name: Restore dependencies
run: make restore SOLUTION=${{ env.SOLUTION }}

- name: Build solution
run: make build SOLUTION=${{ env.SOLUTION }}

- name: Run unit tests
run: make test-unit SOLUTION=${{ env.SOLUTION }}

- name: Run integration tests
run: make test-integration SOLUTION=${{ env.SOLUTION }}

# Publish binaries
- name: Publish x64
run: make publish RUNTIME=${{ matrix.runtime }} API_PROJECT=${{ env.API_PROJECT }} APP_NAME=${{ env.APP_NAME }}
env:
PUBLISH_OUTPUT: ./publish/arm64
28 changes: 20 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,27 @@ API_PROJECT := src/Place.API/Place.API.csproj

# Automatic architecture detection
ARCH := $(shell uname -m)
ifeq ($(ARCH),x86_64)
RUNTIME := linux-x64
DOCKER_ARCH := x64
else ifeq ($(ARCH),aarch64)
RUNTIME := linux-arm64
DOCKER_ARCH := arm64
OS := $(shell uname -s)

ifeq ($(OS),Darwin)
ifeq ($(ARCH),arm64)
RUNTIME := osx-arm64
DOCKER_ARCH := arm64
else
RUNTIME := osx-x64
DOCKER_ARCH := x64
endif
else
RUNTIME := linux-musl-x64
DOCKER_ARCH := x64
ifeq ($(ARCH),x86_64)
RUNTIME := linux-x64
DOCKER_ARCH := x64
else ifeq ($(ARCH),aarch64)
RUNTIME := linux-arm64
DOCKER_ARCH := arm64
else
RUNTIME := linux-musl-x64
DOCKER_ARCH := x64
endif
endif

# Colors for messages
Expand Down

0 comments on commit 3a56b16

Please sign in to comment.