From 4d3dec89d466fa45f24d94a802049812cb282835 Mon Sep 17 00:00:00 2001 From: Mike Radka Date: Fri, 2 May 2025 14:09:14 -0400 Subject: [PATCH 1/3] add validate.yml --- .github/workflows/validate.yml | 66 ++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 .github/workflows/validate.yml diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 0000000..0108ab0 --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,66 @@ +name: Clone Repos, Install Elixir, and Ensure JSON Schemas can be exported. + +on: + push: + branches: + - main + + pull_request: + branches: + - main + + workflow_dispatch: # Allows manual triggering of the workflow + +jobs: + setup-elixir-and-run: + runs-on: ubuntu-latest + + steps: + # Checkout the current repository + - name: Checkout Current Repository into splunk-ext + uses: actions/checkout@v3 + with: + path: splunk-ext + + # Clone the ocsf-server repository + - name: Clone ocsf-server Repository + run: | + git clone https://github.com/ocsf/ocsf-server + echo "Cloned ocsf/ocsf-server" + + # Clone the ocsf-schema repository (v1.0.0-rc.2) + - name: Clone ocsf-schema Repository + run: | + git clone --branch v1.0.0-rc.2 https://github.com/ocsf/ocsf-schema + echo "Cloned ocsf/ocsf-schema:v1.0.0-rc.2" + + # Install Elixir + - name: Install Elixir + uses: erlef/setup-beam@v1 + with: + elixir-version: '1.14' # Define the elixir version [required] + otp-version: '25.0' # Define the OTP version [required] + + # Restore depedencies cache + - name: Restore Dependencies Cache + uses: actions/cache@v3 + with: + path: ocsf-server/deps + key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} + restore-keys: ${{ runner.os }}-mix- + + # Install Dependencies + - name: Install Server Dependencies + working-directory: ocsf-server + run: | + mix deps.get + echo "Dependencies installed for ocsf-server" + + # Run ocsf-server tests + - name: Run Server Tests + working-directory: ocsf-server + run: | + SCHEMA_DIR=../ocsf-schema SCHEMA_EXTENSION=../splunk-ext mix test + echo "Tests completed for ocsf-server" + + # Test the JSON schema export for the Authentication class \ No newline at end of file From e80a5cb2c98a32026472d922f422419548559b14 Mon Sep 17 00:00:00 2001 From: Mike Radka Date: Fri, 2 May 2025 15:11:07 -0400 Subject: [PATCH 2/3] add extension to extensions directory in rc2 --- .github/workflows/validate.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 0108ab0..59d6659 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -16,11 +16,6 @@ jobs: runs-on: ubuntu-latest steps: - # Checkout the current repository - - name: Checkout Current Repository into splunk-ext - uses: actions/checkout@v3 - with: - path: splunk-ext # Clone the ocsf-server repository - name: Clone ocsf-server Repository @@ -34,6 +29,12 @@ jobs: git clone --branch v1.0.0-rc.2 https://github.com/ocsf/ocsf-schema echo "Cloned ocsf/ocsf-schema:v1.0.0-rc.2" + # Checkout the current repository + - name: Checkout Current Repository into ocsf-schema/extensions/splunk + uses: actions/checkout@v3 + with: + path: ocsf-schema/extensions/splunk + # Install Elixir - name: Install Elixir uses: erlef/setup-beam@v1 @@ -60,7 +61,7 @@ jobs: - name: Run Server Tests working-directory: ocsf-server run: | - SCHEMA_DIR=../ocsf-schema SCHEMA_EXTENSION=../splunk-ext mix test + SCHEMA_DIR=../ocsf-schema mix test echo "Tests completed for ocsf-server" # Test the JSON schema export for the Authentication class \ No newline at end of file From 031c1a52db76a181c468d88400ea7edabf2ba04f Mon Sep 17 00:00:00 2001 From: Mike Radka Date: Fri, 2 May 2025 18:41:44 -0400 Subject: [PATCH 3/3] Spin up the server --- .github/workflows/validate.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 59d6659..a59dd75 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -64,4 +64,9 @@ jobs: SCHEMA_DIR=../ocsf-schema mix test echo "Tests completed for ocsf-server" - # Test the JSON schema export for the Authentication class \ No newline at end of file + # Test the JSON schema export for the Authentication class + - name: Test JSON Schema Export for Authentication Class + working-directory: ocsf-server + run: | + SCHEMA_DIR=../ocsf-schema iex -S mix phx.server + echo "JSON schema export completed for Authentication class" \ No newline at end of file