diff --git a/.github/workflows/auto-assign.yml b/.github/workflows/auto-assign.yml index e527ce0..1217d5a 100644 --- a/.github/workflows/auto-assign.yml +++ b/.github/workflows/auto-assign.yml @@ -11,10 +11,9 @@ jobs: issues: write pull-requests: write steps: - - name: 'Auto-assign issue' - uses: pozil/auto-assign-issue@v1 - with: - repo-token:${{ secrets.GITHUB_TOKEN }} + - name: 'Auto-assign issue' + uses: pozil/auto-assign-issue@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} assignees: eyedeekay - numOfAssignee: 1 - + numOfAssignee: 1 \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..6df3a77 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,79 @@ +name: Go Tests + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + test: + runs-on: ubuntu-latest + + strategy: + fail-fast: false # Ensure all matrix jobs run even if some fail + matrix: + test_target: + - "test-string-all" + - "test-mapping-all" + - "test-crypto-aes-all" + - "test-crypto-dsa-all" + - "test-crypto-ed25519-all" + - "test-crypto-elg-all" + - "test-crypto-hmac-all" + - "test-i2np-header-all" + - "test-i2np-build-request-all" + - "test-key-cert-all" + - "test-keys-cert-all" + - "test-lease-set-all" + - "test-noise-transport-all" + - "test-router-address-all" + - "test-router-info-all" + - "test-su3-all" + - "test-tunnel-all" + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.21' # Adjust this version as needed + + - name: Cache Go modules + uses: actions/cache@v3 + with: + path: | + ~/go/pkg/mod + ~/.cache/go-build + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + + - name: Install gofumpt + run: go install mvdan.cc/gofumpt@latest + + - name: Go mod tidy + run: go mod tidy + + - name: Run ${{ matrix.test_target }} + run: make ${{ matrix.test_target }} + env: + GO: go + DEBUG_I2P: debug + CGO_ENABLED: 0 + + - name: Upload Test Logs (Optional) + if: always() + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.test_target }}-logs + path: ./test-logs/${{ matrix.test_target }}.log # Adjust this path as needed + + aggregate_results: + needs: test + runs-on: ubuntu-latest + steps: + - name: Aggregate Test Results + run: echo "All tests have been executed. Review individual job logs for details." diff --git a/Makefile b/Makefile index 1e2c80f..bf8f0f6 100644 --- a/Makefile +++ b/Makefile @@ -26,8 +26,26 @@ build: clean $(EXE) $(EXE): $(GO) build --tags netgo,osusergo -v -o $(EXE) -test: check_gofumpt fmt - $(GO) test -v -failfast ./lib/common/... +# Include test definitions +-include doc/tests/*.mk + +test: test-string-all \ + test-mapping-all \ + test-crypto-aes-all \ + test-crypto-dsa-all \ + test-crypto-ed25519-all \ + test-crypto-elg-all \ + test-crypto-hmac-all \ + test-i2np-header-all \ + test-i2np-build-request-all \ + test-key-cert-all \ + test-keys-cert-all \ + test-lease-set-all \ + test-noise-transport-all \ + test-router-address-all \ + test-router-info-all \ + test-su3-all \ + test-tunnel-all clean: $(GO) clean -v @@ -49,29 +67,3 @@ callvis: godoc: find lib -type d -exec bash -c "ls {}/*.go && godocdown -o ./{}/doc.md ./{}" \; -# Include test definitions --include doc/tests/*.mk - -# Define the all-tests target that runs every test suite -test-all: test-string-all \ - test-mapping-all \ - test-crypto-aes-all \ - test-crypto-dsa-all \ - test-crypto-ed25519-all \ - test-crypto-elg-all \ - test-crypto-hmac-all \ - test-i2np-header-all \ - test-i2np-build-request-all \ - test-key-cert-all \ - test-keys-cert-all \ - test-lease-set-all \ - test-noise-transport-all \ - test-router-address-all \ - test-router-info-all \ - test-su3-all \ - test-tunnel-all - -#-include $(shell find doc/tests -type f -name '*.mk') #search for .mk files recursively - -#test-base64-encode-decode-not-mangled: - #go test -v ./lib/common/base64 -run TestEncodeDecodeNotMangled \ No newline at end of file