diff --git a/.github/actions/setup-and-login/action.yml b/.github/actions/setup-and-login/action.yml index 07d78f81..6ce9698b 100644 --- a/.github/actions/setup-and-login/action.yml +++ b/.github/actions/setup-and-login/action.yml @@ -1,6 +1,12 @@ name: Setup Node, Env and login to GHCR inputs: + install-packages: + required: false + default: false + build-and-run-server: + required: false + default: false ghcr-username: required: false default: '' @@ -43,3 +49,18 @@ runs: - uses: actions/setup-node@v4 with: node-version: 20 + + - name: Install packages + if: inputs.install-packages == true + shell: bash + run: | + npm i --prefix=app/server + npm i --prefix=app/static + + - name: Build and run server + if: inputs.build-and-run-server == true + shell: bash + run: | + ./scripts/build.sh + ./scripts/run-dependencies.sh + npm run serve --prefix=app/server & diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c1203cfb..66ec473d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,6 +7,8 @@ jobs: - uses: actions/checkout@v4 - name: Setup Node uses: ./.github/actions/setup-and-login + with: + install-packages: true - name: Test back end run: npm test --prefix=app/server @@ -26,13 +28,9 @@ jobs: - uses: actions/checkout@v4 - name: Setup Node uses: ./.github/actions/setup-and-login + with: + build-and-run-server: true - - name: Build - run: ./scripts/build.sh - - name: Run dependencies - run: ./scripts/run-dependencies.sh - - name: Run server - run: npm run serve --prefix=app/server & - name: Test back end integration run: npm run integration-test --prefix=app/server @@ -42,13 +40,9 @@ jobs: - uses: actions/checkout@v4 - name: Setup Node uses: ./.github/actions/setup-and-login + with: + build-and-run-server: true - - name: Build - run: ./scripts/build.sh - - name: Run dependencies - run: ./scripts/run-dependencies.sh - - name: Run server - run: npm run serve --prefix=app/server & - name: Test e2e run: npm run test:e2e --prefix=app/static @@ -58,6 +52,8 @@ jobs: - uses: actions/checkout@v4 - name: Setup Node uses: ./.github/actions/setup-and-login + with: + install-packages: true - name: Lint back end run: npm run lint --prefix=app/server