This repository has been archived by the owner on May 10, 2024. It is now read-only.
Update README.md #156
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
name: Test and release | |
on: | |
push: | |
jobs: | |
test-and-build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.18 | |
- name: Setup GenGo | |
run: go install k8s.io/code-generator/cmd/deepcopy-gen@latest | |
- name: Set up Helm | |
uses: azure/setup-helm@v1 | |
with: | |
version: v3.8.1 | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Build | |
run: "make build" # todo: change to make build? | |
- name: Check Helm Chart | |
run: "make helm" | |
- name: Test | |
run: "make coverage" | |
- name: SonarCloud Scan | |
uses: sonarsource/sonarcloud-github-action@master | |
if: github.ref == 'refs/heads/main' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: binary | |
path: .build/volume-syncing-controller | |
test-e2e: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.18 | |
- name: Set up Helm | |
uses: azure/setup-helm@v1 | |
with: | |
version: v3.8.1 | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup rclone | |
run: "docker build . -f github-actions.rclone.Dockerfile -t rclone:current > /dev/null; docker create --name rclone rclone:current > /dev/null; sudo docker cp rclone:/usr/local/bin/rclone /usr/bin/rclone" | |
- name: Download k3d binary | |
run: "sudo wget https://github.com/k3d-io/k3d/releases/download/v5.4.3/k3d-linux-amd64 -O /usr/bin/k3d; sudo chmod +x /usr/bin/k3d" | |
- name: Run E2E tests | |
run: "make setup_e2e test_k8s minio test" | |
release-binary: | |
runs-on: ubuntu-20.04 | |
needs: ["test-and-build", "test-e2e"] | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: binary | |
path: .build/ | |
- name: Release binaries to GitHub releases | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
.build/volume-syncing-controller | |
release-docker: | |
runs-on: ubuntu-20.04 | |
needs: ["test-and-build"] | |
if: contains(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: binary | |
path: .build/ | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create docker tags | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: ghcr.io/riotkit-org/volume-syncing-controller | |
- name: Build and relase docker | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
release-chart: | |
runs-on: ubuntu-latest | |
needs: ["release-docker"] | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Configure Git | |
run: | | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "[email protected]" | |
- name: Generate README | |
run: make helm-docs | |
- name: Publish Helm chart | |
uses: stefanprodan/helm-gh-pages@master | |
with: | |
token: "${{ secrets.GH_RW_TOKEN }}" | |
charts_dir: helm | |
charts_url: https://riotkit-org.github.io/helm-of-revolution | |
owner: riotkit-org | |
repository: helm-of-revolution | |
branch: gh-pages | |
target_dir: ./ | |
commit_username: "${{ env.GITHUB_ACTOR }}" | |
commit_email: "${{ env.GITHUB_ACTOR }}@users.noreply.github.com" | |
app_version: "${{github.ref_name}}" | |
chart_version: "${{github.ref_name}}" |