diff --git a/.github/workflows/agent.yml b/.github/workflows/agent.yml new file mode 100644 index 00000000..447eccd0 --- /dev/null +++ b/.github/workflows/agent.yml @@ -0,0 +1,57 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Agent package + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + fmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.7 + uses: actions/setup-python@v3 + with: + python-version: 3.7 + - name: fmt + run: | + make -e setup build + test -z "$(go fmt ./pkg/...)" + tests: + runs-on: ubuntu-latest + env: + COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-go@v2 + with: + go-version: '1.13' + check-latest: true + - name: Set up Python 3.7 + uses: actions/setup-python@v3 + with: + python-version: 3.7 + - name: hadolint + run: | + make -e setup build + make -e lint + for f in `find scripts/dockerfiles -type f`; do echo $f; docker run --rm -i hadolint/hadolint:v2.1.0 < $f; done + - name: coveralls + id: make_coverall + run: | + make -e cover COVER_FILE=coverage.txt + - name: post coverall + if: steps.make_coverall.outcome == 'success' + run: | + go get github.com/mattn/goveralls + goveralls -coverprofile=coverage.txt -service=github + - name: acceptance test + run: | + pip install -r ./tests/acceptance/requirements.txt + make -e setup build + MYHOST="http://localhost:8080" make test-acceptance diff --git a/.travis.yml b/.travis.yml index 39aeb1f4..93f5e856 100644 --- a/.travis.yml +++ b/.travis.yml @@ -76,9 +76,11 @@ jobs: os: linux dist: xenial language: python - python: "3.9" + python: "3.7" install: - - pip install -r tests/acceptance/requirements.txt + - python3.7 -m pip install pip==21.3.1 + - pip --version + - python3.7 -m pip install -r tests/acceptance/requirements.txt script: - MYHOST="http://localhost:8080" make test-acceptance diff --git a/scripts/dockerfiles/Dockerfile.alpine b/scripts/dockerfiles/Dockerfile.alpine index 295f8ba8..2b40487c 100644 --- a/scripts/dockerfiles/Dockerfile.alpine +++ b/scripts/dockerfiles/Dockerfile.alpine @@ -2,13 +2,13 @@ ARG GO_VERSION FROM golang:$GO_VERSION-alpine3.10 as builder # hadolint ignore=DL3018 RUN addgroup -S agentgroup && adduser -S agentuser -G agentgroup -RUN apk add --no-cache make gcc libc-dev git curl +RUN apk add --no-cache make=4.2.1-r2 gcc=8.3.0-r0 libc-dev=0.7.1-r0 git=2.22.5-r0 curl=7.66.0-r4 WORKDIR /go/src/github.com/optimizely/agent COPY . . RUN make setup build FROM alpine:3.10 -RUN apk add --no-cache ca-certificates +RUN apk add --no-cache cca-certificates=20191127-r2 COPY --from=builder /go/src/github.com/optimizely/agent/bin/optimizely /optimizely COPY --from=builder /etc/passwd /etc/passwd USER agentuser diff --git a/tests/acceptance/requirements.txt b/tests/acceptance/requirements.txt index b76ed147..2fd6f085 100644 --- a/tests/acceptance/requirements.txt +++ b/tests/acceptance/requirements.txt @@ -1,4 +1,4 @@ pytest>=5.3.2 -pytest-clarity>=0.2.0a1 +pytest-clarity==1.0.1 requests>=2.22.0 openapi_core>=0.13.4