Skip to content

Commit 22eea63

Browse files
kimdvpepicrft
andauthored
fix: order for XCLocalSwiftPackageReference and XCRemoteSwiftPackageReference (#855)
* Flip the order of `XCLocalSwiftPackageReference` and `XCRemoteSwiftPackageReference` * Add tasks to run tests and build the package in Linux from a macOS environment using Podman * Install Swift in the Linux environments * Remove Tests/LinuxMain.swift * Build and test in a virtualized Linux container from the macOS environment * Set up Docker * Install Podman * Initialize the machine before starting it * Run from ubuntu-latest --------- Co-authored-by: Pedro <[email protected]>
1 parent 46fe156 commit 22eea63

File tree

9 files changed

+102
-79
lines changed

9 files changed

+102
-79
lines changed

.github/workflows/xcodeproj.yml

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,42 +20,34 @@ jobs:
2020
runs-on: macos-latest
2121
steps:
2222
- uses: actions/checkout@v3
23-
- uses: maxim-lobanov/setup-xcode@v1
24-
with:
25-
xcode-version: latest-stable
23+
- uses: jdx/mise-action@v2
2624
- name: Build
27-
run: swift build -c release
25+
run: mise run build
2826
build-linux:
2927
name: Build (Linux)
3028
runs-on: ubuntu-latest
3129
steps:
3230
- uses: actions/checkout@v3
31+
- uses: jdx/mise-action@v2
3332
- name: Build
34-
run: swift build -c release
33+
run: mise run build-linux
3534
test:
3635
name: Test (macOS / Xcode)
3736
runs-on: macos-latest
3837
steps:
3938
- uses: actions/checkout@v3
40-
- uses: maxim-lobanov/setup-xcode@v1
41-
with:
42-
xcode-version: latest-stable
39+
- uses: jdx/mise-action@v2
4340
- name: Run tests
44-
run: swift test --enable-code-coverage
45-
- name: Send test coverage report
46-
run: bash <(curl -s https://codecov.io/bash)
41+
run: mise run test
42+
4743
test-linux:
4844
name: Test (Linux)
4945
runs-on: ubuntu-latest
5046
steps:
5147
- uses: actions/checkout@v3
52-
- name: Set Git config
53-
run: |
54-
git config --global user.email "[email protected]"
55-
git config --global user.name "xcodeproj"
56-
git config --global init.defaultBranch main
57-
- name: Build and run tests
58-
run: swift test --enable-test-discovery
48+
- uses: jdx/mise-action@v2
49+
- name: Test
50+
run: mise run test-linux
5951

6052
lint:
6153
name: Lint

.mise.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
swiftformat = "0.54.3"
33
tuist = "4.27.0"
44
swiftlint = "0.55.1"
5+
swift="5.10.1"
56
"git-cliff" = "2.4.0"

.mise/tasks/build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
# mise description="Build the package in the host"
3+
4+
swift build --package-path $MISE_PROJECT_ROOT --configuration debug

.mise/tasks/build-linux

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
# mise description="Build on Linux"
3+
4+
CONTAINER_RUNTIME=$(command -v podman || command -v docker)
5+
6+
if [ -z "$CONTAINER_RUNTIME" ]; then
7+
echo "Neither podman nor docker is available. Please install one to proceed."
8+
exit 1
9+
fi
10+
11+
$CONTAINER_RUNTIME run --rm --interactive --tty --volume "$(pwd):/package" --workdir "/package" swift:5.10.1 bash -c "
12+
git config --global user.email '[email protected]' &&
13+
git config --global user.name 'xcodeproj' &&
14+
git config --global init.defaultBranch main &&
15+
swift build --configuration release
16+
"

.mise/tasks/test

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
# mise description="Run tests in the host"
3+
4+
swift test --package-path $MISE_PROJECT_ROOT

.mise/tasks/test-linux

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
# mise description="Run tests on Linux"
3+
4+
CONTAINER_RUNTIME=$(command -v podman || command -v docker)
5+
6+
if [ -z "$CONTAINER_RUNTIME" ]; then
7+
echo "Neither podman nor docker is available. Please install one to proceed."
8+
exit 1
9+
fi
10+
11+
$CONTAINER_RUNTIME run --rm --interactive --tty --volume "$(pwd):/package" --workdir "/package" swift:5.10.1 bash -c "
12+
git config --global user.email '[email protected]' &&
13+
git config --global user.name 'xcodeproj' &&
14+
git config --global init.defaultBranch main &&
15+
swift test
16+
"

Package.resolved

Lines changed: 47 additions & 49 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/XcodeProj/Objects/Project/PBXProjEncoder.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,15 +215,15 @@ final class PBXProjEncoder {
215215
outputSettings: outputSettings,
216216
stateHolder: &stateHolder,
217217
to: &output)
218-
try write(section: "XCRemoteSwiftPackageReference",
218+
try write(section: "XCLocalSwiftPackageReference",
219219
proj: proj,
220-
objects: proj.objects.remoteSwiftPackageReferences,
220+
objects: proj.objects.localSwiftPackageReferences,
221221
outputSettings: outputSettings,
222222
stateHolder: &stateHolder,
223223
to: &output)
224-
try write(section: "XCLocalSwiftPackageReference",
224+
try write(section: "XCRemoteSwiftPackageReference",
225225
proj: proj,
226-
objects: proj.objects.localSwiftPackageReferences,
226+
objects: proj.objects.remoteSwiftPackageReferences,
227227
outputSettings: outputSettings,
228228
stateHolder: &stateHolder,
229229
to: &output)

Tests/LinuxMain.swift

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)