2019-10-02 22:50:00 +02:00
|
|
|
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-image/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
|
2019-10-02 22:58:07 +02:00
|
|
|
|
|
|
|
- name: Run integration test
|
|
|
|
uses: ./
|
2019-10-02 22:50:00 +02:00
|
|
|
with:
|
|
|
|
dockerfile: testdata/Dockerfile
|
|
|
|
|
|
|
|
release:
|
|
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
|
|
|
name: Release
|
|
|
|
runs-on: ubuntu-latest
|
2019-10-02 22:51:32 +02:00
|
|
|
needs: integration
|
2019-10-02 22:50:00 +02:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
|
|
|
- name: Semantic Release
|
|
|
|
uses: brpaz/action-semantic-release@master
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|