@@ -58,47 +58,63 @@ jobs:
58
58
dockerfile : ${{ (contains(github.event.head_commit.message, 'quick build') && 'Dockerfile-quick') || 'Dockerfile' }}
59
59
push : ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'push' && github.repository == 'oxsecurity/megalinter') }}
60
60
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
102
118
#
103
119
# # Upload MegaLinter artifacts
104
120
# - name: Archive production artifacts
0 commit comments