The 7-inning games you're talking about, e.g., for doubleheaders, do not affect the fact that the standard game length is 9 innings, so you use 9 in calculating the ERA.
You don't calculate ERA game by game, but rather, cumulatively over the season, so whatever the length is at your level, you use that number throughout your stat sheet. If an adult pitcher gives up 1 earned run in 5 innings and that's all he ever pitches, his ERA is going to be 1.80. But that's only if he never pitched before and never pitches after. There's absolutely no point in determining what his ERA was for the one day. The whole point of ERA is to gather a statistic over a period of time and try to have something you can compare to others on an "apples to apples" basis.
If a game ends early, you do get credit for a no-hitter or perfect game but you'd probably note the shortened game in the process. In any event there is no statistical category for these, they just go into your team's record book. The stats compile into the season stats same as if your pitcher had been removed prior to completing a 9-inning game.