Moments before actress Gabrielle Ruiz took the stage to perform songs from TV’s “Crazy Ex-Girlfriend” live for the first time, she was hanging out backstage at SF Sketchfest with series co-stars Rachel Bloom and Vincent Rodriguez III. The January event — a live showcase for the subversive musical comedy’s co-creator Bloom — was running late as the line to get in wrapped around the Castro Theatre twice.

So, they went live on Instagram and started riffing and singing for fans who were already in the theater, still waiting in line or just hanging out at home. This led to an impromptu a cappella rendition of Ruiz’s character Valencia Perez’s Season 1 song “I’m So Good at Yoga” that went over so well, they ended up reprising it onstage that night. In some ways, that show was a test run for a full-fledged “Crazy Ex-Girlfriend” tour, which kicked off last week in Los Angeles.

“Whoever is coming to the show gets to watch us mess around and see what we do behind the scenes off camera,” Ruiz says. “The fact that the fans want to see us perform [these songs] is just so lovely. It’s an honor to do that.”

It’s not normal for a TV show to go on tour, but “Crazy Ex-Girlfriend” isn’t a normal TV show. The CW series, which was just renewed for a fourth and final season, has created more than 100 original songs — some parodies, some homage, all funny — since its debut in 2015. (Bloom works out the show’s music with co-creator Aline Brosh McKenna, songwriter Jack Dolgen and Adam Schlesinger of Fountains of Wayne fame.)

For Ruiz, who plays the archnemesis-turned-BFF of Bloom’s Rebecca Bunch, the tour allows the actress to flex her Broadway bona fides, while also charting her character’s major changes over three seasons.

“I am very excited to sing ‘The Evolution of Valencia,’ as I’ve been calling it: from ‘Women Gotta Stick Together’ in Season 1 to ‘This Is My Movement’ in Season 3,” Ruiz says. “I love how different she is in both songs — that her passion and her drive are all the same; she just learned how to filter it correctly, for the better.”

Like Rebecca — who began the series by moving on a whim to West Covina, Calif., to try to reunite with a former boyfriend from summer camp (Rodriguez’s Josh Chan), then recognized that she was struggling with mental illness — Valencia has grown over the show’s run. First, she was Josh’s girlfriend (before Rebecca broke them up), then she and Rebecca became friends, and now she’s running her own party-planning business and dating a woman, a revelation that was made very matter-of-factly during a Season 3 montage.

“Valencia’s coming out was just another day,” Ruiz says. “I feel very lucky that I could breathe life into this character that is so fascinating and has so many canyons of emotions.”

When the tour arrives at the Lincoln Theatre on Friday, Ruiz, Bloom and Rodriguez will be joined by co-stars Scott Michael Foster (Rebecca’s current love interest, Nathaniel), Pete Gardner (Rebecca’s co-worker Darryl) and Donna Lynne Champlin (Rebecca’s friend Paula). Because the cast changes with each tour date, the setlist and the structure of the show also change.

“There will be a version of stand-up and improv occurring,” Ruiz says. “Not only will we do that onstage, we just did that in Rachel’s living room yesterday rehearsing. We just can’t help ourselves.”

With her musical theater background, it was hard at first for Ruiz to accept that the show wouldn’t be as regimented as a Broadway production, but now she embraces the flexibility. When asked which of the show’s three different theme songs they’ll be doing live, inspiration suddenly strikes.

“I don’t think that has been determined yet — still up for debate,” she says, before pausing: “Oh, my gosh, you just gave me a great idea. I’m gonna call Rachel right after this. See, I’m telling you — it’s changing, it changes every hour on the hour.”

Lincoln Theatre, 1215 U St. NW; Fri., 8 p.m., sold out.