Skip to content

Commit

Permalink
add option to encrypt aoc input
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCK committed Dec 12, 2024
1 parent ad67cd5 commit ebe13a2
Show file tree
Hide file tree
Showing 13 changed files with 122 additions and 2,011 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/codacy-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

name: Codacy Security Scan

on:
on:
push:
branches: [ "master", "main" ]
pull_request:
Expand All @@ -22,14 +22,16 @@ jobs:
# Checkout the repository to the GitHub Actions runner
- name: Checkout code
uses: actions/checkout@v2

- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'zulu'
cache: maven
- name: Build with Maven
env:
AOC_KEY: ${{ secrets.AOC_KEY }}
run: mvn -B compile compiler:testCompile --file pom.xml

# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,6 @@ jobs:
distribution: 'zulu'
cache: maven
- name: Build with Maven
env:
AOC_KEY: ${{ secrets.AOC_KEY }}
run: mvn -B package --file pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,12 @@ protected void runTest(Runnable solution, String name) throws Exception {

assertEquals(getFileAsResult(name), this.output.toString());
}

protected void runEncryptedTest(Runnable solution, String name) throws Exception {
pipeResourceEncryptedResource(name, System.getenv("AOC_KEY"));

solution.run();

assertEquals(getFileAsResult(name), this.output.toString());
}
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
package org.ck.adventofcode.year2015;

import org.ck.adventofcode.util.BaseAOCTest;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;

class Day01Test extends BaseAOCTest {
@ParameterizedTest
@ValueSource(strings = {"01", "01a", "01b", "01c", "01d", "01e", "01f", "01g", "01h", "01i"})
@ValueSource(strings = {"01a", "01b", "01c", "01d", "01e", "01f", "01g", "01h", "01i"})
void testOne(String name) throws Exception {
runTest(new Day01()::partOne, "day01/%s".formatted(name));
}

@Test
void testOne() throws Exception {
runEncryptedTest(new Day01()::partOne, "day01/01");
}

@ParameterizedTest
@ValueSource(strings = {"02", "02a", "02b"})
@ValueSource(strings = {"02a", "02b"})
void testTwo(String name) throws Exception {
runTest(new Day01()::partTwo, "day01/%s".formatted(name));
}

@Test
void testTwo() throws Exception {
runEncryptedTest(new Day01()::partTwo, "day01/02");
}
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
package org.ck.adventofcode.year2015;

import org.ck.adventofcode.util.BaseAOCTest;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;

class Day02Test extends BaseAOCTest {
@ParameterizedTest
@ValueSource(strings = {"01", "01a", "01b"})
@ValueSource(strings = {"01a", "01b"})
void testOne(String name) throws Exception {
runTest(new Day02()::partOne, "day02/%s".formatted(name));
}

@Test
void testOne() throws Exception {
runEncryptedTest(new Day02()::partOne, "day02/01");
}

@ParameterizedTest
@ValueSource(strings = {"02", "02a", "02b"})
@ValueSource(strings = {"02a", "02b"})
void testTwo(String name) throws Exception {
runTest(new Day02()::partTwo, "day02/%s".formatted(name));
}

@Test
void testTwo() throws Exception {
runEncryptedTest(new Day02()::partTwo, "day02/02");
}
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading

0 comments on commit ebe13a2

Please sign in to comment.