Skip to content

Commit aa68179

Browse files
authored
Pipeline / Continuous Build (#3)
* chore: configure to generate univeral (multiarch) binary * wip: auto build (actions) * fix: download sdk * wip: macos build * update: fix matrix, make packages * fix: packaging * add: windows bcrypt unit tests * add: versioning & publish
1 parent 76ec26b commit aa68179

8 files changed

Lines changed: 263 additions & 31 deletions

File tree

.github/workflows/build.yml

Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
name: Build All
2+
3+
on:
4+
push:
5+
branches: ['main', 'dev', 'dev/*']
6+
tags:
7+
- 'v*.*.*'
8+
9+
pull_request:
10+
branches: ['main']
11+
12+
# Allows you to run this workflow manually from the Actions tab
13+
workflow_dispatch:
14+
15+
jobs:
16+
test:
17+
name: Test (Windows)
18+
runs-on: windows-latest
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
config: [Release, Debug]
23+
arch: [x64, x86]
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
with:
28+
submodules: recursive
29+
30+
- name: Download Foobar2000 SDK
31+
run: |
32+
curl -L https://www.foobar2000.org/files/SDK-2023-09-23.7z -o vendor/foobar2000_sdk.7z
33+
7z x vendor/foobar2000_sdk.7z -ovendor/sdk
34+
ls vendor/sdk
35+
36+
- name: Setup Msbuild
37+
uses: microsoft/setup-msbuild@v2
38+
39+
- name: Restore NuGet packages
40+
working-directory: ${{ github.workspace }}
41+
run: nuget restore foo_input_ncm.sln
42+
43+
- name: Build Test Executable
44+
working-directory: ${{ github.workspace }}
45+
run: |
46+
msbuild foo_input_ncm.sln -property:"Configuration=${{ matrix.config }};Platform=${{ matrix.arch}}" -target:foo_input_ncm_tests
47+
48+
- name: Run Tests (x86)
49+
working-directory: ${{ github.workspace }}/${{ matrix.config }}
50+
run: .\foo_input_ncm_tests.exe
51+
if: matrix.arch == 'x86'
52+
53+
- name: Run Tests (x64)
54+
working-directory: ${{ github.workspace }}/${{ matrix.arch }}/${{ matrix.config }}
55+
run: .\foo_input_ncm_tests.exe
56+
if: matrix.arch == 'x64'
57+
58+
matrix-build:
59+
name: Matrix Build
60+
runs-on: ${{ matrix.os }}
61+
needs: [test]
62+
strategy:
63+
fail-fast: false
64+
matrix:
65+
os: [windows-latest, macos-14]
66+
config: [Release, Debug]
67+
arch: [x64, x86]
68+
exclude:
69+
- os: macos-14
70+
arch: x86
71+
include:
72+
- os: windows-latest
73+
build-command: msbuild
74+
solution: foo_input_ncm.sln
75+
- os: macos-14
76+
build-command: xcodebuild
77+
workspace: foo_input_ncm.xcworkspace
78+
project: foo_input_ncm.xcodeproj
79+
80+
steps:
81+
- name: Checkout
82+
uses: actions/checkout@v4
83+
with:
84+
submodules: recursive
85+
fetch-tags: true
86+
fetch-depth: 0
87+
88+
- name: Versioning
89+
run: |
90+
TAG=$(git describe --tags)
91+
VERSION=${TAG:1}
92+
echo "#define CURRENT_VERSION $VERSION" >> src/stdafx.h
93+
echo "----------------------------"
94+
cat src/stdafx.h
95+
shell: bash
96+
working-directory: ${{ github.workspace }}
97+
98+
- name: Download Foobar2000 SDK
99+
run: |
100+
curl -L https://www.foobar2000.org/files/SDK-2023-09-23.7z -o vendor/foobar2000_sdk.7z
101+
7z x vendor/foobar2000_sdk.7z -ovendor/sdk
102+
ls vendor/sdk
103+
104+
- name: (XCode) Switch XCode Version
105+
run: |
106+
sudo xcode-select --switch /Applications/Xcode_15.3.app
107+
xcodebuild -version
108+
if: matrix.os == 'macos-14'
109+
110+
- name: (XCode) List Scheme
111+
run: |
112+
xcodebuild -list -workspace ${{ matrix.workspace }}
113+
echo Build with scheme: foo_input_ncm-${{ matrix.config }}
114+
if: matrix.os == 'macos-14'
115+
116+
- name: (XCode) Build component bundle
117+
env:
118+
scheme: foo_input_ncm-${{ matrix.config }}
119+
run: |
120+
xcodebuild clean build -workspace ${{ matrix.workspace }} -scheme "$scheme" -configuration ${{ matrix.config }}
121+
if: matrix.os == 'macos-14'
122+
123+
- name: (MSBuild) Setup MSBuild
124+
uses: microsoft/setup-msbuild@v2
125+
if: matrix.os == 'windows-latest'
126+
127+
- name: (MSBuild) Restore NuGet packages
128+
working-directory: ${{ github.workspace }}
129+
run: nuget restore ${{ matrix.solution }}
130+
if: matrix.os == 'windows-latest'
131+
132+
- name: (MSBuild) Build component dll
133+
working-directory: ${{ github.workspace }}
134+
run: msbuild ${{ matrix.solution }} -property:"Configuration=${{ matrix.config }};Platform=${{ matrix.arch}}" -target:foo_input_ncm
135+
if: matrix.os == 'windows-latest'
136+
137+
- name: Upload Artifacts
138+
uses: actions/upload-artifact@v4
139+
with:
140+
name: dist-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.config }}
141+
path: ${{ github.workspace }}/dist
142+
if-no-files-found: error
143+
pack:
144+
name: Make fb2k-componet package
145+
runs-on: ubuntu-latest
146+
needs: matrix-build
147+
steps:
148+
- name: Download Artifacts (MacOS bundle)
149+
uses: actions/download-artifact@v4
150+
with:
151+
pattern: dist-macos-*-Release
152+
153+
- name: Download Artifacts (Windows dll)
154+
uses: actions/download-artifact@v4
155+
with:
156+
pattern: dist-windows-*-Release
157+
158+
- name: Touch Directories
159+
run: |
160+
mkdir -p win32/x64
161+
mkdir -p macos/mac
162+
working-directory: ${{ github.workspace }}
163+
164+
- name: Pack component - Windows
165+
run: |
166+
cp ${{ github.workspace }}/dist-windows-latest-x86-Release/foo_input_ncm.dll .
167+
cp -r ${{ github.workspace }}/dist-windows-latest-x64-Release/x64 .
168+
zip -r ${{ github.workspace }}/foo_input_ncm-win32.fb2k-component ./*
169+
working-directory: ${{ github.workspace }}/win32
170+
171+
- name: Pack component - MacOS
172+
run: |
173+
cp -r ${{ github.workspace }}/dist-macos-14-x64-Release/mac .
174+
zip -r ${{ github.workspace }}/foo_input_ncm-macos.fb2k-component ./*
175+
working-directory: ${{ github.workspace }}/macos
176+
177+
- name: Upload Artifacts
178+
uses: actions/upload-artifact@v4
179+
with:
180+
name: packages
181+
path: '${{ github.workspace }}/*.fb2k-component'
182+
183+
release:
184+
name: Publish Release
185+
runs-on: ubuntu-latest
186+
needs: pack
187+
if: (github.event_name == 'workflow_dispatch') || (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
188+
steps:
189+
- name: Download Artifacts
190+
uses: actions/download-artifact@v4
191+
with:
192+
name: packages
193+
- name: Determine Release type
194+
id: check
195+
run: |
196+
if [[ "${{ github.ref }}" =~ ^refs/tags/v ]]; then
197+
echo "::set-output name=prerelease::false"
198+
else
199+
echo echo "::set-output name=prerelease::true"
200+
fi
201+
- name: Upload to Release
202+
uses: softprops/action-gh-release@v2
203+
with:
204+
files: ${{ github.workspace }}/*.fb2k-component
205+
make_latest: true
206+
generate_release_notes: true
207+
prerelease: ${{ steps.check.outputs.prerelease }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,3 +336,6 @@ fastlane/report.xml
336336
fastlane/Preview.html
337337
fastlane/screenshots/**/*.png
338338
fastlane/test_output
339+
340+
# distribution
341+
dist/

dist/.gitkeep

Whitespace-only changes.

foo_input_ncm.vcxproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@
121121
<GenerateDebugInformation>true</GenerateDebugInformation>
122122
<AdditionalDependencies>$(CoreLibraryDependencies);%(AdditionalDependencies);vendor/sdk/foobar2000/shared/shared-$(Platform).lib</AdditionalDependencies>
123123
</Link>
124+
<PostBuildEvent>
125+
<Message>copy built files</Message>
126+
<Command>copy $(TargetPath) $(ProjectDir)dist\</Command>
127+
</PostBuildEvent>
124128
</ItemDefinitionGroup>
125129
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
126130
<ClCompile>
@@ -161,6 +165,11 @@
161165
<GenerateDebugInformation>true</GenerateDebugInformation>
162166
<AdditionalDependencies>$(CoreLibraryDependencies);%(AdditionalDependencies);vendor/sdk/foobar2000/shared/shared-$(Platform).lib</AdditionalDependencies>
163167
</Link>
168+
<PostBuildEvent>
169+
<Message>copy built files</Message>
170+
<Command>mkdir $(ProjectDir)dist\$(Platform)
171+
copy $(TargetPath) $(ProjectDir)dist\$(Platform)\</Command>
172+
</PostBuildEvent>
164173
</ItemDefinitionGroup>
165174
<ItemGroup>
166175
<ClInclude Include="src\album_art_extractor.hpp" />

foo_input_ncm.xcodeproj/project.pbxproj

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,22 @@
2121
A3B738B32BD2632D00DF7424 /* aes_macos.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A3B738AB2BD1B31300DF7424 /* aes_macos.cpp */; };
2222
A3B738B42BD2632D00DF7424 /* aes_common.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A3B738A92BCFDDC800DF7424 /* aes_common.cpp */; };
2323
A3B738B52BD2634E00DF7424 /* libshared.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A3B738B02BD22E7300DF7424 /* libshared.a */; };
24+
A3B738B82BD2F35800DF7424 /* foo_input_ncm.component in CopyFiles */ = {isa = PBXBuildFile; fileRef = A3B7380C2BCCBC6700DF7424 /* foo_input_ncm.component */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
2425
/* End PBXBuildFile section */
2526

27+
/* Begin PBXCopyFilesBuildPhase section */
28+
A3B738B72BD2F32700DF7424 /* CopyFiles */ = {
29+
isa = PBXCopyFilesBuildPhase;
30+
buildActionMask = 2147483647;
31+
dstPath = "${PROJECT_DIR}/dist/mac";
32+
dstSubfolderSpec = 0;
33+
files = (
34+
A3B738B82BD2F35800DF7424 /* foo_input_ncm.component in CopyFiles */,
35+
);
36+
runOnlyForDeploymentPostprocessing = 0;
37+
};
38+
/* End PBXCopyFilesBuildPhase section */
39+
2640
/* Begin PBXFileReference section */
2741
A3B7380C2BCCBC6700DF7424 /* foo_input_ncm.component */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = foo_input_ncm.component; sourceTree = BUILT_PRODUCTS_DIR; };
2842
A3B738302BCCCF1A00DF7424 /* libpfc-Mac.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libpfc-Mac.a"; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -161,6 +175,7 @@
161175
A3B738082BCCBC6700DF7424 /* Sources */,
162176
A3B738092BCCBC6700DF7424 /* Frameworks */,
163177
A3B7380A2BCCBC6700DF7424 /* Resources */,
178+
A3B738B72BD2F32700DF7424 /* CopyFiles */,
164179
);
165180
buildRules = (
166181
);
@@ -186,7 +201,7 @@
186201
};
187202
};
188203
buildConfigurationList = A3B738072BCCBC6700DF7424 /* Build configuration list for PBXProject "foo_input_ncm" */;
189-
compatibilityVersion = "Xcode 14.0";
204+
compatibilityVersion = "Xcode 15.3";
190205
developmentRegion = en;
191206
hasScannedForEncodings = 0;
192207
knownRegions = (
@@ -305,7 +320,6 @@
305320
MACOSX_DEPLOYMENT_TARGET = 13.3;
306321
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
307322
MTL_FAST_MATH = YES;
308-
ONLY_ACTIVE_ARCH = YES;
309323
SDKROOT = macosx;
310324
STRIP_INSTALLED_PRODUCT = NO;
311325
VERSIONING_SYSTEM = "apple-generic";
@@ -375,7 +389,7 @@
375389
MACOSX_DEPLOYMENT_TARGET = 13.3;
376390
MTL_ENABLE_DEBUG_INFO = NO;
377391
MTL_FAST_MATH = YES;
378-
ONLY_ACTIVE_ARCH = YES;
392+
ONLY_ACTIVE_ARCH = NO;
379393
SDKROOT = macosx;
380394
VERSIONING_SYSTEM = "apple-generic";
381395
};
@@ -384,11 +398,11 @@
384398
A3B738112BCCBC6700DF7424 /* Debug */ = {
385399
isa = XCBuildConfiguration;
386400
buildSettings = {
387-
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
401+
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
388402
CODE_SIGN_STYLE = Automatic;
389403
COMBINE_HIDPI_IMAGES = YES;
390404
CURRENT_PROJECT_VERSION = 1;
391-
DEVELOPMENT_TEAM = 8PPLPSV8X2;
405+
DEVELOPMENT_TEAM = "";
392406
FRAMEWORK_SEARCH_PATHS = "";
393407
GCC_PREFIX_HEADER = src/stdafx.h;
394408
GENERATE_INFOPLIST_FILE = YES;
@@ -409,11 +423,11 @@
409423
A3B738122BCCBC6700DF7424 /* Release */ = {
410424
isa = XCBuildConfiguration;
411425
buildSettings = {
412-
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
426+
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
413427
CODE_SIGN_STYLE = Automatic;
414428
COMBINE_HIDPI_IMAGES = YES;
415429
CURRENT_PROJECT_VERSION = 1;
416-
DEVELOPMENT_TEAM = 8PPLPSV8X2;
430+
DEVELOPMENT_TEAM = "";
417431
FRAMEWORK_SEARCH_PATHS = "";
418432
GCC_PREFIX_HEADER = src/stdafx.h;
419433
GCC_PREPROCESSOR_DEFINITIONS = "NDEBUG=1";
@@ -423,6 +437,7 @@
423437
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
424438
MACOSX_DEPLOYMENT_TARGET = 13.3;
425439
MARKETING_VERSION = 0.3.0;
440+
ONLY_ACTIVE_ARCH = NO;
426441
PRODUCT_BUNDLE_IDENTIFIER = "pnck.foo-input-ncm";
427442
PRODUCT_NAME = "$(TARGET_NAME)";
428443
SKIP_INSTALL = YES;

foo_input_ncm.xcodeproj/xcshareddata/xcschemes/foo_input_ncm Debug.xcscheme renamed to foo_input_ncm.xcodeproj/xcshareddata/xcschemes/foo_input_ncm-Debug.xcscheme

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@
1212
buildForRunning = "YES"
1313
buildForProfiling = "NO"
1414
buildForArchiving = "NO"
15-
buildForAnalyzing = "NO">
15+
buildForAnalyzing = "YES">
1616
<AutocreatedTestPlanReference>
1717
</AutocreatedTestPlanReference>
1818
</BuildActionEntry>
1919
<BuildActionEntry
20-
buildForTesting = "NO"
20+
buildForTesting = "YES"
2121
buildForRunning = "YES"
2222
buildForProfiling = "NO"
2323
buildForArchiving = "NO"
24-
buildForAnalyzing = "NO">
24+
buildForAnalyzing = "YES">
2525
<BuildableReference
2626
BuildableIdentifier = "primary"
2727
BlueprintIdentifier = "A3B7380B2BCCBC6700DF7424"
@@ -75,15 +75,6 @@
7575
savedToolIdentifier = ""
7676
useCustomWorkingDirectory = "NO"
7777
debugDocumentVersioning = "YES">
78-
<MacroExpansion>
79-
<BuildableReference
80-
BuildableIdentifier = "primary"
81-
BlueprintIdentifier = "A3B7380B2BCCBC6700DF7424"
82-
BuildableName = "foo_input_ncm.component"
83-
BlueprintName = "foo_input_ncm"
84-
ReferencedContainer = "container:foo_input_ncm.xcodeproj">
85-
</BuildableReference>
86-
</MacroExpansion>
8778
</ProfileAction>
8879
<AnalyzeAction
8980
buildConfiguration = "Debug">

0 commit comments

Comments
 (0)