197 lines
6.8 KiB
YAML
197 lines
6.8 KiB
YAML
name: Lint and Test Charts
|
|
|
|
on:
|
|
push:
|
|
branches: [ "main", "release-*" ]
|
|
pull_request_target:
|
|
branches: [ "main", "release-*" ]
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
jobs:
|
|
lint-test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
ref: ${{ github.event.pull_request.head.ref }}
|
|
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
|
|
|
- name: Set up Helm
|
|
uses: azure/setup-helm@v3
|
|
with:
|
|
version: v3.12.1
|
|
|
|
- uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.9'
|
|
check-latest: true
|
|
|
|
- name: Set up chart-testing
|
|
uses: helm/chart-testing-action@v2.6.0
|
|
|
|
- name: Pre package
|
|
run: |
|
|
bash scripts/package.sh
|
|
|
|
- name: Run chart-testing (list-changed)
|
|
id: list-changed
|
|
run: |
|
|
changed=$(ct list-changed --chart-dirs build/installer/wizard/config --target-branch ${{ github.event.repository.default_branch }})
|
|
if [[ -n "$changed" ]]; then
|
|
echo "changed=true" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Run chart-testing (lint)
|
|
if: steps.list-changed.outputs.changed == 'true'
|
|
run: ct lint --chart-dirs build/installer/wizard/config --check-version-increment=false --target-branch ${{ github.event.repository.default_branch }}
|
|
|
|
# - name: Create kind cluster
|
|
# if: steps.list-changed.outputs.changed == 'true'
|
|
# uses: helm/kind-action@v1.7.0
|
|
|
|
# - name: Run chart-testing (install)
|
|
# if: steps.list-changed.outputs.changed == 'true'
|
|
# run: ct install --chart-dirs wizard/charts,wizard/config --target-branch ${{ github.event.repository.default_branch }}
|
|
|
|
push-image:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: "Checkout source code"
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
ref: ${{ github.event.pull_request.head.ref }}
|
|
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
|
|
|
# test
|
|
- env:
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
AWS_DEFAULT_REGION: "us-east-1"
|
|
run: |
|
|
bash scripts/image-manifest.sh && bash scripts/upload-images.sh .manifest/images.mf
|
|
|
|
push-image-arm64:
|
|
runs-on: [self-hosted, linux, ARM64]
|
|
|
|
steps:
|
|
- name: 'Checkout source code'
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
ref: ${{ github.event.pull_request.head.ref }}
|
|
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
|
|
|
|
|
- env:
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
AWS_DEFAULT_REGION: 'us-east-1'
|
|
run: |
|
|
export PATH=$PATH:/usr/local/bin:/home/ubuntu/.local/bin
|
|
bash scripts/image-manifest.sh && bash scripts/upload-images.sh .manifest/images.mf linux/arm64
|
|
|
|
|
|
push-deps:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: "Checkout source code"
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
ref: ${{ github.event.pull_request.head.ref }}
|
|
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
|
|
|
# test
|
|
- env:
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
AWS_DEFAULT_REGION: "us-east-1"
|
|
run: |
|
|
bash scripts/deps-manifest.sh && bash scripts/upload-deps.sh
|
|
|
|
push-deps-arm64:
|
|
runs-on: [self-hosted, linux, ARM64]
|
|
|
|
steps:
|
|
- name: "Checkout source code"
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
ref: ${{ github.event.pull_request.head.ref }}
|
|
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
|
|
|
- name: Install coscmd
|
|
run: pip install coscmd
|
|
|
|
# test
|
|
- env:
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
AWS_DEFAULT_REGION: "us-east-1"
|
|
run: |
|
|
export PATH=$PATH:/usr/local/bin:/home/ubuntu/.local/bin
|
|
bash scripts/deps-manifest.sh linux/arm64 && bash scripts/upload-deps.sh linux/arm64
|
|
|
|
|
|
|
|
install-test:
|
|
needs: [lint-test, push-image, push-image-arm64, push-deps, push-deps-arm64]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
ref: ${{ github.event.pull_request.head.ref }}
|
|
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
|
|
|
- name: 'Test tag version'
|
|
id: vars
|
|
run: |
|
|
v=1.11.0-$(echo $RANDOM)
|
|
echo "tag_version=$v" >> $GITHUB_OUTPUT
|
|
|
|
- name: Package installer
|
|
run: |
|
|
bash scripts/build.sh ${{ steps.vars.outputs.tag_version }}
|
|
|
|
- name: Upload package
|
|
env:
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
AWS_DEFAULT_REGION: 'us-east-1'
|
|
run: |
|
|
md5sum install-wizard-v${{ steps.vars.outputs.tag_version }}.tar.gz > install-wizard-v${{ steps.vars.outputs.tag_version }}.md5sum.txt && \
|
|
aws s3 cp install-wizard-v${{ steps.vars.outputs.tag_version }}.md5sum.txt s3://terminus-os-install/install-wizard-v${{ steps.vars.outputs.tag_version }}.md5sum.txt --acl=public-read && \
|
|
aws s3 cp install-wizard-v${{ steps.vars.outputs.tag_version }}.tar.gz s3://terminus-os-install/install-wizard-v${{ steps.vars.outputs.tag_version }}.tar.gz --acl=public-read
|
|
|
|
|
|
- name: Deploy Request
|
|
uses: fjogeleit/http-request-action@v1
|
|
with:
|
|
url: 'https://cloud-dev-api.bttcdn.com/v1/resource/installTest'
|
|
method: 'POST'
|
|
customHeaders: '{"Authorization": "${{ secrets.INSTALL_SECRET }}"}'
|
|
data: 'versions=${{ steps.vars.outputs.tag_version }}&downloadUrl=https://dc3p1870nn3cj.cloudfront.net/install-wizard-v${{ steps.vars.outputs.tag_version }}.tar.gz'
|
|
contentType: "application/x-www-form-urlencoded"
|
|
|
|
- name: Check Reault
|
|
uses: eball/poll-check-endpoint@v0.1.0
|
|
with:
|
|
url: https://cloud-dev-api.bttcdn.com/v1/resource/installResult
|
|
method: 'POST'
|
|
expectStatus: 200
|
|
failedBodyRegex: '"installedAt":"[0-9]{10,}".*"isSuccess":false'
|
|
expectBodyRegex: '"isSuccess":true'
|
|
timeout: 1800000
|
|
interval: 30000
|
|
customHeaders: '{"Authorization": "${{ secrets.INSTALL_SECRET }}", "Content-Type": "application/x-www-form-urlencoded"}'
|
|
data: 'versions=${{ steps.vars.outputs.tag_version }}'
|