Skip to content

Commit 66fa768

Browse files
Add CI to build nightly SDKs
1 parent a128207 commit 66fa768

4 files changed

Lines changed: 217 additions & 26 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
name: Build and Release
6+
7+
on:
8+
schedule:
9+
- cron: '0 0 * * *'
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: write
14+
15+
jobs:
16+
build-release:
17+
uses: './.github/workflows/build.yml'
18+
with:
19+
target_ref: 'nightly'
20+
variant: 'dynamic'
21+
build_type: 'release'
22+
23+
build-debug:
24+
uses: './.github/workflows/build.yml'
25+
with:
26+
target_ref: 'nightly'
27+
variant: 'dynamic'
28+
build_type: 'debug'
29+
30+
release:
31+
runs-on: ubuntu-latest
32+
needs: [build-release, build-debug]
33+
steps:
34+
- uses: actions/download-artifact@v4
35+
with:
36+
pattern: 'inochi2d-*'
37+
merge-multiple: true
38+
39+
- name: 'Release to nightly'
40+
uses: softprops/action-gh-release@v2
41+
with:
42+
tag_name: 'nightly'
43+
files: |
44+
*.tar
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
name: Build and Release
6+
7+
on:
8+
push:
9+
# Push all normally versioned tags
10+
tags:
11+
- 'v*'
12+
13+
permissions:
14+
contents: write
15+
16+
jobs:
17+
build-release:
18+
uses: './.github/workflows/build.yml'
19+
with:
20+
target_ref: '${{ github.ref_name }}'
21+
variant: 'dynamic'
22+
build_type: 'release'
23+
24+
build-debug:
25+
uses: './.github/workflows/build.yml'
26+
with:
27+
target_ref: '${{ github.ref_name }}'
28+
variant: 'dynamic'
29+
build_type: 'debug'
30+
31+
release:
32+
runs-on: ubuntu-latest
33+
needs: [build-release, build-debug]
34+
steps:
35+
- uses: actions/download-artifact@v4
36+
with:
37+
pattern: 'inochi2d-*'
38+
merge-multiple: true
39+
40+
- name: 'Release to ${{ github.ref_name }}'
41+
uses: softprops/action-gh-release@v2
42+
with:
43+
tag_name: ${{ github.ref_name }}
44+
files: |
45+
*.tar

.github/workflows/build-test.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
name: Test Builds
6+
7+
on:
8+
push:
9+
branches: [ "main", "v0_8" ]
10+
pull_request:
11+
types: [ "opened", "synchronize", "edited" ]
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
test:
18+
name: 'Build Library'
19+
strategy:
20+
matrix:
21+
os: [macOS-latest, ubuntu-latest, windows-latest]
22+
arch: [x86_64, arm64]
23+
dc: [ldc-beta, dmd-master]
24+
build: [debug, release]
25+
exclude:
26+
- { dc: dmd-master, arch: arm64 }
27+
28+
runs-on: ${{ matrix.os }}
29+
steps:
30+
- uses: actions/checkout@v4
31+
32+
- name: Install compiler
33+
uses: dlang-community/setup-dlang@v2
34+
with:
35+
compiler: ${{ matrix.dc }}
36+
37+
- name: 'Build with ${{ matrix.os }} ${{ matrix.dc }} (${{ matrix.build }})'
38+
run: |
39+
dub build --build=${{ matrix.build }}

.github/workflows/build.yml

Lines changed: 89 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,102 @@
1-
# This workflow uses actions that are not certified by GitHub.
2-
# They are provided by a third-party and are governed by
3-
# separate terms of service, privacy policy, and support
4-
# documentation.
5-
name: Test Builds
1+
name: 'Build Inochi2D Library'
2+
run-name: 'Build Inochi2D Library (${{ inputs.variant }})...'
63

74
on:
8-
push:
9-
branches: [ "main", "v0_8" ]
10-
pull_request:
11-
types: [ "opened", "synchronize", "edited" ]
5+
workflow_call:
6+
inputs:
7+
target_ref:
8+
required: false
9+
type: string
10+
default: '${{ github.ref_name }}'
11+
variant:
12+
required: true
13+
type: string
14+
build_type:
15+
required: false
16+
type: string
17+
default: release
18+
fail_fast:
19+
required: false
20+
type: boolean
21+
default: true
22+
outputs:
23+
artifact:
24+
description: 'The artifact that was produced.'
25+
value: ${{ jobs.build.outputs.artifact }}
26+
1227

1328
permissions:
14-
contents: read
29+
contents: write
1530

1631
jobs:
17-
test:
18-
name: 'Build Library'
32+
33+
build:
34+
runs-on: ${{ matrix.config.os }}
1935
strategy:
36+
fail-fast: ${{ inputs.fail_fast }}
2037
matrix:
21-
os: [macOS-latest, ubuntu-latest, windows-latest]
22-
arch: [x86_64, arm64]
23-
dc: [ldc-beta, dmd-master]
24-
build: [debug, release]
25-
exclude:
26-
- { dc: dmd-master, arch: arm64 }
27-
28-
runs-on: ${{ matrix.os }}
38+
config:
39+
- platform: 'osx'
40+
os: 'macos-latest'
41+
42+
- platform: 'win32'
43+
os: windows-latest
44+
45+
- platform: 'linux'
46+
os: ubuntu-
47+
outputs:
48+
artifact: '${{ steps.finalize.outputs.artifact }}'
49+
2950
steps:
3051
- uses: actions/checkout@v4
31-
32-
- name: Install compiler
33-
uses: dlang-community/setup-dlang@v2
3452
with:
35-
compiler: ${{ matrix.dc }}
53+
ref: '${{ inputs.target_ref }}'
54+
55+
# Setup D Compiler
56+
- uses: dlang-community/[email protected]
57+
with:
58+
compiler: ldc-latest
59+
60+
- name: 'Build (OSX Universal)'
61+
if: ${{ matrix.config.platform == 'osx' }}
62+
id: osx-build
63+
run: |
64+
dub build --compiler=ldc2 --build=${{ inputs.build_type }} --config=${{ inputs.variant }} --arch=x86_64
65+
mv out/libinochi2d.dylib out/libinochi2d-x86_64.dylib
3666
37-
- name: 'Build with ${{ matrix.os }} ${{ matrix.dc }} (${{ matrix.build }})'
67+
dub build --compiler=ldc2 --build=${{ inputs.build_type }} --config=${{ inputs.variant }} --arch=arm64-apple-macos
68+
mv out/libinochi2d.dylib out/libinochi2d-arm64.dylib
69+
70+
lipo out/libinochi2d-arm64.dylib out/libinochi2d-x86_64.dylib -output out/libinochi2d.dylib
71+
rm out/libinochi2d-arm64.dylib out/libinochi2d-x86_64.dylib
72+
73+
- name: 'Build (Windows)'
74+
if: ${{ matrix.config.platform == 'win32' }}
75+
id: win32-build
76+
shell: powershell
77+
run: |
78+
dub build --compiler=ldc2 --build=${{ inputs.build_type }} --config=${{ inputs.variant }}
79+
80+
- name: 'Build (Linux)'
81+
if: ${{ matrix.config.platform == 'linux' }}
82+
id: posix-build
83+
run: |
84+
dub build --compiler=ldc2 --build=${{ inputs.build_type }} --config=${{ inputs.variant }}
85+
86+
- name: 'Archive'
87+
id: archive
88+
run: |
89+
tar -cvf inochi2d-${{ matrix.config.platform }}-${{ inputs.build_type }}.tar out/* LICENSE
90+
91+
- name: 'Make Artifact'
92+
uses: actions/upload-artifact@v4
93+
with:
94+
name: 'inochi2d-${{ matrix.config.platform }}-${{ inputs.build_type }}'
95+
path: |
96+
inochi2d-${{ matrix.config.platform }}-${{ inputs.build_type }}.tar
97+
retention-days: 1
98+
99+
- name: 'Finalize'
100+
id: finalize
38101
run: |
39-
dub build --build=${{ matrix.build }}
102+
echo "artifact=inochi2d-${{ matrix.config.platform }}-${{ inputs.build_type }}" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)