(patch) Add automated builds to the project (#1)
Some checks failed
/ Build and Release Library (push) Failing after 54s
Some checks failed
/ Build and Release Library (push) Failing after 54s
Reviewed-on: #1
This commit is contained in:
parent
521365cb13
commit
768afc80c9
3 changed files with 153 additions and 1 deletions
68
.forgejo/workflows/pull_request.yaml
Normal file
68
.forgejo/workflows/pull_request.yaml
Normal file
|
@ -0,0 +1,68 @@
|
|||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
jobs:
|
||||
library_snapshot:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: registry.garrity.co:8443/gs/ci-scala:latest
|
||||
name: 'Build and Test Library Snapshot'
|
||||
env:
|
||||
GS_MAVEN_USER: ${{ vars.GS_MAVEN_USER }}
|
||||
GS_MAVEN_TOKEN: ${{ secrets.GS_MAVEN_TOKEN }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
name: 'Checkout Repository'
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: 'Pre-Commit'
|
||||
run: |
|
||||
pre-commit install
|
||||
pre-commit run --all-files
|
||||
- name: 'Prepare Versioned Build'
|
||||
run: |
|
||||
latest_git_tag="$(git describe --tags --abbrev=0 || echo 'No Tags')"
|
||||
latest_commit_message="$(git show -s --format=%s HEAD)"
|
||||
if [[ "$latest_commit_message" == *"(major)"* ]]; then
|
||||
export GS_RELEASE_TYPE="major"
|
||||
elif [[ "$latest_commit_message" == *"(minor)"* ]]; then
|
||||
export GS_RELEASE_TYPE="minor"
|
||||
elif [[ "$latest_commit_message" == *"(patch)"* ]]; then
|
||||
export GS_RELEASE_TYPE="patch"
|
||||
elif [[ "$latest_commit_message" == *"(docs)"* ]]; then
|
||||
export GS_RELEASE_TYPE="norelease"
|
||||
elif [[ "$latest_commit_message" == *"(norelease)"* ]]; then
|
||||
export GS_RELEASE_TYPE="norelease"
|
||||
else
|
||||
export GS_RELEASE_TYPE="norelease"
|
||||
fi
|
||||
echo "GS_RELEASE_TYPE=$GS_RELEASE_TYPE" >> $GITHUB_ENV
|
||||
echo "Previous Git Tag: $latest_git_tag"
|
||||
echo "Latest Commit: $latest_commit_message ($GS_RELEASE_TYPE) (SNAPSHOT)"
|
||||
if [ "$GS_RELEASE_TYPE" = "norelease" ]; then
|
||||
sbtn -Dsnapshot=true -Drelease="patch" semVerInfo
|
||||
else
|
||||
sbtn -Dsnapshot=true -Drelease="$GS_RELEASE_TYPE" semVerInfo
|
||||
fi
|
||||
- name: 'Unit Tests and Code Coverage'
|
||||
run: |
|
||||
sbtn clean
|
||||
sbtn coverage
|
||||
sbtn test
|
||||
sbtn coverageReport
|
||||
- name: 'Publish Snapshot'
|
||||
run: |
|
||||
echo "Testing env var propagation = ${{ env.GS_RELEASE_TYPE }}"
|
||||
if [ "${{ env.GS_RELEASE_TYPE }}" = "norelease" ]; then
|
||||
echo "Skipping publish due to GS_RELEASE_TYPE=norelease"
|
||||
else
|
||||
sbtn coverageOff
|
||||
sbtn clean
|
||||
sbtn compile
|
||||
sbtn publish
|
||||
fi
|
84
.forgejo/workflows/release.yaml
Normal file
84
.forgejo/workflows/release.yaml
Normal file
|
@ -0,0 +1,84 @@
|
|||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
jobs:
|
||||
library_release:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: registry.garrity.co:8443/gs/ci-scala:latest
|
||||
name: 'Build and Release Library'
|
||||
env:
|
||||
GS_MAVEN_USER: ${{ vars.GS_MAVEN_USER }}
|
||||
GS_MAVEN_TOKEN: ${{ secrets.GS_MAVEN_TOKEN }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
name: 'Checkout Repository'
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: 'Pre-Commit'
|
||||
run: |
|
||||
pre-commit install
|
||||
pre-commit run --all-files
|
||||
- name: 'Prepare Versioned Build'
|
||||
run: |
|
||||
latest_git_tag="$(git describe --tags --abbrev=0 || echo 'No Tags')"
|
||||
latest_commit_message="$(git show -s --format=%s HEAD)"
|
||||
if [[ "$latest_commit_message" == *"(major)"* ]]; then
|
||||
export GS_RELEASE_TYPE="major"
|
||||
elif [[ "$latest_commit_message" == *"(minor)"* ]]; then
|
||||
export GS_RELEASE_TYPE="minor"
|
||||
elif [[ "$latest_commit_message" == *"(patch)"* ]]; then
|
||||
export GS_RELEASE_TYPE="patch"
|
||||
elif [[ "$latest_commit_message" == *"(docs)"* ]]; then
|
||||
export GS_RELEASE_TYPE="norelease"
|
||||
elif [[ "$latest_commit_message" == *"(norelease)"* ]]; then
|
||||
export GS_RELEASE_TYPE="norelease"
|
||||
else
|
||||
export GS_RELEASE_TYPE="norelease"
|
||||
fi
|
||||
|
||||
echo "GS_RELEASE_TYPE=$GS_RELEASE_TYPE" >> $GITHUB_ENV
|
||||
echo "Previous Git Tag: $latest_git_tag"
|
||||
echo "Latest Commit: $latest_commit_message"
|
||||
echo "Selected Release Type: '$GS_RELEASE_TYPE'"
|
||||
|
||||
if [ "$GS_RELEASE_TYPE" = "norelease" ]; then
|
||||
echo "Skipping all versioning for 'norelease' commit."
|
||||
else
|
||||
sbtn -Drelease="$GS_RELEASE_TYPE" semVerInfo
|
||||
fi
|
||||
- name: 'Unit Tests and Code Coverage'
|
||||
run: |
|
||||
if [ "${{ env.GS_RELEASE_TYPE }}" = "norelease" ]; then
|
||||
echo "Skipping build/test for 'norelease' commit."
|
||||
else
|
||||
sbtn clean
|
||||
sbtn coverage
|
||||
sbtn test
|
||||
sbtn coverageReport
|
||||
fi
|
||||
- name: 'Publish Release'
|
||||
run: |
|
||||
if [ "${{ env.GS_RELEASE_TYPE }}" = "norelease" ]; then
|
||||
echo "Skipping publish for 'norelease' commit."
|
||||
else
|
||||
sbtn coverageOff
|
||||
sbtn clean
|
||||
sbtn semVerWriteVersionToFile
|
||||
sbtn publish
|
||||
fi
|
||||
- name: 'Create Git Tag'
|
||||
run: |
|
||||
if [ "${{ env.GS_RELEASE_TYPE }}" = "norelease" ]; then
|
||||
echo "Skipping Git tag for 'norelease' commit."
|
||||
else
|
||||
selected_version="$(cat .version)"
|
||||
git tag "$selected_version"
|
||||
git push origin "$selected_version"
|
||||
fi
|
|
@ -18,7 +18,7 @@ generator definitions that can be reused across tests.
|
|||
```
|
||||
object Gs {
|
||||
val Datagen: ModuleID =
|
||||
"gs" %% "gs-datagen-core-v0" % "$VERSION" % Test
|
||||
"gs" %% "gs-datagen-core-v0" % "$VERSION"
|
||||
}
|
||||
```
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue