Skip to content

Commit 7ff9ee3

Browse files
authored
workflow: switch to cargo-msfs for building the package (#12)
* workflow(cherrypick): switch to cargo-msfs * chore: update npm workflow run * workflow: attempt to fix new build * workflow: more fixes * workflow: try windows build * workflow: change clang version * workflow: try newer ubuntu * workflow: trying manual clang version * workflow: change clang version * workflow: try windows one last time * fix: package comparison now includes revisions * workflow(fix): correct version of windows * workflow(fix): switch to a different clang installer * workflow(fix): now autocreates the out folder * workflow(fix): final workflow fix * workflow(test): is the preopens issue local * workflow(fix): add winpty to call * fix: implement course for dfdv2 * feat: add description_code to fix output * fix: change test to test-workflow * fix: move winpty * chore: update package version
1 parent a177538 commit 7ff9ee3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+331
-250
lines changed

.cargo/config.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[target.wasm32-wasi]
1+
[target.wasm32-wasip1]
22
rustflags = [
33
"-Ctarget-feature=-crt-static,+bulk-memory",
44
"-Clink-self-contained=no",
@@ -21,4 +21,4 @@ rustflags = [
2121
]
2222

2323
[build]
24-
target = "wasm32-wasi"
24+
target = "wasm32-wasip1"

.github/workflows/pr.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050

5151
build-test:
5252
name: Build & test 🛠️
53-
runs-on: ubuntu-latest
53+
runs-on: windows-2022
5454
if: ${{ !github.event.pull_request.draft && !contains(github.event.pull_request.labels.*.name , 'release') }}
5555
steps:
5656
- name: Checkout
@@ -60,10 +60,23 @@ jobs:
6060

6161
- name: Create env file
6262
run: |
63-
touch .env
6463
echo NAVIGATION_DATA_SIGNED_URL=${{ secrets.NAVIGATION_DATA_SIGNED_URL }} >> .env
6564
echo NAVIGATION_DATA_SIGNED_URL_V2=${{ secrets.NAVIGATION_DATA_SIGNED_URL_V2 }} >> .env
6665
66+
- name: Install LLVM and Clang
67+
uses: KyleMayes/[email protected]
68+
with:
69+
version: "17.0.6"
70+
71+
- name: Cache cargo-msfs
72+
uses: actions/cache@v4
73+
with:
74+
path: ~\.cargo\bin
75+
key: ${{ runner.os }}-cargo-msfs
76+
77+
- name: Setup
78+
run: npm run setup
79+
6780
- name: Build WASM module
6881
run: npm run build:wasm-workflow
6982

.github/workflows/pre-release.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,24 @@ run-name: Create pre-release for `${{ github.ref_name }}`
1010

1111
jobs:
1212
release-wasm:
13-
runs-on: ubuntu-latest
13+
runs-on: windows-2022
1414
steps:
1515
- uses: actions/checkout@v4
1616

17+
- name: Install LLVM and Clang
18+
uses: KyleMayes/[email protected]
19+
with:
20+
version: "17.0.6"
21+
22+
- name: Cache cargo-msfs
23+
uses: actions/cache@v4
24+
with:
25+
path: ~\.cargo\bin
26+
key: ${{ runner.os }}-cargo-msfs
27+
28+
- name: Setup
29+
run: npm run setup
30+
1731
- name: Build WASM module
1832
run: npm run build:wasm-workflow
1933

.github/workflows/release.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,24 @@ run-name: Create release for `${{ github.ref_name }}`
1111

1212
jobs:
1313
release-wasm:
14-
runs-on: ubuntu-latest
14+
runs-on: windows-2022
1515
steps:
1616
- uses: actions/checkout@v4
1717

18+
- name: Install LLVM and Clang
19+
uses: KyleMayes/[email protected]
20+
with:
21+
version: "17.0.6"
22+
23+
- name: Cache cargo-msfs
24+
uses: actions/cache@v4
25+
with:
26+
path: ~\.cargo\bin
27+
key: ${{ runner.os }}-cargo-msfs
28+
29+
- name: Setup
30+
run: npm run setup
31+
1832
- name: Build WASM module
1933
run: npm run build:wasm-workflow
2034

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ lto = true
88
strip = true
99

1010
[patch.crates-io]
11-
rusqlite = { git = "https://github.com/navigraph/rusqlite", rev = "7921774" }
11+
rusqlite = { git = "https://github.com/navigraph/rusqlite", rev = "f716d5c" }

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Before building, make sure you have properly created and set an `.env` file in `
6262

6363
## Building the WASM Module Yourself
6464

65-
1. [Download](https://www.docker.com/products/docker-desktop/) Docker Desktop
65+
1. [Install](https://github.com/navigraph/cargo-msfs) cargo-msfs
6666
2. Run `npm run build:wasm` (must be on Windows)
6767
- This will take a while to download and build the first time, but subsequent runs will be quicker
6868
3. The compiled WASM module will be copied to `out` **and** `examples/aircraft/PackageSources/SimObjects/Airplanes/Navigraph_Navigation_Data_Interface_Aircraft/panel`

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
"scripts": {
77
"format": "prettier --write .",
88
"lint:js": "eslint \"src/js/**/*.ts\"",
9+
"setup": ".\\scripts\\setup.bat",
910
"build:wasm": ".\\scripts\\build.bat",
10-
"build:wasm-workflow": "./scripts/run_docker_cmd.sh ./scripts/build.sh",
11+
"build:wasm-workflow": ".\\scripts\\build_workflow.bat",
1112
"build:js": "cd .\\src\\js && npm run build",
1213
"build:gauge": "cd .\\examples\\gauge && npm run build",
1314
"dev:gauge": "cd .\\examples\\gauge && npm run dev",
1415
"jest": "jest --verbose",
1516
"test": ".\\scripts\\test.bat",
16-
"test-workflow": "./scripts/test.sh",
17+
"test-workflow": ".\\scripts\\test_workflow.bat",
1718
"docker": ".\\scripts\\run_docker_cmd.bat"
1819
},
1920
"devDependencies": {

rust-toolchain.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[toolchain]
22
profile = "default"
3-
channel = "1.79.0"
3+
channel = "1.83"
4+
targets = ["wasm32-wasip1"]

scripts/build.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
cd %~dp0
44

5-
call .\run_docker_cmd.bat ./scripts/build.sh
5+
mkdir ..\out
66

7-
cd %~dp0
7+
cargo-msfs build msfs2020 -i .. -o ..\out\msfs_navigation_data_interface.wasm
88

99
copy ..\out\msfs_navigation_data_interface.wasm ..\examples\aircraft\PackageSources\SimObjects\Airplanes\Navigraph_Navigation_Data_Interface_Aircraft\panel

0 commit comments

Comments
 (0)