Skip to content

Commit b4488cb

Browse files
authored
feat(cli/lint): add more rules from oxc_linter (#195)
* feat(cli/lint): add more rules from oxc_linter (eventually once oxc_linter is published we'll move to that * fix: ci on pr * fix(ci): remove release.yml
1 parent 6e85bd2 commit b4488cb

File tree

6 files changed

+1396
-289
lines changed

6 files changed

+1396
-289
lines changed

.github/workflows/ci.yml

Lines changed: 107 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,89 @@
1-
name: Build and Release Andromeda
1+
name: CI
22

33
on:
4-
workflow_dispatch:
54
push:
6-
branches: [main]
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
14+
cancel-in-progress: ${{ github.ref_name != 'main' }}
15+
16+
env:
17+
CARGO_TERM_COLOR: always
718

819
permissions:
920
contents: write
1021

1122
jobs:
23+
typos:
24+
name: Spellcheck
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
- name: Spell check
29+
uses: crate-ci/typos@master
30+
31+
lint:
32+
name: Lint
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v4
36+
- name: Install Rust toolchain
37+
uses: dtolnay/rust-toolchain@nightly
38+
with:
39+
toolchain: nightly-2025-09-05
40+
components: rustfmt, clippy, llvm-tools-preview, rustc-dev
41+
- name: Cache on ${{ github.ref_name }}
42+
uses: Swatinem/rust-cache@v2
43+
with:
44+
shared-key: warm
45+
- name: Check formatting
46+
run: cargo fmt --check
47+
- name: Clippy
48+
run: |
49+
cargo +nightly-2025-09-05 clippy --all-targets -- -D warnings
50+
cargo +nightly-2025-09-05 clippy --all-targets --all-features -- -D warnings
51+
52+
test:
53+
name: Build & Test
54+
runs-on: ${{ matrix.os }}
55+
strategy:
56+
matrix:
57+
os:
58+
[
59+
"macos-14",
60+
"macos-latest",
61+
"ubuntu-24.04",
62+
"ubuntu-latest",
63+
"windows-latest",
64+
]
65+
steps:
66+
- uses: actions/checkout@v4
67+
- uses: oxc-project/setup-rust@cd82e1efec7fef815e2c23d296756f31c7cdc03d # v1.0.0
68+
with:
69+
cache-key: warm
70+
save-cache: ${{ github.ref_name == 'main' }}
71+
- name: Check
72+
run: cargo check --all-targets
73+
- name: Build
74+
run: cargo build --tests --bins --examples
75+
- name: Test
76+
run: cargo test
77+
env:
78+
RUST_BACKTRACE: 1
79+
1280
build:
1381
name: Build ${{ matrix.asset-name }}
1482
runs-on: ${{ matrix.os }}
15-
continue-on-error: true # Don't fail the entire workflow if one target fails
83+
continue-on-error: true
84+
if: github.ref == 'refs/heads/main'
1685
strategy:
17-
fail-fast: false # Continue with other builds even if one fails
86+
fail-fast: false
1887
matrix:
1988
include:
2089
# Linux (x86_64)
@@ -24,20 +93,20 @@ jobs:
2493
installer-name: andromeda-installer-linux-amd64
2594

2695
# Linux (ARM64) - cross-compilation
27-
# - os: ubuntu-24.04
28-
# rust-target: aarch64-unknown-linux-gnu
29-
# asset-name: andromeda-linux-arm64
30-
# installer-name: andromeda-installer-linux-arm64
31-
# cross-compile: true
96+
- os: ubuntu-24.04
97+
rust-target: aarch64-unknown-linux-gnu
98+
asset-name: andromeda-linux-arm64
99+
installer-name: andromeda-installer-linux-arm64
100+
cross-compile: true
32101

33102
# macOS (Intel)
34-
- os: macos-13
103+
- os: macos-15-large
35104
rust-target: x86_64-apple-darwin
36105
asset-name: andromeda-macos-amd64
37106
installer-name: andromeda-installer-macos-amd64
38107

39108
# macOS (Apple Silicon/ARM)
40-
- os: macos-14
109+
- os: macos-latest
41110
rust-target: aarch64-apple-darwin
42111
asset-name: andromeda-macos-arm64
43112
installer-name: andromeda-installer-macos-arm64
@@ -63,34 +132,28 @@ jobs:
63132
toolchain: "nightly-2025-09-05"
64133
targets: ${{ matrix.rust-target }}
65134

66-
# - name: Install cross-compilation dependencies
67-
# if: matrix.cross-compile
68-
# run: |
69-
# sudo apt-get update
70-
# sudo apt-get install -y gcc-aarch64-linux-gnu libc6-dev-arm64-cross pkg-config
135+
- name: Install cross-compilation dependencies
136+
if: matrix.cross-compile
137+
run: |
138+
sudo apt-get update
139+
sudo apt-get install -y gcc-aarch64-linux-gnu libc6-dev-arm64-cross pkg-config
71140
72141
- name: Build
73-
continue-on-error: true # Allow individual builds to fail
74-
run: cargo build --release --target ${{ matrix.rust-target }} --manifest-path ./cli/Cargo.toml
75-
env:
76-
# Cross-compilation environment variables
77-
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
78-
CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc
79-
# PKG_CONFIG settings for cross-compilation
80-
PKG_CONFIG_ALLOW_CROSS: 1
81-
82-
- name: Build installer
83-
continue-on-error: true # Allow individual builds to fail
84-
run: cargo build --bin andromeda-installer --release --target ${{ matrix.rust-target }} --manifest-path ./cli/Cargo.toml
142+
id: build-main
143+
continue-on-error: true
144+
run: |
145+
cargo build --release --target ${{ matrix.rust-target }} --manifest-path ./cli/Cargo.toml
146+
cargo build --bin andromeda-installer --release --target ${{ matrix.rust-target }} --manifest-path ./cli/Cargo.toml
85147
env:
86-
# Cross-compilation environment variables
87148
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
88149
CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc
89-
# PKG_CONFIG settings for cross-compilation
90150
PKG_CONFIG_ALLOW_CROSS: 1
151+
MACOSX_DEPLOYMENT_TARGET: ${{ runner.os == 'macOS' && '14.0' || '' }}
152+
RUSTFLAGS: ${{ runner.os == 'macOS' && '-C link-arg=-mmacosx-version-min=14.0' || '' }}
91153

92154
- name: Build satellites
93-
continue-on-error: true # Allow individual builds to fail
155+
id: build-satellites
156+
continue-on-error: true
94157
run: |
95158
cargo build --bin andromeda-run --release --target ${{ matrix.rust-target }} --manifest-path ./cli/Cargo.toml
96159
cargo build --bin andromeda-compile --release --target ${{ matrix.rust-target }} --manifest-path ./cli/Cargo.toml
@@ -99,66 +162,59 @@ jobs:
99162
cargo build --bin andromeda-check --release --target ${{ matrix.rust-target }} --manifest-path ./cli/Cargo.toml
100163
cargo build --bin andromeda-bundle --release --target ${{ matrix.rust-target }} --manifest-path ./cli/Cargo.toml
101164
env:
102-
# Cross-compilation environment variables
103165
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
104166
CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc
105-
# PKG_CONFIG settings for cross-compilation
106167
PKG_CONFIG_ALLOW_CROSS: 1
168+
MACOSX_DEPLOYMENT_TARGET: ${{ runner.os == 'macOS' && '14.0' || '' }}
169+
RUSTFLAGS: ${{ runner.os == 'macOS' && '-C link-arg=-mmacosx-version-min=14.0' || '' }}
107170

108-
- name: Prepare binaries
171+
- name: Prepare binary
172+
if: steps.build-main.outcome == 'success'
109173
shell: bash
110174
run: |
111175
cd target/${{ matrix.rust-target }}/release/
112-
113176
# Prepare main binary
114177
if [ -f "andromeda.exe" ]; then
115178
mv andromeda.exe ${{ matrix.asset-name }}
116179
elif [ -f "andromeda" ]; then
117180
mv andromeda ${{ matrix.asset-name }}
118-
else
119-
echo "Main binary not found, build may have failed"
120-
exit 1
121181
fi
122182
123183
# Prepare installer binary
124184
if [ -f "andromeda-installer.exe" ]; then
125-
cp "andromeda-installer.exe" "${{ matrix.installer-name }}"
185+
mv andromeda-installer.exe ${{ matrix.installer-name }}
126186
elif [ -f "andromeda-installer" ]; then
127-
cp "andromeda-installer" "${{ matrix.installer-name }}"
128-
else
129-
echo "Warning: Installer binary not found"
187+
mv andromeda-installer ${{ matrix.installer-name }}
130188
fi
131189
132-
# Prepare satellite binaries
190+
# Prepare satellite binaries (only if they exist)
133191
for satellite in run compile fmt lint check bundle; do
134192
if [ -f "andromeda-${satellite}.exe" ]; then
135193
# Windows binaries
136194
cp "andromeda-${satellite}.exe" "andromeda-${satellite}-${{ matrix.rust-target }}.exe"
137195
elif [ -f "andromeda-${satellite}" ]; then
138196
# Unix binaries
139197
cp "andromeda-${satellite}" "andromeda-${satellite}-${{ matrix.rust-target }}"
140-
else
141-
echo "Warning: andromeda-${satellite} binary not found"
142198
fi
143199
done
144200
145-
- name: Upload Main Binary as Artifact
201+
- name: Upload Binary as Artifact
146202
uses: actions/upload-artifact@v4
147-
if: success() # Only upload if binary was prepared successfully
203+
if: steps.build-main.outcome == 'success'
148204
with:
149205
name: ${{ matrix.asset-name }}
150206
path: target/${{ matrix.rust-target }}/release/${{ matrix.asset-name }}
151207

152-
- name: Upload Installer Binary as Artifact
208+
- name: Upload Installer as Artifact
153209
uses: actions/upload-artifact@v4
154-
if: success() # Only upload if installer was prepared successfully
210+
if: steps.build-main.outcome == 'success' && hashFiles(format('target/{0}/release/{1}', matrix.rust-target, matrix.installer-name)) != ''
155211
with:
156212
name: ${{ matrix.installer-name }}
157213
path: target/${{ matrix.rust-target }}/release/${{ matrix.installer-name }}
158214

159215
- name: Upload Satellite Binaries as Artifacts
160216
uses: actions/upload-artifact@v4
161-
if: success()
217+
if: steps.build-satellites.outcome == 'success'
162218
with:
163219
name: satellites-${{ matrix.rust-target }}
164220
path: |
@@ -183,12 +239,6 @@ jobs:
183239
with:
184240
path: ./artifacts
185241

186-
- name: List all artifacts
187-
run: |
188-
echo "=== All artifacts ready for release ==="
189-
find ./artifacts -type f -name "andromeda-*" | sort
190-
echo "======================================="
191-
192242
- name: Create Draft Release
193243
uses: svenstaro/upload-release-action@v2
194244
with:
@@ -198,31 +248,3 @@ jobs:
198248
draft: true
199249
tag: latest
200250
overwrite: true
201-
body: |
202-
## Andromeda Release
203-
204-
### Installation
205-
206-
**Main CLI:**
207-
- Download `andromeda-{platform}-{arch}` for your platform
208-
- Make executable and add to PATH
209-
210-
**Installer:**
211-
- Download `andromeda-installer-{platform}-{arch}` for your platform
212-
- Run `andromeda-installer` to install main CLI
213-
- Run `andromeda-installer satellite <name>` to install satellites
214-
215-
**Satellites (specialized binaries):**
216-
- `andromeda-run` - Execute JS/TS files
217-
- `andromeda-compile` - Compile to executables
218-
- `andromeda-fmt` - Format code
219-
- `andromeda-lint` - Lint code
220-
- `andromeda-check` - Type-check TypeScript
221-
- `andromeda-bundle` - Bundle and minify
222-
223-
### Platforms
224-
- Linux (x86_64, ARM64)
225-
- macOS (Intel, Apple Silicon)
226-
- Windows (x86_64, ARM64)
227-
228-
See [SATELLITES.md](https://github.com/tryandromeda/andromeda/blob/main/cli/SATELLITES.md) for detailed satellite documentation.

0 commit comments

Comments
 (0)