diff --git a/.github/workflows/create-prerelease.yml b/.github/workflows/create-prerelease.yml index a488b4a..1b571c7 100644 --- a/.github/workflows/create-prerelease.yml +++ b/.github/workflows/create-prerelease.yml @@ -3,18 +3,23 @@ name: Build and Create Pre-Release on: workflow_dispatch: inputs: - addCommit: - description: 'Dev build?' + version: + description: 'If this is a release what version is this for? If this is a pre-release what version are you developing toward?' + required: true + type: string + preRelease: + description: 'Create Pre-release? -SNAPSHOT-{COMMIT} will be appended to the version above.' required: false type: boolean deletePrevBuild: - description: 'Delete existing pre-releases?' + description: 'Cleanup existing pre-releases?' required: false type: boolean - push: - branches: - - "VEC-210-acl" # remove before merge into main + + # push: + # branches: + # - "actions-hub" # remove before merge into main jobs: build-and-release: runs-on: macos-13 @@ -45,9 +50,35 @@ jobs: hdiutil attach -mountpoint /Volumes/Packages Packages.dmg cd /Volumes/Packages sudo installer -pkg Install\ Packages.pkg -target / + - name: Tag Before Building + if: inputs.version != '' + env: + TAG: ${{ inputs.version }} + SNAPSHOT: ${{ inputs.preRelease }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + echo "Tagging the repository with ${TAG}" + git config --global user.email "actions@github.com" + git config --global user.name "GitHub Actions" + + if [ "${SNAPSHOT}" = "true" ]; then + COMMIT=$(git rev-parse --short HEAD) + TAG="${TAG}-SNAPSHOT-${COMMIT}" + fi + + # Ensure the tag does not already exist + if ! gh release view "${TAG}" > /dev/null 2>&1; then + git tag -a "${TAG}" -m "Release ${TAG}" + git push origin "${TAG}" + + echo "Tag ${TAG} created and pushed successfully." + else + echo "Tag ${TAG} already exists." + fi + - name: "Compile" env: - ADDCOMMIT: ${{ inputs.addCommit }} + ADDCOMMIT: ${{ inputs.preRelease }} run: | buildcmd="build-prerelease" [ "${ADDCOMMIT}" = "false" ] && buildcmd="build-official" @@ -55,7 +86,7 @@ jobs: cd ~/work/asvec/asvec && make cleanall && make ${buildcmd} - name: "Create linux packages" env: - ADDCOMMIT: ${{ inputs.addCommit }} + ADDCOMMIT: ${{ inputs.preRelease }} run: | buildcmd="build-prerelease" [ "${ADDCOMMIT}" = "false" ] && buildcmd="build-official" @@ -63,7 +94,7 @@ jobs: cd ~/work/asvec/asvec && make pkg-linux - name: "Create windows zips" env: - ADDCOMMIT: ${{ inputs.addCommit }} + ADDCOMMIT: ${{ inputs.preRelease }} run: | buildcmd="build-prerelease" [ "${ADDCOMMIT}" = "false" ] && buildcmd="build-official" @@ -106,21 +137,17 @@ jobs: - name: "Create a new pre-release" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ADDCOMMIT: ${{ inputs.addCommit }} run: | set -e - echo "${ADDCOMMIT}" cd ~/work/asvec/asvec/bin/packages - COMMIT=$(git rev-parse --short HEAD) VER=$(cat ../../VERSION.md) RPM_VER=$(echo ${VER} | sed 's/-/_/g') - BRANCH=$(git rev-parse --abbrev-ref HEAD) - TAG=${VER}-${COMMIT} - [ "${ADDCOMMIT}" = "false" ] && TAG=${VER} + TAG=${VER} FULLCOMMIT=$(git rev-parse HEAD) - gh release create -R github.com/aerospike/asvec --notes-file ../../RELEASE.md --prerelease --target ${FULLCOMMIT} --title "Asvec - v${TAG}" ${TAG} asvec-linux-amd64-${VER}.deb asvec-linux-amd64-${RPM_VER}.rpm asvec-linux-amd64-${VER}.zip asvec-linux-arm64-${VER}.deb asvec-linux-arm64-${RPM_VER}.rpm asvec-linux-arm64-${VER}.zip asvec-macos-${VER}.pkg asvec-macos-amd64-${VER}.zip asvec-macos-arm64-${VER}.zip asvec-windows-amd64-${VER}.zip asvec-windows-arm64-${VER}.zip + gh release create -R github.com/aerospike/asvec --notes-file ../../RELEASE.md --prerelease --target ${FULLCOMMIT} --title "Asvec - ${TAG}" ${TAG} asvec-linux-amd64-${VER}.deb asvec-linux-amd64-${RPM_VER}.rpm asvec-linux-amd64-${VER}.zip asvec-linux-arm64-${VER}.deb asvec-linux-arm64-${RPM_VER}.rpm asvec-linux-arm64-${VER}.zip asvec-macos-${VER}.pkg asvec-macos-amd64-${VER}.zip asvec-macos-arm64-${VER}.zip asvec-windows-amd64-${VER}.zip asvec-windows-arm64-${VER}.zip - name: "Delete previous pre-release" env: + TAG: ${{ inputs.version }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} DELPREV: ${{ inputs.deletePrevBuild }} run: | @@ -131,7 +158,7 @@ jobs: do if [ "$line" != "${TAG}" ] then - if [[ $line =~ ^${VER}- ]] + if [[ $line =~ ^${TAG}- ]] then echo "Removing $line" gh release delete $line -R github.com/aerospike/asvec --yes --cleanup-tag diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 32df685..fb638ad 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,7 +7,7 @@ on: jobs: tests: - runs-on: ubuntu-latest + runs-on: aerospike_large_runners_8 steps: - uses: actions/checkout@v3 - name: Get go version from go.mod @@ -28,6 +28,10 @@ jobs: - name: Login to Aerospike Jfrog run: | docker login aerospike.jfrog.io --username ${{ secrets.JFROG_USERNAME }} --password ${{ secrets.JFROG_ACCESS_TOKEN }} + # - name: Clear Docker Cache + # run: | + # docker system prune --all --force + - name: Run tests run: | make coverage diff --git a/.gitignore b/.gitignore index f7114ee..5498fc5 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ features.conf embed_*.go tmp /vendor -/coverage \ No newline at end of file +/coverage +VERSION.md \ No newline at end of file diff --git a/VERSION.md b/VERSION.md deleted file mode 100644 index 6c6aa7c..0000000 --- a/VERSION.md +++ /dev/null @@ -1 +0,0 @@ -0.1.0 \ No newline at end of file diff --git a/e2e_test.go b/e2e_test.go index 67acc3f..c38089f 100644 --- a/e2e_test.go +++ b/e2e_test.go @@ -1031,7 +1031,7 @@ func docker_compose_up(composeFile string) error { ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) defer cancel() - cmd := exec.CommandContext(ctx, "docker", "compose", fmt.Sprintf("-f%s", composeFile), "up", "-d") + cmd := exec.CommandContext(ctx, "docker", "-lDEBUG", "compose", fmt.Sprintf("-f%s", composeFile), "up", "-d") output, err := cmd.CombinedOutput() fmt.Printf("docker compose up output: %s\n", string(output))