@@ -34,52 +34,87 @@ jobs:
34
34
include :
35
35
- target : aarch64-unknown-linux-gnu
36
36
os : ubuntu-latest
37
- # # I GIVE UP! For this target, OpenSSL needs to be cross compiled
38
- # # which is driven by openssl-sys crate's custom build script...
39
- # # Linux users with aarch64 (aka ARM64) using musl C lib can go fish (or build from source).
40
- # - target: aarch64-unknown-linux-musl
41
- # os: ubuntu-latest
37
+ vendered : true
38
+ cross : true
39
+ - target : aarch64-unknown-linux-musl
40
+ os : ubuntu-latest
41
+ vendered : true
42
+ cross : true
42
43
- target : x86_64-unknown-linux-gnu
43
44
os : ubuntu-latest
45
+ vendered : false
46
+ cross : false
44
47
- target : x86_64-unknown-linux-musl
45
48
os : ubuntu-latest
49
+ vendered : true
50
+ cross : true
51
+ - target : arm-unknown-linux-gnueabi
52
+ os : ubuntu-latest
53
+ vendered : true
54
+ cross : true
55
+ - target : arm-unknown-linux-gnueabihf
56
+ os : ubuntu-latest
57
+ vendered : true
58
+ cross : true
59
+ - target : armv7-unknown-linux-gnueabihf
60
+ os : ubuntu-latest
61
+ vendered : true
62
+ cross : true
63
+ - target : loongarch64-unknown-linux-gnu
64
+ os : ubuntu-latest
65
+ vendered : true
66
+ cross : true
67
+ - target : powerpc-unknown-linux-gnu
68
+ os : ubuntu-latest
69
+ vendered : true
70
+ cross : true
71
+ - target : powerpc64-unknown-linux-gnu
72
+ os : ubuntu-latest
73
+ vendered : true
74
+ cross : true
75
+ - target : powerpc64le-unknown-linux-gnu
76
+ os : ubuntu-latest
77
+ vendered : true
78
+ cross : true
79
+ - target : riscv64gc-unknown-linux-gnu
80
+ os : ubuntu-latest
81
+ vendered : true
82
+ cross : true
83
+ - target : s390x-unknown-linux-gnu
84
+ os : ubuntu-latest
85
+ vendered : true
86
+ cross : true
87
+ - target : x86_64-unknown-freebsd
88
+ os : ubuntu-latest
89
+ vendered : true
90
+ cross : false
91
+ - target : x86_64-unknown-illumos
92
+ os : ubuntu-latest
93
+ vendered : true
94
+ cross : false
46
95
- target : aarch64-apple-darwin
47
96
os : macos-latest
97
+ vendered : true
98
+ cross : false
48
99
- target : x86_64-apple-darwin
49
100
os : macos-latest
101
+ vendered : true
102
+ cross : false
50
103
- target : x86_64-pc-windows-msvc
51
104
os : windows-latest
105
+ vendered : false
106
+ cross : false
107
+ - target : aarch64-pc-windows-msvc
108
+ os : windows-latest
109
+ vendered : false
110
+ cross : false
52
111
runs-on : ${{ matrix.os }}
53
112
permissions :
54
113
contents : write
55
114
steps :
56
115
- name : Install native OpenSSL on Linux
57
- if : runner.os == 'Linux' && !(startsWith( matrix.target, 'aarch64') || endsWith(matrix.target, 'musl'))
116
+ if : matrix.vendered && !matrix.cross && runner.os == 'Linux'
58
117
run : sudo apt-get install -y pkg-config libssl-dev
59
- - name : Install GCC for aarch64 (for cross-compiling openssl)
60
- if : runner.os == 'Linux' && startsWith(matrix.target, 'aarch64')
61
- run : |
62
- sudo apt-get update
63
- sudo apt-get install gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu
64
- if [[ "${{matrix.target}}" == *musl ]]; then
65
- sudo apt-get install musl-dev musl-tools
66
- fi
67
- - name : Install musl-gcc (for compiling OpenSSL)
68
- if : matrix.target == 'x86_64-unknown-linux-musl'
69
- run : sudo apt-get install musl-tools
70
-
71
- - name : Calculate openssl-vendored
72
- shell : bash
73
- id : is-openssl-vendored
74
- run : |
75
- case "${{ matrix.target }}" in
76
- "aarch64-apple-darwin" | "x86_64-apple-darwin" | "aarch64-unknown-linux-gnu" | "aarch64-unknown-linux-musl" | "x86_64-unknown-linux-musl")
77
- echo "enabled=--features openssl-vendored" >> $GITHUB_OUTPUT
78
- ;;
79
- *)
80
- echo "enabled=" >> $GITHUB_OUTPUT
81
- ;;
82
- esac
83
118
84
119
- name : Checkout
85
120
uses : actions/checkout@v4
@@ -98,19 +133,19 @@ jobs:
98
133
with :
99
134
target : ${{ matrix.target }}
100
135
101
- # problems with cross-compiling linux with musl
102
- - run : echo "RUSTFLAGS=-D warnings -C target-feature=+crt-static -C link-self-contained=yes" >> "${GITHUB_ENV}"
103
- if : contains(matrix.target, '-linux-musl')
104
- - run : |
105
- echo "CC=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV"
106
- echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV"
107
- if: matrix.target == 'aarch64-unknown-linux-musl'
136
+ - name : Install cross (cargo cross compiler)
137
+ if : matrix.cross
138
+ uses : taiki-e/install-action@v2
139
+ with :
140
+ tool : cross
141
+
142
+ - name : Build (native)
143
+ if : ${{ !matrix.cross }}
144
+ run : cargo build --manifest-path cpp-linter-lib/Cargo.toml --release --bin cpp-linter --target ${{ matrix.target }} ${{ matrix.vendered && '--features openssl-vendored' || '' }}
108
145
109
- - name : Build
110
- env :
111
- # problems with cross-compiling aarch64 linux with gnu
112
- CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER : /usr/bin/aarch64-linux-gnu-gcc
113
- run : cargo build --manifest-path cpp-linter-lib/Cargo.toml --release --bin cpp-linter --target ${{ matrix.target }} ${{ steps.is-openssl-vendored.outputs.enabled }}
146
+ - name : Build (cross)
147
+ if : matrix.cross
148
+ run : cross build --manifest-path cpp-linter-lib/Cargo.toml --release --bin cpp-linter --target ${{ matrix.target }} ${{ matrix.vendered && '--features openssl-vendored' || '' }}
114
149
115
150
- name : Prepare artifacts
116
151
run : mv target/${{ matrix.target }}/release/cpp-linter${{ runner.os == 'Windows' && '.exe' || '' }} ./cpp-linter-${{ matrix.target }}${{ runner.os == 'Windows' && '.exe' || '' }}
0 commit comments