diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index 88f0db1..91afbcb 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -2,7 +2,7 @@ name: 'Docker Build' description: 'Builds docker image' inputs: push: - required: false + required: true description: "Build and push image to registry (cannot be used together with load)" default: "false" diff --git a/.github/actions/run/action.yml b/.github/actions/run/action.yml index 39d6c3c..3793d4d 100644 --- a/.github/actions/run/action.yml +++ b/.github/actions/run/action.yml @@ -13,6 +13,17 @@ inputs: runs: using: 'composite' steps: + - name: Validate inputs + shell: bash + run: | + if [[ -z "${{ inputs.image }}" ]]; then + echo "Image is required" + exit 1 + fi + if [[ -z "${{ inputs.run }}" ]]; then + echo "Run is required" + exit 1 + fi - name: Run Docker Container shell: bash run: | @@ -25,7 +36,7 @@ runs: cat < root.sh #!/bin/bash whoami - su -s /bin/bash -c './exec.sh' olympia + su -s /bin/bash -c './exec.sh' root EOF # Make both files executable diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cbe6f84..08025c3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,21 +7,27 @@ jobs: steps: - uses: actions/checkout@v4 - uses: ./.github/actions/build + id: build - name: Test uses: ./.github/actions/run with: + image: ${{ steps.build.outputs.tags }} run: | echo "Testing" + npm ci npm run test lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: ./.github/actions/build + id: build - name: Lint uses: ./.github/actions/run with: + image: ${{ steps.build.outputs.tags }} run: | echo "Linting" + npm ci npm run lint diff --git a/Dockerfile b/Dockerfile index caff1c6..697e005 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,8 @@ FROM node:18 as base + WORKDIR /app -COPY --chown=node package*.json /app/ +COPY package*.json /app/ RUN /bin/bash <