diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4eb4b6f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,51 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + hadolint-test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run hadolint + uses: hadolint/hadolint-action@v3.1.0 + with: + dockerfile: Dockerfile + + dockerfile-lint-test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run dockerfile_lint + run: npx dockerfile_lint + + build-test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Get latest jsonlint version + id: jsonlint-version + run: | + if ! LATEST_JSONLINT=$(curl -fsSL https://registry.npmjs.org/jsonlint | jq -r '.["dist-tags"].latest'); then + echo "Failed to fetch jsonlint version" >&2 + exit 1 + fi + echo "LATEST_JSONLINT=${LATEST_JSONLINT}" >> $GITHUB_ENV + + - name: Build Docker image + run: docker build --build-arg JSONLINT_VERSION="$LATEST_JSONLINT" -t docker-jsonlint:${{ github.sha }} . + + - name: Test Docker image + run: docker run --rm docker-jsonlint:${{ github.sha }} jsonlint --help diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 11c2876..0000000 --- a/.travis.yml +++ /dev/null @@ -1,41 +0,0 @@ ---- - -dist: focal - -services: - - docker - -stages: - - Static test - - Build test - -jobs: - include: - - stage: Static test - env: - - Test: hadolint - language: minimal - script: - - docker run --rm -i hadolint/hadolint < Dockerfile - - - stage: Static test - env: - - Test: dockerfile_lint - language: node_js - node_js: - - "18" - script: - - npx --cache .npx dockerfile_lint - cache: - directories: - - .npx - - - stage: Build test - language: minimal - before_script: - - LATEST_JSONLINT="$(curl https://registry.npmjs.org/jsonlint -so- | jq -r '.["dist-tags"].latest')" - - export LATEST_JSONLINT - script: - - docker build --build-arg JSONLINT_VERSION="$LATEST_JSONLINT" -t docker-jsonlint:$TRAVIS_COMMIT . - after_success: - - docker run --rm docker-jsonlint:$TRAVIS_COMMIT jsonlint --help