From 6bdbc486130ccdae7cb3e6afe672f4f10609ac04 Mon Sep 17 00:00:00 2001 From: Frederik Prijck Date: Wed, 8 Nov 2023 12:55:44 +0100 Subject: [PATCH 1/8] Add GitHub Actions --- .github/actions/build/build.yml | 47 +++++++++++++++++++++ .github/workflows/build.yml | 74 +++++++++++++++++++++++++++++++++ 2 files changed, 121 insertions(+) create mode 100644 .github/actions/build/build.yml create mode 100644 .github/workflows/build.yml diff --git a/.github/actions/build/build.yml b/.github/actions/build/build.yml new file mode 100644 index 00000000..d48589df --- /dev/null +++ b/.github/actions/build/build.yml @@ -0,0 +1,47 @@ +name: Build package +description: Build the SDK package + +inputs: + node: + description: The node version to use + required: false + default: 18 + working_directory: + description: The current working directory + required: true + config_path: + description: The path to the configuration file + required: true + test_cmd: + description: The command to run the tests + required: true + default: npm test + +runs: + using: composite + + steps: + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: ${{ inputs.node }} + cache: 'npm' + + - name: Install dependencies + shell: bash + run: npm ci + + - name: Copy config + shell: bash + run: | + cp ${{ inputs.working_directory }}/${{ inputs.config_path }}/auth.config.ts.example ${{ inputs.working_directory }}/${{ inputs.config_path }}/auth.config.ts + + - name: Build + shell: bash + run: npm run build + working-directory: ${{ inputs.working_directory }} + + - name: Tests + shell: bash + run: ${{ inputs.test_cmd }} + working-directory: ${{ inputs.working_directory }} \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..cbc0ef15 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,74 @@ +name: Unit Tests + +on: + merge_group: + workflow_dispatch: + pull_request: + branches: + - main + push: + branches: + - main + - feat/github-actions + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + +env: + NODE_VERSION: 18 + CACHE_KEY: '${{ github.ref }}-${{ github.run_id }}-${{ github.run_attempt }}' + +jobs: + build_angular: + name: Build Angular + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha || github.ref }} + + - name: Build Angular + uses: ./.github/actions/build + with: + node: ${{ env.NODE_VERSION }} + working_directory: angular + config_path: src/app + test_cmd: npm run test:ci + build_react: + name: Build React + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha || github.ref }} + + - name: Build React + uses: ./.github/actions/build + with: + node: ${{ env.NODE_VERSION }} + working_directory: react + config_path: src + build_vue: + name: Build Vue + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha || github.ref }} + + - name: Build React + uses: ./.github/actions/build + with: + node: ${{ env.NODE_VERSION }} + working_directory: vue + config_path: src \ No newline at end of file From c3440bd77e8958689d1f6045c030369855582fd2 Mon Sep 17 00:00:00 2001 From: Frederik Prijck Date: Wed, 8 Nov 2023 12:56:37 +0100 Subject: [PATCH 2/8] fix --- .github/actions/build/{build.yml => action.yml} | 0 .github/workflows/build.yml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename .github/actions/build/{build.yml => action.yml} (100%) diff --git a/.github/actions/build/build.yml b/.github/actions/build/action.yml similarity index 100% rename from .github/actions/build/build.yml rename to .github/actions/build/action.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cbc0ef15..163aff09 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Unit Tests +name: Build on: merge_group: From 5279319dfcfc9d3df3703bc8d7a9ae80d945af32 Mon Sep 17 00:00:00 2001 From: Frederik Prijck Date: Wed, 8 Nov 2023 13:00:32 +0100 Subject: [PATCH 3/8] update --- .github/actions/build/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index d48589df..c2a97e26 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -30,6 +30,7 @@ runs: - name: Install dependencies shell: bash run: npm ci + working-directory: ${{ inputs.working_directory }} - name: Copy config shell: bash From a2621e94e37d2764d0d6addeae92a510705f04fc Mon Sep 17 00:00:00 2001 From: Frederik Prijck Date: Wed, 8 Nov 2023 13:03:14 +0100 Subject: [PATCH 4/8] update --- .github/actions/build/action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index c2a97e26..aa651a49 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -25,7 +25,6 @@ runs: uses: actions/setup-node@v3 with: node-version: ${{ inputs.node }} - cache: 'npm' - name: Install dependencies shell: bash From db2356dbbc844644f1b0e0d49cc3a90b362b9ef2 Mon Sep 17 00:00:00 2001 From: Frederik Prijck Date: Wed, 8 Nov 2023 13:05:59 +0100 Subject: [PATCH 5/8] fix --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 163aff09..818c7cfc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,6 @@ on: push: branches: - main - - feat/github-actions permissions: contents: read From 69960e1af5755d0a9004329ff647bb6e2cac5a9d Mon Sep 17 00:00:00 2001 From: Frederik Prijck Date: Wed, 8 Nov 2023 13:06:56 +0100 Subject: [PATCH 6/8] fix --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 818c7cfc..872ed2d5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -65,7 +65,7 @@ jobs: with: ref: ${{ github.event.pull_request.head.sha || github.ref }} - - name: Build React + - name: Build Vue uses: ./.github/actions/build with: node: ${{ env.NODE_VERSION }} From 9a12b045fead75b763ac70b1c9e44374f35876d2 Mon Sep 17 00:00:00 2001 From: Frederik Prijck Date: Wed, 8 Nov 2023 13:07:48 +0100 Subject: [PATCH 7/8] fix --- .github/actions/build/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index aa651a49..ab4b903d 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -1,5 +1,5 @@ name: Build package -description: Build the SDK package +description: Build the example application inputs: node: From b937a7e7d81e892e0d0003066bed88da0cec9ba5 Mon Sep 17 00:00:00 2001 From: Frederik Prijck Date: Wed, 8 Nov 2023 13:08:16 +0100 Subject: [PATCH 8/8] fix --- .github/actions/build/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index ab4b903d..742f8b0c 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -1,4 +1,4 @@ -name: Build package +name: Build application description: Build the example application inputs: