-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: [#56] Use binary instead of downloading pip packages
- Loading branch information
Showing
5 changed files
with
58 additions
and
30 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 |
---|---|---|
@@ -1,17 +1,19 @@ | ||
name: python | ||
--- | ||
name: Python | ||
'on': push | ||
permissions: | ||
contents: write | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
MCVS-python-action: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/[email protected] | ||
- uses: actions/[email protected] | ||
# | ||
# | ||
# | ||
# | ||
# | ||
- uses: actions/[email protected] | ||
- uses: 030/mcvs-python-action@1-2-install-python-run-pytest | ||
with: | ||
python-version: 3.9.18 | ||
cache: 'pip' | ||
- name: Install PIP packages defined in requirements.txt | ||
run: | | ||
pip install -r requirements.txt | ||
- name: Run tests | ||
run: | | ||
pytest --cov=main test.py --verbose --capture=no --cov-report term-missing | ||
pyinstaller-binary-name: gomod-go-version-updater | ||
token: ${{ secrets.GITHUB_TOKEN }} |
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 @@ | ||
3.9.18 |
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
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 |
---|---|---|
|
@@ -8,6 +8,10 @@ inputs: | |
gomod-go-version-updater-action-log-level: | ||
description: | | ||
Change the default INFO log level to: DEBUG, WARNING, ERROR or CRITICAL. | ||
gomod-go-version-updater-version: | ||
description: | | ||
The gomod-go-version-updater version. | ||
required: true | ||
workflow_file: | ||
default: golang.yml | ||
description: | | ||
|
@@ -22,18 +26,12 @@ runs: | |
- uses: actions/[email protected] | ||
with: | ||
ref: main | ||
# yamllint disable rule:line-length | ||
- name: set branch name | ||
run: | | ||
echo "GOMOD_GO_VERSION_UPDATER_LABEL=gomod-go-version-updater" >> $GITHUB_ENV | ||
echo "GOMOD_GO_VERSION_UPDATER_ACTION_BRANCH=update-go-version-in-go-mod-file" >> $GITHUB_ENV | ||
shell: bash | ||
- uses: actions/[email protected] | ||
with: | ||
python-version: 3.9.18 | ||
- name: Install dependencies | ||
run: | | ||
pip install pytest pytest-cov requests | ||
shell: bash | ||
- name: Create label | ||
run: | | ||
gh label create ${GOMOD_GO_VERSION_UPDATER_LABEL} --color "#F50BAB" --description "Pull requests that update Go version in the go.mod file" --force | ||
|
@@ -45,14 +43,16 @@ runs: | |
git fetch -p -P | ||
git checkout -b ${GOMOD_GO_VERSION_UPDATER_ACTION_BRANCH} | ||
python --version | ||
python3 --version | ||
export GOMOD_GO_VERSION_UPDATER_FILE=${GOMOD_GO_VERSION_UPDATER_LABEL} | ||
curl -L https://github.com/030/gomod-go-version-updater-action/releases/download/${{ inputs.gomod-go-version-updater-version }}/${GOMOD_GO_VERSION_UPDATER_FILE} \ | ||
-o ${GOMOD_GO_VERSION_UPDATER_FILE} | ||
chmod +x ${GOMOD_GO_VERSION_UPDATER_FILE} | ||
if [ -n "${{ inputs.gomod-go-version-updater-action-log-level }}" ]; then | ||
export GOMOD_GO_VERSION_UPDATER_ACTION_LOGGING_LEVEL=${{ inputs.gomod-go-version-updater-action-log-level }} | ||
echo "GOMOD_GO_VERSION_UPDATER_ACTION_LOGGING_LEVEL: ${GOMOD_GO_VERSION_UPDATER_ACTION_LOGGING_LEVEL}" | ||
fi | ||
export GOMOD_GO_VERSION_UPDATER_ACTION_OUTPUT=$(python ${{ github.action_path }}/main.py 2>&1) | ||
export GOMOD_GO_VERSION_UPDATER_ACTION_OUTPUT=$(./${GOMOD_GO_VERSION_UPDATER_FILE} 2>&1) | ||
echo "GOMOD_GO_VERSION_UPDATER_ACTION_OUTPUT: ${GOMOD_GO_VERSION_UPDATER_ACTION_OUTPUT}" | ||
export GOMOD_GO_VERSION_UPDATER_ACTION_NEW_GOLANG_VERSION_OUTPUT=$(echo ${GOMOD_GO_VERSION_UPDATER_ACTION_OUTPUT} |\ | ||
|
@@ -63,17 +63,25 @@ runs: | |
export GOMOD_GO_VERSION_UPDATER_ACTION_MESSAGE="build(deps): ${GOMOD_GO_VERSION_UPDATER_ACTION_NEW_GOLANG_VERSION_OUTPUT}" | ||
echo "GOMOD_GO_VERSION_UPDATER_ACTION_MESSAGE: ${GOMOD_GO_VERSION_UPDATER_ACTION_MESSAGE}" | ||
if [ -n "$(git status --porcelain)" ]; then echo "There are uncommitted changes."; else echo "No changes to commit." && exit 0; fi | ||
if [ -n "$(git status --porcelain)" ]; then | ||
echo "There are uncommitted changes." | ||
else | ||
echo "No changes to commit." | ||
exit 0 | ||
fi | ||
echo "git add..." | ||
git add go.mod | ||
echo "git config user..." | ||
git config user.name github-actions[bot] | ||
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | ||
git config user.email \ | ||
41898282+github-actions[bot]@users.noreply.github.com | ||
echo "git commit..." | ||
if ! git commit -m "${GOMOD_GO_VERSION_UPDATER_ACTION_MESSAGE}"; then git commit --amend --no-edit; fi | ||
if ! git commit -m "${GOMOD_GO_VERSION_UPDATER_ACTION_MESSAGE}"; then | ||
git commit --amend --no-edit | ||
fi | ||
echo "git push..." | ||
git push origin ${GOMOD_GO_VERSION_UPDATER_ACTION_BRANCH} -f | ||
|
@@ -98,23 +106,32 @@ runs: | |
shell: bash | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
# yamllint enable rule:line-length | ||
- uses: actions/[email protected] | ||
with: | ||
go-version-file: 'go.mod' | ||
cache: false | ||
# yamllint disable rule:line-length | ||
- run: | | ||
git config --global url.https://${{ inputs.github-token-for-downloading-private-go-modules }}@github.com/.insteadOf https://github.com/ | ||
git config \ | ||
--global url.https://${{ inputs.github-token-for-downloading-private-go-modules }}@github.com/.insteadOf https://github.com/ | ||
shell: bash | ||
if: ${{ inputs.github-token-for-downloading-private-go-modules != '' }} | ||
# yamllint enable rule:line-length | ||
- name: go mod tidy | ||
run: | | ||
go mod tidy | ||
shell: bash | ||
- name: commit and force push if needed | ||
run: | | ||
if [ -n "$(git status --porcelain)" ]; then echo "There are uncommitted changes."; else echo "No changes to commit." && exit 0; fi | ||
if [ -n "$(git status --porcelain)" ]; then | ||
echo "There are uncommitted changes." | ||
else | ||
echo "No changes to commit." | ||
exit 0 | ||
fi | ||
git add . | ||
git add . -- ":!${GOMOD_GO_VERSION_UPDATER_LABEL}" | ||
git commit --amend --no-edit | ||
git push origin ${GOMOD_GO_VERSION_UPDATER_ACTION_BRANCH} -f | ||
shell: bash | ||
|
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
coverage==7.6.3 | ||
pytest-cov==5.0.0 | ||
requests==2.32.3 | ||
requests==2.32.3 |