Skip to content

Commit 7eb46cd

Browse files
committed
fix: mac release
1 parent 2bc69f9 commit 7eb46cd

File tree

2 files changed

+45
-6
lines changed

2 files changed

+45
-6
lines changed

.github/workflows/release.yml

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,17 @@ jobs:
3434
with:
3535
submodules: true
3636

37+
- name: Install rust
38+
uses: actions-rs/toolchain@v1
39+
if: ${{ matrix.config.os == 'macOS-latest' }}
40+
with:
41+
toolchain: stable
42+
profile: minimal
43+
override: true
44+
target: aarch64-apple-darwin
45+
3746
- name: Setup | Rust
47+
if: ${{ matrix.config.os == 'ubuntu-latest' }}
3848
uses: ATiltedTree/setup-rust@v1
3949
with:
4050
rust-version: "1.62.1"
@@ -50,7 +60,17 @@ jobs:
5060
target/
5161
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
5262

63+
- name: Install LLVM mac
64+
if: ${{ matrix.config.os == 'macOS-latest' }}
65+
run: |
66+
mkdir arm-homebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C arm-homebrew
67+
alias arm-brew='$(pwd)/arm-homebrew/bin/brew'
68+
response=$(./arm-homebrew/bin/brew fetch --force --bottle-tag=arm64_big_sur llvm@14 | grep "Downloaded to")
69+
parsed=($response)
70+
./arm-homebrew/bin/brew install $parsed[3]
71+
echo "LLVM_SYS_140_PREFIX=$(./arm-homebrew/bin/brew --prefix llvm@14)" >> $GITHUB_ENV
5372
- name: Install LLVM
73+
if: ${{ matrix.config.os == 'ubuntu-latest' }}
5474
uses: Pivot-Studio/setup-llvm@main
5575

5676
- name: set up win scoop
@@ -83,17 +103,29 @@ jobs:
83103
run: cargo build --release --verbose
84104

85105
- name: Cargo build
86-
if: ${{ matrix.config.os != 'windows-latest' }}
106+
if: ${{ matrix.config.os == 'ubuntu-latest' }}
87107
env:
88108
RUSTFLAGS: ${{ matrix.config.RUSTFLAGS }}
89109
run: cargo build --release
90110

91-
- name: Cargo build vm
92-
if: ${{ matrix.config.os != 'windows-latest' }}
111+
- name: Cargo build mac
112+
if: ${{ matrix.config.os == 'macOS-latest' }}
113+
env:
114+
RUSTFLAGS: ${{ matrix.config.RUSTFLAGS }}
115+
run: cargo build --release --target aarch64-apple-darwin
116+
117+
- name: Cargo build vm linux
118+
if: ${{ matrix.config.os == 'ubuntu-latest' }}
93119
env:
94120
RUSTFLAGS: ${{ matrix.config.RUSTFLAGS }}
95121
run: cd vm && cargo build --release
96122

123+
- name: Cargo build vm mac arm64
124+
if: ${{ matrix.config.os == 'macOS-latest' }}
125+
env:
126+
RUSTFLAGS: ${{ matrix.config.RUSTFLAGS }}
127+
run: cd vm && cargo build --release --target aarch64-apple-darwin
128+
97129
- run: mkdir -p ${{ matrix.config.dir }}
98130

99131
- name: Move artifacts

src/utils/read_config.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ pub fn get_config(db: &dyn Db, entry: SourceProgram) -> Result<Config, String> {
116116
&read_to_string(lockfile.clone()).unwrap_or_default(),
117117
)
118118
.unwrap_or_default();
119+
let mut sum_changed = false;
119120
if config.deps.is_none() {
120121
config.deps = Some(deps);
121122
} else {
@@ -154,6 +155,8 @@ pub fn get_config(db: &dyn Db, entry: SourceProgram) -> Result<Config, String> {
154155
}
155156
if let Some(sum) = sums.get(k) {
156157
b = sum.git.clone().unwrap().commit;
158+
} else {
159+
sum_changed = true;
157160
}
158161
let target = kagari::cp_to_hash_dir(target.to_str().unwrap(), &b);
159162
sums.insert(
@@ -214,9 +217,13 @@ pub fn get_config(db: &dyn Db, entry: SourceProgram) -> Result<Config, String> {
214217
}
215218
config.deps = Some(deps);
216219
}
217-
toml::to_string_pretty(&sums)
218-
.map_err(|e| format!("error: {:?}", e))
219-
.and_then(|s| std::fs::write(lockfile, s).or_else(|e| Err(format!("error: {:?}", e))))?;
220+
if sum_changed {
221+
toml::to_string_pretty(&sums)
222+
.map_err(|e| format!("error: {:?}", e))
223+
.and_then(|s| {
224+
std::fs::write(lockfile, s).or_else(|e| Err(format!("error: {:?}", e)))
225+
})?;
226+
}
220227
config.root = dunce::canonicalize(config_root.clone())
221228
.unwrap()
222229
.to_str()

0 commit comments

Comments
 (0)