mirror of
https://github.com/hadolint/hadolint-action.git
synced 2024-08-16 10:09:53 +02:00
83 lines
1.9 KiB
YAML
83 lines
1.9 KiB
YAML
name: "CI"
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
|
|
env:
|
|
TEST_IMAGE_NAME: hadolint-action:${{github.sha}}
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
container: pipelinecomponents/hadolint:latest
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
- name: Run hadolint
|
|
run: hadolint Dockerfile
|
|
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
needs: ['lint']
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
- name: Build Docker image
|
|
run: docker build -t $TEST_IMAGE_NAME .
|
|
|
|
- name: Save Docker image artifact
|
|
run: docker save -o action.tar $TEST_IMAGE_NAME
|
|
|
|
- name: Upload image artifact
|
|
uses: actions/upload-artifact@master
|
|
with:
|
|
name: action-image
|
|
path: action.tar
|
|
|
|
test:
|
|
name: Unit Tests
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
|
|
- name: Pull Image artifact
|
|
uses: actions/download-artifact@master
|
|
with:
|
|
name: action-image
|
|
|
|
- name: Load image into docker context
|
|
run: docker load -i action.tar
|
|
|
|
- name: Get Image Name
|
|
id: image_name
|
|
run: echo "##[set-output name=image;]$(echo $TEST_IMAGE_NAME)"
|
|
|
|
- name: Run Structure tests
|
|
uses: brpaz/structure-tests-action@master
|
|
with:
|
|
image: ${{ steps.image_name.outputs.image }}
|
|
|
|
integration:
|
|
name: Integration Tests
|
|
runs-on: ubuntu-latest
|
|
needs: test
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
|
|
- name: Run integration test
|
|
uses: ./
|
|
with:
|
|
dockerfile: testdata/Dockerfile
|
|
|
|
release:
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
|
name: Release
|
|
runs-on: ubuntu-latest
|
|
needs: integration
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
- name: Semantic Release
|
|
uses: brpaz/action-semantic-release@master
|
|
env:
|
|
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|