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}"
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}
33
+ git tag ${GITHUB_REF}
34
+ git push --force origin ${GITHUB_REF}
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
2
2
3
3
WORKDIR /data
4
4
5
- # Install poetry
6
- RUN pip3 install poetry
5
+ # Install deps
6
+ RUN pip3 install poetry && \
7
+ apt update && \
8
+ apt install git -y
7
9
8
10
# Copy depdencies and install base packages
9
11
COPY pyproject.toml poetry.lock ./
Original file line number Diff line number Diff line change 6
6
develop : build
7
7
./scripts/run_develop_container.sh ${IMAGE_NAME} bash
8
8
9
+ run : build
10
+ ./scripts/run_container.sh ${IMAGE_NAME} bash
11
+
9
12
test : build
10
13
./scripts/run_develop_container.sh ${IMAGE_NAME} scripts/test_package.sh
11
14
15
+ test.format : build
16
+ ./scripts/run_develop_container.sh ${IMAGE_NAME} scripts/format_package.sh --check
17
+
18
+
12
19
format : build
13
20
./scripts/run_develop_container.sh ${IMAGE_NAME} scripts/format_package.sh
14
21
22
+
15
23
lint : 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
17
25
18
26
PYPI_USER? =${PYPI_USER}
19
27
PYPI_PASSWORD? =${PYPI_PASSWORD}
20
28
publish : 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 1
1
#! /bin/bash
2
2
3
- python3 -m black .
3
+ python3 -m black . " $@ "
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
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 1
1
#! /bin/bash
2
2
3
- python3 -m unittest
3
+ python3 -m unittest " $@ "
You can’t perform that action at this time.
0 commit comments