Skip to content

ci: add linting to release workflow #185

ci: add linting to release workflow

ci: add linting to release workflow #185

Workflow file for this run

---
name: Release S3GW
on:
push:
tags:
- "v*"
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v3
- name: Get changed files
id: changed
uses: tj-actions/changed-files@v40
- name: Run pre-commit Linters
uses: pre-commit/[email protected]
with:
extra_args: --files ${{ steps.changed.outputs.all_changed_files }}
# Build the build-environment container, using it's workflow
build-s3gw:
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Quay Login
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Build Unittests
run: |
docker build \
--build-arg CMAKE_BUILD_TYPE=Release \
--build-arg NPROC=16 \
--file Dockerfile \
--tag s3gw-unittests \
--target s3gw-unittests \
.
- name: Run Unittests
run: |
docker run --rm s3gw-unittests
- name: Build s3gw Container Image
run: |
docker build \
--build-arg CMAKE_BUILD_TYPE=Release \
--build-arg NPROC=16 \
--build-arg S3GW_VERSION=${{ github.ref_name }} \
--build-arg QUAY_EXPIRATION=Never \
--file Dockerfile \
--tag quay.io/s3gw/s3gw:latest \
--tag quay.io/s3gw/s3gw:${{ github.ref_name }} \
.
docker push quay.io/s3gw/s3gw:latest
docker push quay.io/s3gw/s3gw:${{ github.ref_name }}
pre-release-smoke-test:
runs-on: ubuntu-latest
needs:
- build-s3gw
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Install S3cmd
run: |
sudo apt-get update
sudo apt-get install -y s3cmd
- name: Run Smoke Tests
run: |
source ceph/qa/rgw/store/sfs/tests/helpers.sh
CONTAINER=$(docker run --rm -d \
-p 7480:7480 \
quay.io/s3gw/s3gw:${{ github.ref_name }})
wait_for_http_200 "127.0.0.1:7480"
ceph/qa/rgw/store/sfs/tests/sfs-smoke-test.sh 127.0.0.1:7480
docker kill "$CONTAINER"
pre-release-on-disk-format-test:
runs-on: ubuntu-latest
needs:
- build-s3gw
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: false
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y s3cmd curl jq
- name: Run On-Disk Format Test
run: |
set -x
NEW_VERSION=${{ github.ref_name }}
OLD_VERSION_RAW="$(curl -L \
-H 'Accept: application/vnd.github+json' \
-H 'X-GitHub-Api-Version: 2022-11-28' \
'https://api.github.com/repos/aquarist-labs/s3gw/releases/latest' \
| jq -r .name)"
OLD_VERSION="${OLD_VERSION_RAW//[^v0-9.]/}"
VERSION_AFTER_V=$(cut -d "v" -f2 <<< ${{ github.ref_name }})
VERSION_AFTER_RC=$(cut -d "-" -f1 <<< ${VERSION_AFTER_V})
ls -la $GITHUB_WORKSPACE/docs/release-notes
EXPECTED_RN_FILE="$GITHUB_WORKSPACE/docs/release-notes/s3gw-v${VERSION_AFTER_RC}.md"
if [ -f "$EXPECTED_RN_FILE" ]; then
export NEW_VERSION
export OLD_VERSION
tools/tests/on-disk-format-checker.sh || \
sed -n '/## Breaking Changes/,/## Known Issues/p' \
"${EXPECTED_RN_FILE}" | grep -i "format"
else
echo \
"Expected release-notes file: ${EXPECTED_RN_FILE} was not found"
exit 1
fi
# Build and push the ui container
build-s3gw-ui-container:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Quay Login
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Build and Push Container
uses: docker/build-push-action@v3
with:
push: true
tags: |
quay.io/s3gw/s3gw-ui:${{ github.ref_name }}
quay.io/s3gw/s3gw-ui:latest
file: ui/src/Dockerfile
context: ui/src
# Build and push the COSI sidecar and driver
build-s3gw-cosi-sidecar-and-driver:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Quay Login
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
- name: Build s3gw-cosi-sidecar
working-directory: cosi-sidecar
run: |
make build
- name: Build s3gw-cosi-driver
working-directory: cosi-driver
run: |
make build
- name: Build s3gw-cosi-sidecar Container
uses: docker/build-push-action@v3
with:
push: true
tags: |
quay.io/s3gw/s3gw-cosi-sidecar:${{ github.ref_name }}
quay.io/s3gw/s3gw-cosi-sidecar:latest
file: cosi-sidecar/Dockerfile
context: cosi-sidecar
- name: Build s3gw-cosi-driver Container
uses: docker/build-push-action@v3
with:
push: true
build-args: |
S3GW_VERSION=${{ github.ref_name }}
tags: |
quay.io/s3gw/s3gw-cosi-driver:${{ github.ref_name }}
quay.io/s3gw/s3gw-cosi-driver:latest
file: cosi-driver/Dockerfile
context: cosi-driver
draft-release:
runs-on: ubuntu-latest
needs:
- pre-release-smoke-test
- pre-release-on-disk-format-test
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Release
uses: softprops/action-gh-release@v1
with:
draft: true
body_path: docs/release-notes/latest
generate_release_notes: true
fail_on_unmatched_files: true
files: |
LICENSE
# Release the charts
# TODO