Repository: getsentry/symbolic
Pull request #273 (2020-09-25 10:04:52)

ci: Switch to GitHub Actions


Patch:
diff --git a/.craft.yml b/.craft.yml
index d7cdb031..9b15ff86 100644
--- a/.craft.yml
+++ b/.craft.yml
@@ -10,7 +10,7 @@ targets:
   - name: github
 changelogPolicy: simple
 requireNames:
-  - /^symbolic-.*-py2.py3-none-macosx_10_13_x86_64.whl$/
+  - /^symbolic-.*-py2.py3-none-macosx_10_15_x86_64.whl$/
   - /^symbolic-.*-py2.py3-none-manylinux2010_i686.whl$/
   - /^symbolic-.*-py2.py3-none-manylinux2010_x86_64.whl$/
   - /^symbolic-.*.zip$/
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 00000000..4d76eadd
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,112 @@
+name: CI
+
+on:
+  push:
+    branches:
+      - master
+      - "release/**"
+  pull_request:
+
+jobs:
+  lints:
+    name: Style/Linting
+    runs-on: ubuntu-latest
+
+    steps:
+      - uses: actions/checkout@v2
+        with:
+          submodules: recursive
+
+      - uses: actions-rs/toolchain@v1
+        with:
+          profile: minimal
+          toolchain: stable
+          override: true
+          components: rustfmt, clippy
+
+      - uses: actions/setup-python@v2
+        with:
+          python-version: 3.7
+
+      - uses: Swatinem/rust-cache@v1
+        with:
+          key: lints
+
+      - name: Run cargo fmt
+        uses: actions-rs/cargo@v1
+        with:
+          command: fmt
+          args: --all -- --check
+
+      - run: make style-python
+
+      - name: Run cargo clippy
+        uses: actions-rs/clippy-check@v1
+        with:
+          token: ${{ secrets.GITHUB_TOKEN }}
+          args: --all-features --workspace --tests --examples -- -D clippy::all
+
+      - run: make lint-python
+
+  test-rust:
+    strategy:
+      fail-fast: false
+      matrix:
+        os: [ubuntu-latest, macos-latest]
+
+    name: Rust Test on ${{ matrix.os }}
+    runs-on: ${{ matrix.os }}
+
+    steps:
+      - uses: actions/checkout@v2
+        with:
+          submodules: recursive
+
+      - uses: actions-rs/toolchain@v1
+        with:
+          profile: minimal
+          toolchain: stable
+          override: true
+
+      - uses: Swatinem/rust-cache@v1
+        with:
+          key: test-rust
+
+      - name: Run cargo test
+        uses: actions-rs/cargo@v1
+        with:
+          command: test
+          args: --workspace --all-features
+
+  test-python:
+    strategy:
+      fail-fast: false
+      matrix:
+        os: [ubuntu-latest, macos-latest]
+
+    name: Python Test on ${{ matrix.os }}
+    runs-on: ${{ matrix.os }}
+
+    env:
+      SYMBOLIC_DEBUG: 1
+
+    steps:
+      - uses: actions/checkout@v2
+        with:
+          submodules: recursive
+
+      - uses: actions-rs/toolchain@v1
+        with:
+          profile: minimal
+          toolchain: stable
+          override: true
+
+      - uses: actions/setup-python@v2
+        with:
+          python-version: 3.7
+
+      - uses: Swatinem/rust-cache@v1
+        with:
+          key: test-python
+
+      - run: make test-python
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 00000000..f741e6f8
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,97 @@
+name: Release
+
+on:
+  push:
+    branches:
+      - "release/**"
+
+jobs:
+  python-wheel-mac:
+    name: Python macOS
+    runs-on: macos-10.15
+
+    steps:
+      - uses: actions/checkout@v2
+        with:
+          submodules: recursive
+
+      - uses: actions-rs/toolchain@v1
+        with:
+          toolchain: stable
+          profile: minimal
+          override: true
+
+      - uses: actions/setup-python@v2
+        with:
+          python-version: 2.7
+
+      - run: make wheel SYMBOLIC_PYTHON=python2
+
+      - uses: actions/setup-node@v1
+
+      - name: Upload to Zeus
+        env:
+          ZEUS_HOOK_BASE: ${{ secrets.ZEUS_HOOK_BASE }}
+        run: |
+          npm install -D @zeus-ci/cli
+          npx zeus job update --build ${{ github.run_id }} --job ${{ github.job }} --ref ${{ github.sha }}
+          npx zeus upload --build ${{ github.run_id }} --job ${{ github.job }} --type "application/zip+wheel" py/dist/*
+          npx zeus job update --build ${{ github.run_id }} --job ${{ github.job }} --status passed
+
+  python-wheel-linux:
+    strategy:
+      fail-fast: false
+      matrix:
+        build-arch: [i686, x86_64]
+
+    name: Python Linux ${{ matrix.build-arch }}
+    runs-on: ubuntu-latest
+
+    steps:
+      - uses: actions/checkout@v2
+        with:
+          submodules: recursive
+
+      - uses: actions-rs/toolchain@v1
+        with:
+          toolchain: stable
+          profile: minimal
+          override: true
+
+      - name: Build in Docker
+        run: make wheel-manylinux IMAGE=quay.io/pypa/manylinux2010_${{ matrix.build-arch }}
+
+      - uses: actions/setup-node@v1
+
+      - name: Upload to Zeus
+        env:
+          ZEUS_HOOK_BASE: ${{ secrets.ZEUS_HOOK_BASE }}
+        run: |
+          npm install -D @zeus-ci/cli
+          npx zeus job update --build ${{ github.run_id }} --job ${{ github.job }} --ref ${{ github.sha }}
+          npx zeus upload --build ${{ github.run_id }} --job ${{ github.job }} --type "application/zip+wheel" py/dist/*
+          npx zeus job update --build ${{ github.run_id }} --job ${{ github.job }} --status passed
+
+  sdist:
+    name: Python sdist
+    runs-on: ubuntu-latest
+
+    steps:
+      - uses: actions/checkout@v2
+
+      - uses: actions/setup-python@v2
+        with:
+          python-version: 2.7
+
+      - run: make sdist
+
+      - uses: actions/setup-node@v1
+
+      - name: Upload to Zeus
+        env:
+          ZEUS_HOOK_BASE: ${{ secrets.ZEUS_HOOK_BASE }}
+        run: |
+          npm install -D @zeus-ci/cli
+          npx zeus job update --build ${{ github.run_id }} --job ${{ github.job }} --ref ${{ github.sha }}
+          npx zeus upload --build ${{ github.run_id }} --job ${{ github.job }} --type "application/zip+wheel" py/dist/*
+          npx zeus job update --build ${{ github.run_id }} --job ${{ github.job }} --status passed
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index d2314bf9..00000000
--- a/.travis.yml
+++ /dev/null
@@ -1,77 +0,0 @@
-language: rust
-os: linux
-
-git:
-  depth: 1
-
-if: tag IS blank
-
-after_success:
-  - npm install -g @zeus-ci/cli
-  - test "$DEPLOY" && ( zeus upload -t "application/zip+wheel" py/dist/* || exit 1 )
-
-jobs:
-  include:
-    # Rust test suite
-    - script: make style-rust
-      env: TEST=style-rust
-    - script: make lint-rust
-      env: TEST=lint-rust CXX=clang
-    - script: make test-rust
-      env: TEST=linux-rust CXX=clang
-    - os: osx
-      script: make test-rust
-      env: TEST=mac-rust
-
-    # Python test suite
-    - name: "Python 3.7 Style/Linting"
-      language: python
-      python: "3.7"
-      script:
-        - make style-python
-        - make lint-python
-      env: TEST=style-python
-    - name: "Python 3.6 Tests (linux)"
-      before_install:
-        # multi-language jobs not currently possible, pyenv is used here.
-        # if we want later 3.6.x's it isn't possible AFAIK to update travis pyenv,
-        # so would need to install rustup + friends.
-        - pyenv install 3.6.3
-        - pyenv global 3.6.3
-      script: make test-python
-      env: TEST=linux-python CXX=clang SYMBOLIC_DEBUG=1
-    - name: "Python 3.7 Tests (osx)"
-      os: osx
-      script: make test-python
-      env: TEST=mac-python SYMBOLIC_DEBUG=1
-
-    # Build wheels
-    - if: branch ~= /^release\/.+$/
-      os: osx
-      script: make wheel SYMBOLIC_PYTHON=python2
-      before_install: HOMEBREW_NO_AUTO_UPDATE=1 brew upgrade node
-      env: DEPLOY=mac-wheel
-      osx_image: xcode9.4
-    - if: branch ~= /^release\/.+$/
-      script: make wheel-manylinux IMAGE=quay.io/pypa/manylinux2010_x86_64
-      env: DEPLOY=linux-x86_64-wheel
-      services:
-        - docker
-    - if: branch ~= /^release\/.+$/
-      script: make wheel-manylinux IMAGE=quay.io/pypa/manylinux2010_i686
-      env: DEPLOY=linux-x86-wheel
-      services:
-        - docker
-    - if: branch ~= /^release\/.+$/
-      script: make sdist
-      env: DEPLOY=sdist
-
-notifications:
-  webhooks:
-    urls:
-      - https://zeus.ci/hooks/3be2453a-c595-11e7-8cdd-0a580a28020a/public/provider/travis/webhook
-    on_success: always
-    on_failure: always
-    on_start: always
-    on_cancel: always
-    on_error: always
diff --git a/Makefile b/Makefile
index e68d4887..c5a5bfe7 100644
--- a/Makefile
+++ b/Makefile
@@ -26,7 +26,7 @@ wheel: .venv/bin/python
 .PHONY: wheel
 
 wheel-manylinux:
-	docker run --rm -it -v $(CURDIR):/work -w /work/py $(IMAGE) sh manylinux.sh
+	docker run --rm -v $(CURDIR):/work -w /work/py $(IMAGE) sh manylinux.sh
 .PHONY: wheel-manylinux
 
 # Tests
diff --git a/symbolic-demangle/Cargo.toml b/symbolic-demangle/Cargo.toml
index 2cdb0129..c6dc4a48 100644
--- a/symbolic-demangle/Cargo.toml
+++ b/symbolic-demangle/Cargo.toml
@@ -23,14 +23,21 @@ exclude = [
 [package.metadata.docs.rs]
 all-features = true
 
+[features]
+default = ["cpp", "msvc", "rust", "swift"]
+cpp = ["cpp_demangle"]
+msvc = ["msvc-demangler"]
+rust = ["rustc-demangle"]
+swift = ["cc"]
+
 [dependencies]
-cpp_demangle = "0.3.0"
-msvc-demangler = "0.8.0"
-rustc-demangle = "0.1.16"
+cpp_demangle = { version = "0.3.0", optional = true }
+msvc-demangler = { version = "0.8.0", optional = true }
+rustc-demangle = { version = "0.1.16", optional = true }
 symbolic-common = { version = "7.5.0", path = "../symbolic-common" }
 
 [build-dependencies]
-cc = "1.0.50"
+cc = { version = "1.0.50", optional = true }
 
 [badges]
 travis-ci = { repository = "getsentry/symbolic", branch = "master" }
diff --git a/symbolic-demangle/build.rs b/symbolic-demangle/build.rs
index da86326e..4ce782eb 100644
--- a/symbolic-demangle/build.rs
+++ b/symbolic-demangle/build.rs
@@ -1,21 +1,24 @@
 fn main() {
-    cc::Build::new()
-        .cpp(true)
-        .files(&[
-            "src/swiftdemangle.cpp",
-            "vendor/swift/lib/Demangling/Demangler.cpp",
-            "vendor/swift/lib/Demangling/Context.cpp",
-            "vendor/swift/lib/Demangling/ManglingUtils.cpp",
-            "vendor/swift/lib/Demangling/NodeDumper.cpp",
-            "vendor/swift/lib/Demangling/NodePrinter.cpp",
-            "vendor/swift/lib/Demangling/OldDemangler.cpp",
-            // "vendor/swift/lib/Demangling/OldRemangler.cpp",
-            "vendor/swift/lib/Demangling/Punycode.cpp",
-            "vendor/swift/lib/Demangling/Remangler.cpp",
-        ])
-        .flag_if_supported("-std=c++14")
-        .flag("-DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1")
-        .warnings(false)
-        .include("vendor/swift/include")
-        .compile("swiftdemangle");
+    #[cfg(feature = "swift")]
+    {
+        cc::Build::new()
+            .cpp(true)
+            .files(&[
+                "src/swiftdemangle.cpp",
+                "vendor/swift/lib/Demangling/Demangler.cpp",
+                "vendor/swift/lib/Demangling/Context.cpp",
+                "vendor/swift/lib/Demangling/ManglingUtils.cpp",
+                "vendor/swift/lib/Demangling/NodeDumper.cpp",
+                "vendor/swift/lib/Demangling/NodePrinter.cpp",
+                "vendor/swift/lib/Demangling/OldDemangler.cpp",
+                // "vendor/swift/lib/Demangling/OldRemangler.cpp",
+                "vendor/swift/lib/Demangling/Punycode.cpp",
+                "vendor/swift/lib/Demangling/Remangler.cpp",
+            ])
+            .flag_if_supported("-std=c++14")
+            .flag("-DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1")
+            .warnings(false)
+            .include("vendor/swift/include")
+            .compile("swiftdemangle");
+    }
 }
diff --git a/symbolic-demangle/src/lib.rs b/symbolic-demangle/src/lib.rs
index 117a32e7..acbdc987 100644
--- a/symbolic-demangle/src/lib.rs
+++ b/symbolic-demangle/src/lib.rs
@@ -2,9 +2,9 @@
 //!
 //! Currently supported languages are:
 //!
-//! - C++ (GCC-style compilers and MSVC)
-//! - Rust (both `legacy` and `v0`)
-//! - Swift (up to Swift 5.2)
+//! - C++ (GCC-style compilers and MSVC) (`features = ["cpp", "msvc"]`)
+//! - Rust (both `legacy` and `v0`) (`features = ["rust"]`)
+//! - Swift (up to Swift 5.2) (`features = ["swift"]`)
 //! - ObjC (only symbol detection)
 //!
 //! As the demangling schemes for the languages are different, the supported demangling features are
@@ -16,25 +16,27 @@
 //! # Examples
 //!
 //! ```rust
+//! # #[cfg(feature = "cpp")] {
 //! use symbolic_common::{Language, Name};
 //! use symbolic_demangle::{Demangle, DemangleOptions};
 //!
 //! let name = Name::new("__ZN3std2io4Read11read_to_end17hb85a0f6802e14499E");
 //! assert_eq!(name.detect_language(), Language::Rust);
 //! assert_eq!(name.try_demangle(DemangleOptions::default()), "std::io::Read::read_to_end");
+//! # }
 //! ```
 
 #![warn(missing_docs)]
 
 use std::borrow::Cow;
+#[cfg(feature = "swift")]
 use std::ffi::{CStr, CString};
+#[cfg(feature = "swift")]
 use std::os::raw::{c_char, c_int};
 
 use symbolic_common::{Language, Name};
 
-use cpp_demangle::{DemangleOptions as CppOptions, Symbol as CppSymbol};
-use msvc_demangler::DemangleFlags as MsvcFlags;
-
+#[cfg(feature = "swift")]
 extern "C" {
     fn symbolic_demangle_swift(
         sym: *const c_char,
@@ -96,13 +98,21 @@ fn is_maybe_msvc(ident: &str) -> bool {
     ident.starts_with('?') || ident.starts_with("@?")
 }
 
+#[cfg(feature = "swift")]
 fn is_maybe_swift(ident: &str) -> bool {
     CString::new(ident)
         .map(|cstr| unsafe { symbolic_demangle_is_swift_symbol(cstr.as_ptr()) != 0 })
         .unwrap_or(false)
 }
 
+#[cfg(not(feature = "swift"))]
+fn is_maybe_swift(_ident: &str) -> bool {
+    false
+}
+
+#[cfg(feature = "msvc")]
 fn try_demangle_msvc(ident: &str, opts: DemangleOptions) -> Option<String> {
+    use msvc_demangler::DemangleFlags as MsvcFlags;
     let flags = match opts.format {
         DemangleFormat::Full => MsvcFlags::COMPLETE,
         DemangleFormat::Short => {
@@ -117,27 +127,42 @@ fn try_demangle_msvc(ident: &str, opts: DemangleOptions) -> Option<String> {
     msvc_demangler::demangle(ident, flags).ok()
 }
 
+#[cfg(not(feature = "msvc"))]
+fn try_demangle_msvc(_ident: &str, _opts: DemangleOptions) -> Option<String> {
+    None
+}
+
 fn try_demangle_cpp(ident: &str, opts: DemangleOptions) -> Option<String> {
     if is_maybe_msvc(ident) {
         return try_demangle_msvc(ident, opts);
     }
 
-    let symbol = match CppSymbol::new(ident) {
-        Ok(symbol) => symbol,
-        Err(_) => return None,
-    };
+    #[cfg(feature = "cpp")]
+    {
+        use cpp_demangle::{DemangleOptions as CppOptions, Symbol as CppSymbol};
 
-    let mut cpp_options = CppOptions::new();
-    if !opts.with_arguments {
-        cpp_options = cpp_options.no_params().no_return_type();
-    }
+        let symbol = match CppSymbol::new(ident) {
+            Ok(symbol) => symbol,
+            Err(_) => return None,
+        };
 
-    match symbol.demangle(&cpp_options) {
-        Ok(demangled) => Some(demangled),
-        Err(_) => None,
+        let mut cpp_options = CppOptions::new();
+        if !opts.with_arguments {
+            cpp_options = cpp_options.no_params().no_return_type();
+        }
+
+        match symbol.demangle(&cpp_options) {
+            Ok(demangled) => Some(demangled),
+            Err(_) => None,
+        }
+    }
+    #[cfg(not(feature = "cpp"))]
+    {
+        None
     }
 }
 
+#[cfg(feature = "rust")]
 fn try_demangle_rust(ident: &str, _opts: DemangleOptions) -> Option<String> {
     match rustc_demangle::try_demangle(ident) {
         Ok(demangled) => Some(format!("{:#}", demangled)),
@@ -145,6 +170,12 @@ fn try_demangle_rust(ident: &str, _opts: DemangleOptions) -> Option<String> {
     }
 }
 
+#[cfg(not(feature = "rust"))]
+fn try_demangle_rust(_ident: &str, _opts: DemangleOptions) -> Option<String> {
+    None
+}
+
+#[cfg(feature = "swift")]
 fn try_demangle_swift(ident: &str, opts: DemangleOptions) -> Option<String> {
     let mut buf = vec![0 as c_char; 4096];
     let sym = match CString::new(ident) {
@@ -171,6 +202,11 @@ fn try_demangle_swift(ident: &str, opts: DemangleOptions) -> Option<String> {
     }
 }
 
+#[cfg(not(feature = "swift"))]
+fn try_demangle_swift(_ident: &str, _opts: DemangleOptions) -> Option<String> {
+    None
+}
+
 fn try_demangle_objc(ident: &str, _opts: DemangleOptions) -> Option<String> {
     Some(ident.to_string())
 }
@@ -220,11 +256,13 @@ pub trait Demangle {
     /// # Examples
     ///
     /// ```
+    /// # #[cfg(feature = "cpp")] {
     /// use symbolic_common::Name;
     /// use symbolic_demangle::{Demangle, DemangleOptions};
     ///
     /// assert_eq!(Name::new("_ZN3foo3barEv").demangle(DemangleOptions::default()), Some("foo::bar".to_string()));
     /// assert_eq!(Name::new("unknown").demangle(DemangleOptions::default()), None);
+    /// # }
     /// ```
     fn demangle(&self, opts: DemangleOptions) -> Option<String>;
 
@@ -236,11 +274,13 @@ pub trait Demangle {
     /// # Examples
     ///
     /// ```
+    /// # #[cfg(feature = "cpp")] {
     /// use symbolic_common::Name;
     /// use symbolic_demangle::{Demangle, DemangleOptions};
     ///
     /// assert_eq!(Name::new("_ZN3foo3barEv").try_demangle(DemangleOptions::default()), "foo::bar");
     /// assert_eq!(Name::new("unknown").try_demangle(DemangleOptions::default()), "unknown");
+    /// # }
     /// ```
     ///
     /// [`demangle`]: trait.Demangle.html#tymethod.demangle
@@ -257,8 +297,11 @@ impl<'a> Demangle for Name<'a> {
             return Language::ObjC;
         }
 
-        if rustc_demangle::try_demangle(self.as_str()).is_ok() {
-            return Language::Rust;
+        #[cfg(feature = "rust")]
+        {
+            if rustc_demangle::try_demangle(self.as_str()).is_ok() {
+                return Language::Rust;
+            }
         }
 
         if is_maybe_cpp(self.as_str()) || is_maybe_msvc(self.as_str()) {
@@ -298,7 +341,9 @@ impl<'a> Demangle for Name<'a> {
 /// # Examples
 ///
 /// ```
+/// # #[cfg(feature = "cpp")] {
 /// assert_eq!(symbolic_demangle::demangle("_ZN3foo3barEv"), "foo::bar");
+/// # }
 /// ```
 ///
 /// [`Demangle::try_demangle`]: trait.Demangle.html#tymethod.try_demangle


Test patch:
diff --git a/symbolic-demangle/tests/test_cpp.rs b/symbolic-demangle/tests/test_cpp.rs
index f25b12aa..56bbee51 100644
--- a/symbolic-demangle/tests/test_cpp.rs
+++ b/symbolic-demangle/tests/test_cpp.rs
@@ -2,6 +2,8 @@
 //! We use cpp_demangle under the hood which runs the libiberty test suite
 //! Still, we run some basic regression tests here to detect demangling differences.
 
+#![cfg(feature = "cpp")]
+
 #[macro_use]
 mod utils;
 
diff --git a/symbolic-demangle/tests/test_detection.rs b/symbolic-demangle/tests/test_detection.rs
index 8d785966..5844b3cd 100644
--- a/symbolic-demangle/tests/test_detection.rs
+++ b/symbolic-demangle/tests/test_detection.rs
@@ -34,19 +34,6 @@ fn test_cpp_msvc() {
     assert_language("?h@@YAXH@Z	", Language::Cpp);
 }
 
-#[test]
-fn test_rust_legacy() {
-    assert_language(
-        "__ZN3std2io4Read11read_to_end17hb85a0f6802e14499E",
-        Language::Rust,
-    );
-}
-
-#[test]
-fn test_rust_v0() {
-    assert_language("_RNvNtCs1234_7mycrate3foo3bar", Language::Rust);
-}
-
 #[test]
 fn test_objc_static() {
     assert_language("+[Foo bar:blub:]", Language::ObjC);
@@ -57,21 +44,6 @@ fn test_objc_member() {
     assert_language("-[Foo bar:blub:]", Language::ObjC);
 }
 
-#[test]
-fn test_swift_old() {
-    assert_language("_T08mangling3barSiyKF", Language::Swift);
-}
-
-#[test]
-fn test_swift_4() {
-    assert_language("$S8mangling6curry1yyF", Language::Swift);
-}
-
-#[test]
-fn test_swift_5() {
-    assert_language("$s8mangling6curry1yyF", Language::Swift);
-}
-
 #[test]
 fn test_ambiguous_cpp_rust() {
     // This symbol might look like a legacy Rust symbol at first because of the _ZN...E schema, but
@@ -83,3 +55,41 @@ fn test_ambiguous_cpp_rust() {
         Language::Cpp,
     );
 }
+
+#[cfg(feature = "swift")]
+mod swift_tests {
+    use super::*;
+
+    #[test]
+    fn test_swift_old() {
+        assert_language("_T08mangling3barSiyKF", Language::Swift);
+    }
+
+    #[test]
+    fn test_swift_4() {
+        assert_language("$S8mangling6curry1yyF", Language::Swift);
+    }
+
+    #[test]
+    fn test_swift_5() {
+        assert_language("$s8mangling6curry1yyF", Language::Swift);
+    }
+}
+
+#[cfg(feature = "rust")]
+mod rust_tests {
+    use super::*;
+
+    #[test]
+    fn test_rust_legacy() {
+        assert_language(
+            "__ZN3std2io4Read11read_to_end17hb85a0f6802e14499E",
+            Language::Rust,
+        );
+    }
+
+    #[test]
+    fn test_rust_v0() {
+        assert_language("_RNvNtCs1234_7mycrate3foo3bar", Language::Rust);
+    }
+}
diff --git a/symbolic-demangle/tests/test_msvc.rs b/symbolic-demangle/tests/test_msvc.rs
index 04024142..73beb9d2 100644
--- a/symbolic-demangle/tests/test_msvc.rs
+++ b/symbolic-demangle/tests/test_msvc.rs
@@ -2,6 +2,8 @@
 //! We use msvc_demangler under the hood which runs its own test suite.
 //! Tests here make it easier to detect regressions.
 
+#![cfg(feature = "msvc")]
+
 #[macro_use]
 mod utils;
 
diff --git a/symbolic-demangle/tests/test_objcpp.rs b/symbolic-demangle/tests/test_objcpp.rs
index 98718a7f..d4dc44e7 100644
--- a/symbolic-demangle/tests/test_objcpp.rs
+++ b/symbolic-demangle/tests/test_objcpp.rs
@@ -9,6 +9,7 @@ use symbolic_common::{Language, Name};
 use symbolic_demangle::Demangle;
 
 #[test]
+#[cfg(feature = "cpp")]
 fn test_demangle_objcpp() {
     assert_demangle!(Language::ObjCpp, utils::WITH_ARGS, {
         "+[Foo bar:blub:]" => "+[Foo bar:blub:]",
@@ -19,6 +20,7 @@ fn test_demangle_objcpp() {
 }
 
 #[test]
+#[cfg(feature = "cpp")]
 fn test_demangle_objcpp_no_args() {
     assert_demangle!(Language::ObjCpp, utils::WITHOUT_ARGS, {
         "+[Foo bar:blub:]" => "+[Foo bar:blub:]",
diff --git a/symbolic-demangle/tests/test_swift.rs b/symbolic-demangle/tests/test_swift.rs
index 6166cf93..9f3877c5 100644
--- a/symbolic-demangle/tests/test_swift.rs
+++ b/symbolic-demangle/tests/test_swift.rs
@@ -2,6 +2,7 @@
 //! All functions were compiled with Swift 4.0 in a file called mangling.swift
 //! see https://github.com/apple/swift/blob/master/test/SILGen/mangling.swift
 #![allow(clippy::cognitive_complexity)]
+#![cfg(feature = "swift")]
 
 #[macro_use]
 mod utils;