File tree Expand file tree Collapse file tree 9 files changed +99
-7
lines changed Expand file tree Collapse file tree 9 files changed +99
-7
lines changed Original file line number Diff line number Diff line change 1+ name : Publish Build
2+
3+ on :
4+ release :
5+ types : [published]
6+ push :
7+ # support traditional versions, and dev versions
8+ tags : ["*.*.*","*.*.*-*"]
9+
10+ jobs :
11+
12+ publish :
13+
14+ runs-on : ubuntu-latest
15+
16+ steps :
17+ - uses : actions/checkout@v3
18+ - name : Build the Docker image
19+ run : |
20+ export DOCKER_IMAGE=mtconnect-python:$(date +%s)
21+ echo "DOCKER_IMAGE=${DOCKER_IMAGE}" >> $GITHUB_ENV
22+ docker build . --file Dockerfile --tag ${DOCKER_IMAGE}
23+ - name : Bump Version
24+ run : |
25+ ./scripts/run_container.sh ${DOCKER_IMAGE} scripts/set_version.sh "${GITHUB_REF_NAME}"
26+ echo "VERSION_CHANGE=$(git diff --exit-code)" >> $GITHUB_ENV
27+ - name : Commit Change
28+ if : ${{ vars.VERSION_CHANGE == '1' }}
29+ run : |
30+ git add .
31+ git commit -m 'Bump Version'
32+ git tag -d ${GITHUB_REF_NAME}
33+ git tag ${GITHUB_REF_NAME}
34+ git push --force origin ${GITHUB_REF_NAME}
Original file line number Diff line number Diff line change 1+ name : Validate Build
2+
3+ on :
4+ push :
5+ branches : [ "main" ]
6+ pull_request :
7+ branches : [ "main" ]
8+
9+ jobs :
10+
11+ validate :
12+
13+ runs-on : ubuntu-latest
14+
15+ steps :
16+ - uses : actions/checkout@v3
17+ - name : Build the Docker image
18+ run : |
19+ export DOCKER_IMAGE=mtconnect-python:$(date +%s)
20+ echo "DOCKER_IMAGE=${DOCKER_IMAGE}" >> $GITHUB_ENV
21+ docker build . --file Dockerfile --tag ${DOCKER_IMAGE}
22+ - name : Test Format
23+ run : ./scripts/run_container.sh ${DOCKER_IMAGE} scripts/format_package.sh --check
24+ - name : Test Package
25+ run : ./scripts/run_container.sh ${DOCKER_IMAGE} scripts/test_package.sh
Original file line number Diff line number Diff line change @@ -2,8 +2,10 @@ FROM python:3.8-slim as base
22
33WORKDIR /data
44
5- # Install poetry
6- RUN pip3 install poetry
5+ # Install deps
6+ RUN pip3 install poetry && \
7+ apt update && \
8+ apt install git -y
79
810# Copy depdencies and install base packages
911COPY pyproject.toml poetry.lock ./
Original file line number Diff line number Diff line change 66develop : build
77 ./scripts/run_develop_container.sh ${IMAGE_NAME} bash
88
9+ run : build
10+ ./scripts/run_container.sh ${IMAGE_NAME} bash
11+
912test : build
1013 ./scripts/run_develop_container.sh ${IMAGE_NAME} scripts/test_package.sh
1114
15+ test.format : build
16+ ./scripts/run_develop_container.sh ${IMAGE_NAME} scripts/format_package.sh --check
17+
18+
1219format : build
1320 ./scripts/run_develop_container.sh ${IMAGE_NAME} scripts/format_package.sh
1421
22+
1523lint : build
16- ./scripts/run_develop_container.sh ${IMAGE_NAME} scripts/lint_package.sh
24+ ./scripts/run_develop_container.sh ${IMAGE_NAME} scripts/lint_package.sh
1725
1826PYPI_USER? =${PYPI_USER}
1927PYPI_PASSWORD? =${PYPI_PASSWORD}
2028publish : build
21- ./scripts/run_develop_container.sh ${IMAGE_NAME} scripts/publish_package.sh
29+ ./scripts/run_develop_container.sh ${IMAGE_NAME} scripts/publish_package.sh
30+
31+ # This is only here for completeness. This should only be called via CI
32+ VERSION? =${VERSION}
33+ version : build
34+ ./scripts/run_develop_container.sh ${IMAGE_NAME} scripts/set_version.sh ${VERSION}
Original file line number Diff line number Diff line change 11#! /bin/bash
22
3- python3 -m black .
3+ python3 -m black . " $@ "
Original file line number Diff line number Diff line change 11#! /bin/bash
22
3- python3 -m pylint mtconnect tests
3+ python3 -m pylint mtconnect tests " $@ "
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ if [ " $# " -lt 2 ]; then
4+ echo " Please supply image name and command to run"
5+ exit 1
6+ fi
7+
8+ image_name=$1
9+
10+ docker run --name run-ctr --rm ${image_name} " ${@: 2} "
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ if [ " $# " -ne 1 ]; then
4+ echo " Please supply version"
5+ exit 1
6+ fi
7+
8+ poetry version " $@ "
Original file line number Diff line number Diff line change 11#! /bin/bash
22
3- python3 -m unittest
3+ python3 -m unittest " $@ "
You can’t perform that action at this time.
0 commit comments