nosqlbench/.github/workflows/preview.yml

322 lines
10 KiB
YAML
Raw Normal View History

2023-01-23 22:02:40 -06:00
name: preview
2020-03-04 11:26:22 -06:00
2023-01-23 20:04:45 -06:00
# This workflow should run for any push which is a preview build.
2023-01-26 00:53:32 -06:00
# Preview builds are indicated with a tag that ends in -preview
2023-01-23 20:04:45 -06:00
# In order to effect this, you can do the following:
2023-01-26 00:53:32 -06:00
# scripts/tag-preview-build
# If you want to replace a build, you can use -f and then
# push the update to the tag like push -f origin <tag>,
# although this should never be done!
2023-01-23 20:04:45 -06:00
2020-03-04 11:26:22 -06:00
on:
push:
2023-01-23 21:18:53 -06:00
tags:
2023-01-23 21:43:50 -06:00
- "[0-9]+.[0-9]+.[0-9]+-preview"
2020-03-04 11:26:22 -06:00
jobs:
2023-01-23 22:02:40 -06:00
preview-build:
2023-01-30 19:22:39 -06:00
runs-on: ubuntu-20.04
2023-01-30 19:55:02 -06:00
outputs:
preview_version: ${{ steps.versions.outputs.PREVIEW_VERSION }}
docker_tags: ${{ steps.versions.outputs.DOCKER_TAGS }}
2020-03-04 11:26:22 -06:00
steps:
2020-08-10 05:59:25 -05:00
2020-12-07 14:34:01 -06:00
- name: checkout repo
uses: actions/checkout@v3
2020-12-07 14:34:01 -06:00
- name: setup java
uses: actions/setup-java@v3
2020-12-07 14:34:01 -06:00
with:
distribution: 'temurin'
2021-12-21 17:00:55 -06:00
java-version: '17'
2020-12-07 14:34:01 -06:00
java-package: jdk
architecture: x64
- name: set git username
run: git config --global user.email "${{ secrets.NBDROID_EMAIL }}"
- name: set git email
run: git config --global user.name "${{ secrets.NBDROID_NAME }}"
- name: free disk space
run: |
sudo swapoff -a
sudo rm -f /swapfile
sudo apt clean
docker rmi $(docker image ls -aq)
df -h
- name: Cache Maven packages
2023-01-25 21:54:54 -06:00
uses: actions/cache@v3.2.3
2020-12-07 14:34:01 -06:00
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: read versions
2023-01-30 19:55:02 -06:00
id: versions
2020-12-07 14:34:01 -06:00
run: |
set -x
PREVIEW_VERSION=$(scripts/get-preview-version.sh)
echo "PREVIEW_VERSION=${PREVIEW_VERSION}" >> $GITHUB_ENV
2023-01-30 19:55:02 -06:00
echo "PREVIEW_VERSION=${PREVIEW_VERSION}" >> $GITHUB_OUTPUT
echo "DOCKER_TAGS=nosqlbench/nosqlbench:${PREVIEW_VERSION},nosqlbench/nosqlbench:preview" >> $GITHUB_ENV
2023-01-30 19:55:02 -06:00
echo "DOCKER_TAGS=nosqlbench/nosqlbench:${PREVIEW_VERSION},nosqlbench/nosqlbench:preview" >> $GITHUB_OUTPUT
2023-01-23 15:14:27 -06:00
- name: build preview revision
2023-01-23 15:14:27 -06:00
run: |
mvn clean package -Drevision="${{ env.PREVIEW_VERSION }}"
2022-08-18 16:20:48 -05:00
2020-12-07 20:30:50 -06:00
- name: Setup docker buildx
2023-01-25 21:54:54 -06:00
uses: docker/setup-buildx-action@v2.2.1
2020-12-07 20:30:50 -06:00
- name: docker hub login
2023-01-25 21:54:54 -06:00
uses: docker/login-action@v2.1.0
2020-12-07 20:30:50 -06:00
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: docker test build
2023-01-25 21:54:54 -06:00
uses: docker/build-push-action@v3.3.0
2020-12-07 20:30:50 -06:00
with:
context: .
file: Dockerfile
pull: true
push: false
load: true
tags: ${{ env.DOCKER_TAGS }}
- name: sanity check docker image
run: |
docker run --rm nosqlbench/nosqlbench:${{ env.PREVIEW_VERSION }} --version
2020-12-07 20:30:50 -06:00
2020-12-07 14:34:01 -06:00
- name: bundle artifacts
run: |
pwd
ls -l
mkdir staging
2022-07-01 10:46:05 -05:00
cp nb5/target/nb5.jar nb5/target/nb5 staging
2020-12-07 14:34:01 -06:00
- name: upload artifacts
uses: actions/upload-artifact@v1
with:
name: binaries
path: staging
2023-01-23 17:57:32 -06:00
# - name: generate javadoc
# run: mvn javadoc:aggregate-jar
# continue-on-error: false
#
# - name: upload javadoc
# uses: actions/upload-artifact@v3
# with:
# name: javadoc
# path: target/nosqlbench-*-javadoc.jar
2022-08-18 16:20:48 -05:00
- name: prepare release summary
id: prepare_summary
run: |
#summary=$(scripts/release-notes.sh)
2023-01-25 20:19:54 -06:00
summary=$(cat PREVIEW_NOTES.md)
summary="${summary//'%'/'%25'}"
summary="${summary//$'\n'/'%0A'}"
summary="${summary//$'\r'/'%0D'}"
2023-01-23 17:57:32 -06:00
echo "release_summary=$summary" >> $GITHUB_STATE
2023-01-23 19:57:48 -06:00
- name: bump minor version
run: |
scripts/bump-minor-version
2020-12-07 20:30:50 -06:00
- name: docker push to hub
2020-12-07 14:34:01 -06:00
uses: docker/build-push-action@v2
with:
context: .
2022-09-29 13:10:35 -05:00
platforms: linux/amd64,linux/arm64
2020-12-07 14:34:01 -06:00
file: Dockerfile
pull: true
push: true
tags: ${{ env.DOCKER_TAGS }}
2023-01-26 00:26:56 -06:00
# https://github.com/softprops/action-gh-release
2023-01-25 21:54:54 -06:00
- name: create github release
uses: softprops/action-gh-release@v0.1.15
if: startsWith(github.ref, 'refs/tags/')
2020-12-07 14:34:01 -06:00
with:
# body: ${{ steps.prepare_summary.outputs.release_summary }}
2023-01-26 00:26:56 -06:00
# body_path: PREVIEW_NOTES.md
2023-01-25 21:54:54 -06:00
draft: false
prerelease: true
2023-01-26 00:26:56 -06:00
generate_release_notes: true
2023-01-26 00:53:32 -06:00
name: Preview ${{ env.PREVIEW_VERSION }}
2023-01-25 21:54:54 -06:00
fail_on_unmatched_files: true
tag_name: ${{ env.PREVIEW_VERSION }}
2023-01-25 21:54:54 -06:00
token: ${{ secrets.GITHUB_TOKEN }}
files: |
nb5/target/nb5
nb5/target/nb5.jar
2020-12-07 14:34:01 -06:00
2023-01-25 21:17:57 -06:00
# - name: create github release
# id: create_github_release
# uses: actions/create-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: ${{ env.PREVIEW_VERSION }}
# release_name: Release ${{ env.PREVIEW_VERSION }}
# draft: false
# prerelease: true
# body: ${{ steps.prepare_summary.outputs.release_summary }}
#
# - name: upload nb.jar to github release
# id: upload-nb-jar
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_github_release.outputs.upload_url }}
# asset_path: nb5/target/nb5.jar
# asset_name: nb5.jar
# asset_content_type: application/octet-stream
#
# - name: upload nb binary to github release
# id: upload-nb-binary
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_github_release.outputs.upload_url }}
# asset_path: nb5/target/nb5
# asset_name: nb5
# asset_content_type: application/octet-stream
2023-01-25 21:54:54 -06:00
2022-09-30 10:47:43 -05:00
- name: Archive Test Results
if: always()
uses: actions/upload-artifact@v3
with:
name: test-results
path: |
[a-zA-Z]**/logs/*
2023-01-30 18:47:09 -06:00
# This triggers a preview build by cascading the tag to the builddocs repo.
# The builddocs repo then pushes to preview or release depending on the tag.
2023-01-30 18:41:58 -06:00
preview-docs:
needs: preview-build
2023-01-30 19:22:39 -06:00
runs-on: ubuntu-20.04
2023-01-30 18:41:58 -06:00
steps:
2023-01-30 19:55:02 -06:00
- name: import env vars
run: |
echo "PREVIEW_VERSION=${{ needs.preview-build.outputs.preview_version }}" >> $GITHUB_ENV
echo "DOCKER_TAGS=${{ needs.preview-build.outputs.docker_tags }}" >> $GITHUB_ENV
2023-01-30 18:41:58 -06:00
- name: clone nosqlbench-build-docs
run: |
git clone https://${{secrets.NBDROID_NAME}}:${{secrets.NBDROID_TOKEN}}@github.com/nosqlbench/nosqlbench-build-docs.git nosqlbench-build-docs
cd nosqlbench-build-docs
echo "files listing"
find .
git remote set-url origin https://${{secrets.NBDROID_NAME}}:${{secrets.NBDROID_TOKEN}}@github.com/nosqlbench/nosqlbench-build-docs.git
git remote -v
- name: set CNAME
run: |
echo "builddocs.nosqlbench.io" > nosqlbench-build-docs/site/static/CNAME
- name: commit changes
run: |
cd nosqlbench-build-docs
git add exported_docs.zip
- name: tag-preview-build
run: |
cd nosqlbench-build-docs
2023-01-30 18:53:11 -06:00
git tag -f ${{ env.PREVIEW_VERSION }}
2023-01-30 18:41:58 -06:00
- name: push changes
env:
NBDROID_NAME: ${{ secrets.NBDROID_NAME }}
NBDROID_TOKEN: ${{ secrets.NBDROID_TOKEN }}
run: |
set -x
cd nosqlbench-build-docs
CHANGES=$(git status --porcelain 2>/dev/null| wc -l)
git push --tags
echo "push completed"
2023-01-23 17:57:32 -06:00
# javadocs:
# needs: release
# runs-on: ubuntu-20.04
# steps:
# - name: set git username
# run: git config --global user.email "${{ secrets.NBDROID_EMAIL }}"
# - name: set git email
# run: git config --global user.name "${{ secrets.NBDROID_NAME }}"
# - name: download javadocs
# uses: actions/download-artifact@v3
# with:
# name: javadoc
# - run: ls -la
# - name: unpackage javadoc
# run: unzip nosqlbench-*-javadoc.jar
# - run: ls -la
# - name: Push javadocs
# uses: ad-m/github-push-action@master
# with:
# repository: nosqlbench/nosqlbench-javadoc
# github_token: ${{ secrets.GITHUB_TOKEN }}
# branch: main
#
#
2021-12-09 14:24:21 -06:00
# docs:
# needs: release
2022-08-16 10:13:01 -05:00
# runs-on: ubuntu-20.04
2021-12-09 14:24:21 -06:00
# steps:
#
# - name: set git username
# run: git config --global user.email "${{ secrets.NBDROID_EMAIL }}"
#
# - name: set git email
# run: git config --global user.name "${{ secrets.NBDROID_NAME }}"
#
# - name: download guidebook
# uses: actions/download-artifact@v1
# with:
# name: guidebook
# path: guidebook
#
# - run: ls -la
#
# - name: clone nosqlbench-docs
# env:
# NBDROID_NAME: ${{ secrets.NBDROID_NAME }}
# NBDROID_TOKEN: ${{ secrets.NBDROID_TOKEN }}
# run: |
# git clone https://${{secrets.NBDROID_NAME}}:${{secrets.NBDROID_TOKEN}}@github.com/nosqlbench/nosqlbench-docs.git nosqlbench-docs
# cd nosqlbench-docs
# echo "files listing"
# find .
# git remote set-url origin https://${{secrets.NBDROID_NAME}}:${{secrets.NBDROID_TOKEN}}@github.com/nosqlbench/nosqlbench-docs.git
# git remote -v
#
# Disabling this because it will be replaced soon.
# - name: push changes
# env:
# NBDROID_NAME: ${{ secrets.NBDROID_NAME }}
# NBDROID_TOKEN: ${{ secrets.NBDROID_TOKEN }}
# run: |
# rsync -av --delete guidebook/guidebook/ nosqlbench-docs/docs/
# echo "docs.nosqlbench.io" > nosqlbench-docs/docs/CNAME
# cd nosqlbench-docs
# git add docs
# git add -u
# CHANGES=$(git status --porcelain 2>/dev/null| wc -l)
# echo "found $CHANGES to push for doc updates"
# if (( $CHANGES > 0 ))
# then
# git commit -m"docs update for $GITHUB_REF"
# git push
# fi
2020-05-05 20:53:24 -05:00