Clean up matrix properties

Signed-off-by: Brett Logan <lindluni@github.com>
This commit is contained in:
Brett Logan 2022-12-23 20:25:04 -05:00
parent 4b3a1cb628
commit b4635519da
2 changed files with 31 additions and 29 deletions

View file

@ -13,37 +13,35 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
images: images:
- container-build-target: final_slim - target: slim
image-id-prefix: slim- - target: standard
deployment-environment-identifier: Production-SLIM
image-id: slim
- container-build-target: final_standard
image-id-prefix: ""
deployment-environment-identifier: Production
image-id: standard
timeout-minutes: 60 timeout-minutes: 60
steps: steps:
- name: Checkout Code - name: Checkout Code
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Update action.yml - name: Update action.yml
run: yq '.runs.image = "docker://ghcr.io/github/super-linter:${{ matrix.images.image-id }}"' -i action.yml run: yq '.runs.image = "docker://ghcr.io/github/super-linter:${{ matrix.images.target }}"' -i action.yml
- name: Retrieve Datetime - name: Retrieve Datetime
run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "${GITHUB_ENV}" run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "${GITHUB_ENV}"
- name: Build Docker Image
run: | - name: Build Image
docker build --build-arg "BUILD_DATE=${date}" \ uses: docker/build-push-action@v3
--build-arg "BUILD_DATE=${revision}" \ with:
--build-arg "BUILD_VERSION=${version}" \ context: .
--target "${target}" \ file: ./Dockerfile
--tag "ghcr.io/github/super-linter:${tag}" . build-args: |
env: BUILD_DATE=${{ env.BUILD_DATE }}
date: ${{ env.BUILD_DATE }} BUILD_REVISION=${{ github.sha }}
revision: ${{ github.sha }} BUILD_VERSION=${{ github.sha }}
tag: ${{ matrix.images.image-id }} load: false
target: ${{ matrix.images.container-build-target }} push: false
version: ${{ github.sha }} tags: ghcr.io/github/super-linter:${{ matrix.images.target }}
target: "${{ matrix.images.target }}"
- name: Test Local Action - name: Test Local Action
uses: ./ uses: ./
env: env:
@ -53,8 +51,10 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEFAULT_BRANCH: main DEFAULT_BRANCH: main
LOCAL_UPDATES: true LOCAL_UPDATES: true
- name: Run Test Suite - name: Run Test Suite
run: make IMAGE=${{ matrix.images.image-id }} test run: make IMAGE=${{ matrix.images.target }} test
- name: Upload the code coverage report - name: Upload the code coverage report
uses: codacy/codacy-coverage-reporter-action@v1.1 uses: codacy/codacy-coverage-reporter-action@v1.1
# Sometimes this fails when user does not have permissions to secrets # Sometimes this fails when user does not have permissions to secrets
@ -62,6 +62,7 @@ jobs:
with: with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: test/reports/cobertura/runTests.sh/cobertura.xml coverage-reports: test/reports/cobertura/runTests.sh/cobertura.xml
- name: Run Super-Linter Tests - name: Run Super-Linter Tests
run: | run: |
docker run \ docker run \
@ -73,8 +74,9 @@ jobs:
-v "${GITHUB_WORKSPACE}:/tmp/lint" \ -v "${GITHUB_WORKSPACE}:/tmp/lint" \
"ghcr.io/github/super-linter:${tag}" "ghcr.io/github/super-linter:${tag}"
env: env:
tag: ${{ matrix.images.image-id }} tag: ${{ matrix.images.target }}
- name: Lint Codebase
- name: Lint Entire Codebase
run: | run: |
docker run \ docker run \
-e RUN_LOCAL=true \ -e RUN_LOCAL=true \
@ -84,4 +86,4 @@ jobs:
-v "${GITHUB_WORKSPACE}:/tmp/lint" \ -v "${GITHUB_WORKSPACE}:/tmp/lint" \
"ghcr.io/github/super-linter:${tag}" "ghcr.io/github/super-linter:${tag}"
env: env:
tag: ${{ matrix.images.image-id }} tag: ${{ matrix.images.target }}

View file

@ -217,7 +217,7 @@ WORKDIR /stage
RUN ./build-venvs.sh RUN ./build-venvs.sh
################################################################################ ################################################################################
# Grab small clean image to build final_slim ################################### # Grab small clean image to build slim ###################################
################################################################################ ################################################################################
FROM alpine:3.17.0 as final_slim FROM alpine:3.17.0 as final_slim
@ -347,9 +347,9 @@ RUN ACTIONS_RUNNER_DEBUG=true WRITE_LINTER_VERSIONS_FILE=true IMAGE="${IMAGE}" /
ENTRYPOINT ["/action/lib/linter.sh"] ENTRYPOINT ["/action/lib/linter.sh"]
################################################################################ ################################################################################
# Grab small clean image to build final_standard ############################### # Grab small clean image to build standard ###############################
################################################################################ ################################################################################
FROM final_slim as final_standard FROM slim as standard
############### ###############
# Set up args # # Set up args #