From 8d29200ade439953a4578911aa22816a7df4ee5d Mon Sep 17 00:00:00 2001 From: agracio Date: Tue, 12 Nov 2024 16:00:08 +0000 Subject: [PATCH] adding GitHub workflow --- .github/workflows/main.yml | 69 +++++++++++++++++++++++++++++++++++ tests/converter.junit.test.js | 6 +-- 2 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..4d84614 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,69 @@ +name: Test + +on: + push: + paths-ignore: + - '.github/FUNDING.YML' + - '**/*.md' + - '**/*.d.ts' + - '.gitconfig' + - '.gitignore' + - '.npmignore' + - 'LICENSE*' + - '.idea/**' + - '.vscode/**' + - '.circleci' + - '.circleci/*' + - 'README.md' + +jobs: + test: + runs-on: ${{ matrix.os }} + name: test-${{ matrix.os }} + strategy: + matrix: + os: [macos-latest, ubuntu-latest, windows-2022] + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup NodeJS + uses: actions/setup-node@v4 + with: + node-version: '22' + cache: 'npm' + cache-dependency-path: package-lock.json + + - name: Cache node modules + id: cache-nodemodules + uses: actions/cache@v4 + env: + cache-name: cache-node-modules + with: + path: node_modules + key: ${{ matrix.os }}${{ hashFiles('package-lock.json') }} + + - name: npm install + run: npm i + + - name: "Run tests" + run: npm test + +# - name: Upload artifacts +# uses: actions/upload-artifact@v4.3.3 +# if: success() +# with: +# name: ${{ matrix.os }}-${{ matrix.node }} +# path: | +# test-results.xml +# mochawesome.json +# +# - name: Test Report +# uses: phoenix-actions/test-reporting@v15 +# if: success() +# with: +# name: test-results-${{ matrix.os }}-node-${{ matrix.node }} +# fail-on-error: true +# path: mochawesome.json # Path to test results +# reporter: mochawesome-json + diff --git a/tests/converter.junit.test.js b/tests/converter.junit.test.js index 84b48ae..d28c7ce 100644 --- a/tests/converter.junit.test.js +++ b/tests/converter.junit.test.js @@ -55,21 +55,21 @@ describe("JUnit converter tests", () => { } test('convert junit-jenkins.xml', async() => { - let options = createOptions('junit-jenkins.xml', 'junit') + let options = createOptions('junit-jenkins.xml', 'junit'); await margeConvert(options); compare(options); }); test('convert junit-notestsuites.xml', async() => { - let options = createOptions('junit-notestsuites.xml', 'junit') + let options = createOptions('junit-notestsuites.xml', 'junit'); await margeConvert(options); compare(options, 'junit-jenkins-mochawesome.json'); }); test('convert junit-testsuites-noattributes.xml', async() => { - let options = createOptions('junit-testsuites-noattributes.xml', 'junit') + let options = createOptions('junit-testsuites-noattributes.xml', 'junit'); await margeConvert(options); compare(options, 'junit-jenkins-mochawesome.json');