Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: test workflows #1

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,28 @@ jobs:
with:
dockerfile: "test/**/Dockerfile-glob-*"
annotate: false
gh-action-mutltiple-invoke:
name: Action supports multiple invocations in a job
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
# Download and run default version
- uses: ./
with:
dockerfile: test/fixtures/Dockerfile-valid
# Download and run custom version
- uses: ./
with:
dockerfile: test/fixtures/Dockerfile-valid
version: 2.9.0
- run: chmod -x ${{ github.workspace }}/bin/hadolint
# Download and run custom version
- uses: ./
with:
dockerfile: test/fixtures/Dockerfile-valid
version: 2.9.0
# Run custom version
- uses: ./
with:
dockerfile: test/fixtures/Dockerfile-valid
version: 2.9.0
34 changes: 29 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,35 @@ runs:
- name: Download hadolint and make it available in path
shell: bash
run: |
echo "::debug::Downloading Hadolint ${{ inputs.version }}"
mkdir ${{ github.action_path }}/bin
curl -L -s -o ${{ github.action_path }}/bin/hadolint \
"https://github.com/hadolint/hadolint/releases/download/v${{ inputs.version }}/hadolint-Linux-x86_64"
chmod +x ${{ github.action_path }}/bin/hadolint
download_hadolint=false
# Check if hadolint exists
if [ ! -x "${{ github.action_path }}/bin/hadolint" ]; then
echo "::debug::Hadolint binary not found"
download_hadolint=true
else
echo "::debug::Hadolint binary exists"
version=$(${{ github.action_path }}/bin/hadolint --version 2>&1)
# Check if hadolint version can be retrieved
if [ $? -ne 0 ]; then
echo "::debug::Hadolint version cannot be retrieved"
download_hadolint=true
else
# Extract version number
version=$(echo "$version" | awk '{print $NF}')
if [ "$version" != "${{ inputs.version }}" ]; then
echo "::debug::Hadolint version does not match input version ($version != ${{ inputs.version }})"
download_hadolint=true
fi
fi
fi
# Download hadolint if necessary
if [ "$download_hadolint" = true ]; then
echo "::debug::Downloading Hadolint ${{ inputs.version }}"
mkdir -p ${{ github.action_path }}/bin
curl -L -s -o ${{ github.action_path }}/bin/hadolint \
"https://github.com/hadolint/hadolint/releases/download/v${{ inputs.version }}/hadolint-Linux-x86_64"
chmod +x ${{ github.action_path }}/bin/hadolint
fi
echo "${{ github.action_path }}/bin" >> "${GITHUB_PATH}"
- name: Invoke hadolint.sh
id: run
Expand Down