-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from KIT-MRT/github_action
Add GitHub actions to run unit tests and deploy releases. Closes #8 #major
- Loading branch information
Showing
6 changed files
with
147 additions
and
9 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,84 @@ | ||
name: Bump version and create release | ||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
branches: | ||
- main | ||
|
||
jobs: | ||
bump-version: | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
outputs: | ||
new_tag: ${{ steps.bump_version.outputs.new_tag }} | ||
steps: | ||
- name: Check out the repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Read version from file | ||
run: | | ||
# Read the version from the version file, only store the number (without the 'v') | ||
INITIAL_VERSION=$(source version && echo ${VERSION#v}) | ||
echo "Current version: $INITIAL_VERSION" | ||
echo "INITIAL_VERSION=${INITIAL_VERSION}" >> $GITHUB_ENV | ||
- name: Bump version and push tag | ||
id: bump_version | ||
uses: anothrNick/github-tag-action@v1 | ||
env: | ||
DEFAULT_BUMP: minor | ||
DRY_RUN: true | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
INITIAL_VERSION: ${{ env.INITIAL_VERSION }} | ||
WITH_V: true | ||
|
||
- name: Update version file with new version | ||
run: | | ||
echo "New version: ${{ steps.bump_version.outputs.new_tag }}" | ||
echo "VERSION=${{ steps.bump_version.outputs.new_tag }}" > version | ||
git config --local user.name "github-actions[bot]" | ||
git config --local user.email "github-actions[bot]@users.noreply.github.com" | ||
git add version | ||
git commit -m "chore: update version file to ${{ steps.bump_version.outputs.new_tag }}" | ||
git push | ||
- name: Push new tag | ||
run: | | ||
git tag ${{ steps.bump_version.outputs.new_tag }} | ||
git push origin ${{ steps.bump_version.outputs.new_tag }} | ||
create-release: | ||
needs: bump-version | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Check out the repository and pull the new tag | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ needs.bump-version.outputs.new_tag }} | ||
|
||
- name: Build release packages | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
push: false | ||
tags: | | ||
util_caching_release | ||
target: release | ||
|
||
- name: Copy release packages | ||
run: | | ||
mkdir -p /tmp/artifacts/ | ||
docker run --rm -v /tmp/artifacts:/tmp/artifacts util_caching_release cp -r /release /tmp/artifacts/ | ||
- name: Create Release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
artifacts: "/tmp/artifacts/release/*" | ||
tag: ${{ needs.bump-version.outputs.new_tag }} | ||
body: ${{ github.event.pull_request.body }} | ||
|
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,22 @@ | ||
name: Run unit tests | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
build-and-run-unit-tests: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Build core library unit test Docker image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
push: false | ||
tags: | | ||
ghcr.io/kit-mrt/util_caching_tests | ||
target: unit_test | ||
|
||
- name: Run library unit tests | ||
run: | | ||
docker run --rm ghcr.io/kit-mrt/util_caching_tests | ||
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
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