Skip to content

Commit 7aab20a

Browse files
committed
Adding the tests back in
1 parent 92e168c commit 7aab20a

File tree

2 files changed

+67
-44
lines changed

2 files changed

+67
-44
lines changed

.github/workflows/-build-docker.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ jobs:
3131
- name: Checkout Code
3232
uses: actions/checkout@v3
3333

34+
# Free disk space
35+
- name: Free Disk space
36+
shell: bash
37+
run: |
38+
sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android
39+
sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET
40+
3441
- name: Set up QEMU
3542
uses: docker/setup-qemu-action@v2
3643

@@ -73,14 +80,14 @@ jobs:
7380
uses: docker/build-push-action@v4
7481
with:
7582
file: ${{ inputs.dockerfile }}
76-
platforms: linux/amd64,linux/arm64
83+
platforms: linux/amd64 #,linux/arm64 -Temporary, getting no space left on device
7784
build-args: |
78-
BUILD_DATE=${{ env.BUILD_DATE }}
85+
BUILD_DATE=${{ env.BUILD_DATE }}0
7986
BUILD_REVISION=${{ github.sha }}
8087
BUILD_VERSION=alpha
8188
load: false
8289
push: ${{ inputs.push }}
83-
# outputs: ${{ (!inputs.push && 'type=oci,dest=image.tar') || '' }}
90+
outputs: ${{ (!inputs.push && 'type=oci,dest=image.tar') || '' }}
8491
secrets: |
8592
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
8693
tags: ${{ steps.image_tag.outputs.tag }}

.github/workflows/deploy-DEV.yml

Lines changed: 57 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -58,47 +58,63 @@ jobs:
5858
dockerfile: ${{ (contains(github.event.head_commit.message, 'quick build') && 'Dockerfile-quick') || 'Dockerfile' }}
5959
push: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'push' && github.repository == 'oxsecurity/megalinter') }}
6060
imageName: megalinter
61-
# steps:
62-
#
63-
# # Free disk space
64-
# - name: Free Disk space
65-
# shell: bash
66-
# run: |
67-
# sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android
68-
# sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET
69-
#
70-
# #####################################
71-
# # Run Linter test cases #
72-
# #####################################
73-
# - name: Run Test Cases
74-
# shell: bash
75-
# run: |
76-
# GITHUB_REPOSITORY=$([ "${{ github.event_name }}" == "pull_request" ] && echo "${{ github.event.pull_request.head.repo.full_name }}" || echo "${{ github.repository }}")
77-
# GITHUB_BRANCH=$([ "${{ github.event_name }}" == "pull_request" ] && echo "${{ github.head_ref }}" || echo "${{ github.ref_name }}")
78-
#
79-
# export CI_ENV="$(bash <(curl -s https://codecov.io/env)) -e GITHUB_ACTIONS"
80-
# TEST_KEYWORDS_TO_USE=""
81-
# if [[ "${{ github.event.head_commit.message }}" == *"TEST_KEYWORDS="* ]]; then
82-
# COMMIT_MSG="${{ github.event.head_commit.message }}"
83-
# TEST_KEYWORDS_TO_USE=${COMMIT_MSG#*TEST_KEYWORDS=}
84-
# echo "Run only tests with keywords ${TEST_KEYWORDS_TO_USE}"
85-
# if [[ "${TEST_KEYWORDS_TO_USE}" =~ $'\r' ]]; then
86-
# echo "Problem while parsing test keywords: switch back to all tests"
87-
# TEST_KEYWORDS_TO_USE=""
88-
# fi
89-
# fi
90-
#
91-
# docker run $CI_ENV -e TEST_CASE_RUN=true -e OUTPUT_FORMAT=text -e OUTPUT_FOLDER=${{ github.sha }} -e OUTPUT_DETAIL=detailed -e GITHUB_SHA=${{ github.sha }} -e GITHUB_REPOSITORY=${GITHUB_REPOSITORY} -e GITHUB_BRANCH=${GITHUB_BRANCH} -e PAT="${{ secrets.PAT }}" -e TEST_KEYWORDS="${TEST_KEYWORDS_TO_USE}" -e MEGALINTER_VOLUME_ROOT="${GITHUB_WORKSPACE}" -v "/var/run/docker.sock:/var/run/docker.sock:rw" -v ${GITHUB_WORKSPACE}:/tmp/lint oxsecurity/megalinter:${{ steps.image_tag.outputs.tag }}
92-
# timeout-minutes: 90
93-
#
94-
# #####################################
95-
# # Run Linter against ALL code base #
96-
# #####################################
97-
# - name: Run against all code base
98-
# if: "!contains(github.event.head_commit.message, 'quick build')"
99-
# shell: bash
100-
# run: docker run -e GITHUB_REPOSITORY="${{ github.repository }}" -e GITHUB_SHA="${{ github.sha }}" -e GITHUB_TOKEN="${{ github.token }}" -e GITHUB_RUN_ID="${{ github.run_id }}" -e PAT="${{ secrets.PAT }}" -v "/var/run/docker.sock:/var/run/docker.sock:rw" -v ${GITHUB_WORKSPACE}:/tmp/lint oxsecurity/megalinter:${{ steps.image_tag.outputs.tag }}
101-
# timeout-minutes: 15
61+
test:
62+
strategy:
63+
fail-fast: false
64+
max-parallel: 10
65+
matrix:
66+
platform: [amd64] #,linux/arm64 -Temporary, getting no space left on device
67+
steps:
68+
- uses: actions/checkout@v3
69+
- uses: actions/download-artifact@v3
70+
with:
71+
name: oci-tar
72+
path: /oci-tar
73+
- name: Load image
74+
shell: bash
75+
run: |
76+
if [[ -f /oci-tar/image.tar ]]; then
77+
skopeo copy --override-os=linux --override-arch=${{ matrix.platform }} oci-archive:/oci-tar/image.tar oxsecurity/megalinter:${{ steps.image_tag.outputs.tag }}
78+
fi
79+
# Free disk space
80+
- name: Free Disk space
81+
shell: bash
82+
run: |
83+
sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android
84+
sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET
85+
86+
#####################################
87+
# Run Linter test cases #
88+
#####################################
89+
- name: Run Test Cases
90+
shell: bash
91+
run: |
92+
GITHUB_REPOSITORY=$([ "${{ github.event_name }}" == "pull_request" ] && echo "${{ github.event.pull_request.head.repo.full_name }}" || echo "${{ github.repository }}")
93+
GITHUB_BRANCH=$([ "${{ github.event_name }}" == "pull_request" ] && echo "${{ github.head_ref }}" || echo "${{ github.ref_name }}")
94+
95+
export CI_ENV="$(bash <(curl -s https://codecov.io/env)) -e GITHUB_ACTIONS"
96+
TEST_KEYWORDS_TO_USE=""
97+
if [[ "${{ github.event.head_commit.message }}" == *"TEST_KEYWORDS="* ]]; then
98+
COMMIT_MSG="${{ github.event.head_commit.message }}"
99+
TEST_KEYWORDS_TO_USE=${COMMIT_MSG#*TEST_KEYWORDS=}
100+
echo "Run only tests with keywords ${TEST_KEYWORDS_TO_USE}"
101+
if [[ "${TEST_KEYWORDS_TO_USE}" =~ $'\r' ]]; then
102+
echo "Problem while parsing test keywords: switch back to all tests"
103+
TEST_KEYWORDS_TO_USE=""
104+
fi
105+
fi
106+
107+
docker run $CI_ENV -e TEST_CASE_RUN=true -e OUTPUT_FORMAT=text -e OUTPUT_FOLDER=${{ github.sha }} -e OUTPUT_DETAIL=detailed -e GITHUB_SHA=${{ github.sha }} -e GITHUB_REPOSITORY=${GITHUB_REPOSITORY} -e GITHUB_BRANCH=${GITHUB_BRANCH} -e PAT="${{ secrets.PAT }}" -e TEST_KEYWORDS="${TEST_KEYWORDS_TO_USE}" -e MEGALINTER_VOLUME_ROOT="${GITHUB_WORKSPACE}" -v "/var/run/docker.sock:/var/run/docker.sock:rw" -v ${GITHUB_WORKSPACE}:/tmp/lint oxsecurity/megalinter:${{ steps.image_tag.outputs.tag }}
108+
timeout-minutes: 90
109+
110+
#####################################
111+
# Run Linter against ALL code base #
112+
#####################################
113+
- name: Run against all code base
114+
if: "!contains(github.event.head_commit.message, 'quick build')"
115+
shell: bash
116+
run: docker run -e GITHUB_REPOSITORY="${{ github.repository }}" -e GITHUB_SHA="${{ github.sha }}" -e GITHUB_TOKEN="${{ github.token }}" -e GITHUB_RUN_ID="${{ github.run_id }}" -e PAT="${{ secrets.PAT }}" -v "/var/run/docker.sock:/var/run/docker.sock:rw" -v ${GITHUB_WORKSPACE}:/tmp/lint oxsecurity/megalinter:${{ steps.image_tag.outputs.tag }}
117+
timeout-minutes: 15
102118
#
103119
# # Upload MegaLinter artifacts
104120
# - name: Archive production artifacts

0 commit comments

Comments
 (0)