diff --git a/.github/workflows/ci-go.yml b/.github/workflows/ci-go.yml new file mode 100644 index 000000000..2a7897e73 --- /dev/null +++ b/.github/workflows/ci-go.yml @@ -0,0 +1,25 @@ +name: ci-go + +on: + push: + tags: + - v* + branches: + - master + pull_request: +permissions: + contents: read + +jobs: + ci-from-docker: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: build from buildah + uses: redhat-actions/buildah-build@v2 + with: + image: test-image + tags: ${{ github.sha }} + context: . + containerfiles: ./Dockerfile.ci diff --git a/Dockerfile.ci b/Dockerfile.ci new file mode 100644 index 000000000..68e3e99ce --- /dev/null +++ b/Dockerfile.ci @@ -0,0 +1,36 @@ +FROM registry.access.redhat.com/ubi8/go-toolset:1.17.7 + +USER root +RUN mkdir -p /root/go/src/github.com/Azure/ARO-RP +WORKDIR /root/go/src/github.com/Azure/ARO-RP +ENV GOPATH=/root/go + +#we have multiple steps for copy so we can make use of caching +COPY vendor/ vendor + +COPY docs/ docs +COPY hack/ hack + +COPY swagger/ swagger +COPY test/ test +COPY python/ python +COPY portal/ portal + +COPY cmd/ cmd +COPY pkg/ pkg + +#COPY all files with an extension (directories not copied) +COPY ?*.* . +COPY Makefile LICENSE . + +COPY .git .git +COPY .gitignore .gitignore +COPY .pipelines .pipelines +COPY .gdn .gdn +COPY .github .github +COPY .env .env +COPY .sha256sum .sha256sum +COPY .config .config + +RUN hack/ci-utils/build.sh + diff --git a/hack/ci-utils/build.sh b/hack/ci-utils/build.sh new file mode 100755 index 000000000..37e07be76 --- /dev/null +++ b/hack/ci-utils/build.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +isClean() { + if [[ ! -z "$(git status -s)" ]] + then + echo "there are some modified files" + git status + exit 1 + fi +} + + +set -xe + +make generate +isClean +make build-all +isClean +make unit-test-go +isClean