diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 00000000..c8e66bd0 --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,35 @@ +name: pull-request + +on: [pull_request] + +jobs: + validate: + runs-on: ubuntu-latest + name: Validate + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Run asdf + uses: asdf-vm/actions/install@v1 + - name: Run hadolint + uses: hadolint/hadolint-action@v1.5.0 + with: + dockerfile: ./src/docker/Dockerfile + - name: Run pre-commit + uses: pre-commit/action@v2.0.3 + + test: + runs-on: ubuntu-latest + needs: validate + name: Build Docker Image and Run Unit Tests + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Docker Layer Caching + uses: satackey/action-docker-layer-caching@v0.0.11 + - name: Setup Task + uses: arduino/setup-task@v1 + - name: Build the Docker Image + run: task build TAG=local + - name: Run Unit Tests + run: task test TAG=local diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..2b4972e3 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,33 @@ +name: release + +on: + release: + types: [published] + +jobs: + deliver: + runs-on: ubuntu-latest + name: Deliver to Docker Hub + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + - name: Extract Metadata (tags & labels) + id: meta + uses: docker/metadata-action@v3 + with: + images: saicoss/anvil + - name: Build and Push to Dockerhub + uses: docker/build-push-action@v2 + with: + context: . + file: src/docker/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d0f7a800..1b70b238 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,3 @@ repos: rev: v2.3.2 hooks: - id: prettier - - repo: https://github.com/jas-on/pre-commit-hadolint - rev: 1.0.1 - hooks: - - id: hadolint diff --git a/spec/docker_spec.sh b/spec/docker_spec.sh index ab698ede..02880b4a 100755 --- a/spec/docker_spec.sh +++ b/spec/docker_spec.sh @@ -2,7 +2,7 @@ Describe "printVersion()" printVersion() { - docker --version | grep "${DOCKER_VERSION}" + dnf list docker-ce | grep "${DOCKER_VERSION}" } It "validates tool is installed by checking version"