-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cross compilation for Linux, MacOS, and Windows (#18)
* Added Windows specific modifications of the DMD compiler imvocation to enable compilation on Windows. * Added executableName() for Windows' ".exe" extension as suggested by @linkrope and using it build(). * Get rid of OS specific file path separators as suggested by @linkrope in #17 (comment). * Enabled matrix build for Linux, MaxOS, and Windows and the according tests. * Renamed build.yml to ci.yml as discussed on PR here: https://github.com/linkrope/gamma/pull/17/files/11c93a9229e028f778573de87b4f478dda96f508#r1437757527 * Refactored out reusable workflows from ci.yml, to refernce them later there and in release.yml * Added uploading of built executables * Avoid CI workflow is running on release publications and within twice, once for the tag pushed for release and second for the release event. This was found in https://stackoverflow.com/questions/70743715/how-do-i-configure-a-github-actions-workflow-so-it-does-not-run-on-a-tag-push * Improved matrix names in GH Actions GUI * Refactored out upload workflow into upload.yml to have the same abstractions levels for jobs in release.yml * Attempt to optimize the built artifacts using a specific build type. * Switched to single workflow in build.yml for CI and release builds. * Get rid of DMD compiler at all for build. gamma now supports to use any $DC defined D compiler for target compiler compiling.
- Loading branch information
Showing
10 changed files
with
262 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Build & Test Gamma | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
compiler_version: | ||
type: string | ||
required: true | ||
build_type: | ||
type: string | ||
required: false | ||
default: "debug" | ||
|
||
jobs: | ||
build: | ||
name: build & test Gamma | ||
strategy: | ||
matrix: | ||
os: [Windows, Linux, MacOS] | ||
include: | ||
- os: Windows | ||
runner: windows-latest | ||
upload-path: ./gamma.exe | ||
upload-name: gamma.windows-amd64.exe | ||
- os: Linux | ||
runner: ubuntu-latest | ||
upload-path: ./gamma | ||
upload-name: gamma.linux-amd64 | ||
- os: MacOS | ||
runner: macOS-latest | ||
upload-path: ./gamma | ||
upload-name: gamma.macos-amd64 | ||
|
||
runs-on: ${{ matrix.runner }} | ||
|
||
steps: | ||
- name: Checkout source code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install LDC compiler for building gamma | ||
uses: dlang-community/setup-dlang@v1 | ||
with: | ||
compiler: ${{ inputs.compiler_version }} | ||
|
||
- name: Build & run tests | ||
run: | | ||
dub build --build=${{inputs.build_type}} | ||
dub test --build=unittest --config=example | ||
- name: Upload executables to workflow run page | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.upload-name }} | ||
path: ${{ matrix.upload-path }} | ||
retention-days: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Check Gamma Project | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
compiler_version: | ||
type: string | ||
required: true | ||
|
||
jobs: | ||
check: | ||
name: Check Style | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install D compiler | ||
uses: dlang-community/setup-dlang@v1 | ||
with: | ||
compiler: ${{ inputs.compiler_version }} | ||
|
||
- run: | | ||
dub fetch dscanner@0.14.0 | ||
- name: Check style | ||
run: | | ||
dub run dscanner -- --styleCheck src test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,20 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- "*" | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: dlang-community/setup-dlang@v1 | ||
with: | ||
compiler: dmd-2.103.1 | ||
|
||
- name: Build | ||
run: | | ||
dub build --compiler=$DC | ||
|
||
- name: Test | ||
run: | | ||
dub test --compiler=$DC --config=example | ||
build: | ||
name: build & test | ||
uses: ./.github/workflows/build.yml | ||
with: | ||
compiler_version: ldc-1.37.0 | ||
|
||
check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: dlang-community/setup-dlang@v1 | ||
with: | ||
compiler: dmd-latest | ||
|
||
- run: | | ||
dub fetch dscanner@0.14.0 | ||
- name: Check Style | ||
run: | | ||
dub run dscanner -- --styleCheck src test | ||
uses: ./.github/workflows/check.yml | ||
with: | ||
compiler_version: dmd-2.107.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Release | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
|
||
build: | ||
name: build & test | ||
uses: ./.github/workflows/build.yml | ||
with: | ||
compiler_version: ldc-1.33.0 | ||
build_type: release-gamma | ||
|
||
upload: | ||
uses: ./.github/workflows/upload.yml | ||
secrets: inherit | ||
needs: build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Upload release binaries | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
upload: | ||
name: Upload release binary | ||
strategy: | ||
matrix: | ||
os: [Windows, Linux, MacOS] | ||
include: | ||
- os: Windows | ||
exe-name: gamma.windows-amd64.exe | ||
rename: mv ./gamma.exe | ||
- os: Linux | ||
exe-name: gamma.linux-amd64 | ||
rename: mv ./gamma | ||
- os: MacOS | ||
exe-name: gamma.macos-amd64 | ||
rename: mv ./gamma | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download binary from previous build job | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ${{ matrix.exe-name }} | ||
|
||
- name: Give binary a unique name | ||
run: ${{ matrix.rename }} ${{ matrix.exe-name }} | ||
|
||
- name: Upload release binary | ||
uses: AButler/upload-release-assets@v3.0 | ||
with: | ||
files: ${{ matrix.exe-name }} | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.