-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
129 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
on: | ||
release: | ||
type: [ created ] | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: version | ||
run: | | ||
# Tagged release | ||
if [[ ${{ github.ref }} == refs/tags/* ]]; then | ||
# Strip git ref prefix from $VERSION | ||
TAGNAME=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | ||
# Strip "v" prefix from tag name | ||
VERSION=$(echo $TAGNAME | sed -e 's/^v//') | ||
else | ||
VERSION=${{ github.sha }} | ||
fi | ||
echo "::set-env name=VERSION::$VERSION" | ||
echo "Version: $VERSION" | ||
export DOCKER_BUILDKIT=1 | ||
- name: lint | ||
run: | | ||
docker-compose -f docker-compose.lint.yml up | ||
docker-compose -f docker-compose.lint.yml down | ||
- name: test | ||
run: | | ||
docker-compose -f docker-compose.test.yml up | ||
docker-compose -f docker-compose.test.yml down | ||
- name: image | ||
run: | | ||
VERSION="${{ env.VERSION }}" | ||
TARGETS="lint test" | ||
echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin | ||
for TARGET in $TARGETS | ||
do | ||
docker build -f dockerfile . --target $TARGET -t $TARGET | ||
IMAGE=$(docker inspect --format '{{ .Config.Env }}' $TARGET | tr -d '[]' | tr ' ' '\n' | grep IMAGE | sed 's/^.*=//') | ||
echo "Image: $IMAGE" | ||
PUSH="docker.pkg.github.com/${{ github.repository }}/$IMAGE:$VERSION" | ||
echo "Push: $PUSH" | ||
docker tag $TARGET $PUSH | ||
docker push $PUSH | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version: "3.7" | ||
services: | ||
|
||
test: | ||
image: lint | ||
build: | ||
context: . | ||
dockerfile: dockerfile | ||
target: lint | ||
volumes: | ||
- ./local:/local:ro | ||
- ./model:/model:ro | ||
- ./secrets:/secrets:ro |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version: "3.7" | ||
services: | ||
|
||
test: | ||
image: test | ||
build: | ||
context: . | ||
dockerfile: dockerfile | ||
target: test | ||
volumes: | ||
- ./local:/local:ro | ||
- ./model:/model:ro | ||
- ./secrets:/secrets:ro |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
ARG IFLAGS="--quiet --no-cache-dir --user" | ||
|
||
FROM python:3.7.7-slim-buster as build | ||
ARG IFLAGS | ||
WORKDIR /root | ||
ENV FREETDS /root/freetds.conf | ||
ENV PATH /root/.local/bin:$PATH | ||
ENV TINI_VERSION v0.16.1 | ||
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /usr/bin/tini | ||
COPY CHANGELOG.rst . | ||
COPY README.rst . | ||
COPY freetds.conf . | ||
COPY setup.cfg . | ||
COPY setup.py . | ||
COPY pyproject.toml . | ||
COPY .pre-commit-config.yaml . | ||
COPY .pylintrc . | ||
COPY .git ./.git | ||
COPY src ./src | ||
COPY test ./test | ||
RUN \ | ||
chmod +x /usr/bin/tini && \ | ||
apt-get update --fix-missing && \ | ||
apt-get install -y --no-install-recommends git && \ | ||
pip install ${IFLAGS} "." && \ | ||
apt-get clean && \ | ||
apt-get autoremove -y --purge && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
FROM build as lint | ||
ARG IFLAGS | ||
WORKDIR /root | ||
ENV IMAGE dsdk.lint | ||
RUN \ | ||
pip install ${IFLAGS} ".[all]" | ||
ENTRYPOINT [ "/usr/bin/tini", "--" ] | ||
CMD [ "pre-commit", "run", "--all-files" ] | ||
|
||
FROM lint as test | ||
WORKDIR /root | ||
ENV IMAGE dsdk.test | ||
ENTRYPOINT [ "/usr/bin/tini", "--" ] | ||
CMD [ "python", "setup.py", "test" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[global] | ||
client charset = UTF-8 | ||
tds version = 7.4 | ||
use ntlmv2 = yes |