Merge pull request #1898 from nexodus-io/dependabot/npm_and_yarn/ui/n… #1
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: build | |
on: | |
push: | |
branches: ["main"] | |
paths-ignore: | |
- '**/*.md' | |
- '**/*.png' | |
- '**/*.gitignore' | |
- '.vscode/**' | |
- '.github/mergify.yml' | |
- '.excalidraw-ignore' | |
pull_request: | |
branches: ["main"] | |
# Must stay in sync with the paths in .github/workflows/docs.yml and .github/mergify.yml | |
paths-ignore: | |
- '**/*.md' | |
- '**/*.png' | |
- '**/*.gitignore' | |
- '.vscode/**' | |
- '.github/mergify.yml' | |
- '.excalidraw-ignore' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
generate: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: ./.github/actions/setup-go-env | |
- name: Generate Source Code | |
run: | | |
make generate | |
- name: Check for uncommitted changes | |
id: check-changes | |
run: | | |
if [ "$(git diff --ignore-space-at-eol | wc -l)" -gt "0" ]; then | |
echo "Detected uncommitted changes after build. See status below:" | |
git diff | |
echo "========================================================" | |
echo " run 'make generate' and commit the changes" | |
echo "========================================================" | |
exit 1 | |
fi | |
go-lint-linux: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
os: ["linux"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: ./.github/actions/setup-go-env | |
- name: Lint ${{ matrix.os }} | |
run: make dist/.go-lint-${{ matrix.os }} | |
# these are a little slower to lint... | |
go-lint-rest: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
os: ["darwin", "windows"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: ./.github/actions/setup-go-env | |
- name: Lint ${{ matrix.os }} | |
run: make dist/.go-lint-${{ matrix.os }} | |
ui-lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: UI Lint | |
run: make ui-lint | |
k8s-lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: ./.github/actions/setup-go-env | |
- name: Login to GHCR | |
run: echo "${{ github.token }}" | docker login https://ghcr.io -u "${GITHUB_ACTOR}" --password-stdin | |
- name: Check Kube Manifests | |
run: | | |
make -j yaml-lint k8s-lint | |
opa-lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup OPA | |
uses: open-policy-agent/setup-opa@v2 | |
with: | |
version: latest | |
- name: OPA Lint and Tests | |
run: make opa-lint | |
build-images: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- name: apiserver | |
tags: quay.io/nexodus/apiserver:latest | |
- name: frontend | |
tags: quay.io/nexodus/frontend:latest | |
- name: ipam | |
tags: quay.io/nexodus/go-ipam:latest | |
- name: nexd | |
tags: quay.io/nexodus/nexd:latest | |
- name: envsubst | |
tags: quay.io/nexodus/envsubst:latest | |
- name: playwright | |
tags: quay.io/nexodus/playwright:latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-buildx-action@v3 | |
- name: Build and export ${{ matrix.name }} | |
uses: docker/build-push-action@v5 | |
with: | |
file: ./Containerfile.${{ matrix.name }} | |
tags: ${{ matrix.tags }} | |
outputs: type=docker,dest=/tmp/${{ matrix.name }}.tar | |
cache-from: type=gha,scope=${{ matrix.name }} | |
cache-to: type=gha,scope=${{ matrix.name }},mode=max | |
- name: Upload ${{ matrix.name }} artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.name }} | |
path: /tmp/${{ matrix.name }}.tar | |
go-unit: | |
needs: [ go-lint-linux, go-lint-rest, generate ] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["ubuntu-latest", "macos-latest", "windows-latest"] | |
arch: ["amd64", "arm64", "arm"] | |
exclude: | |
- os: macos-latest | |
arch: arm | |
- os: windows-latest | |
arch: arm | |
- os: windows-latest | |
arch: arm64 | |
# Tests are failing with "bad CPU type in executable" or "exec format error" | |
- os: ubuntu-latest | |
arch: arm | |
- os: ubuntu-latest | |
arch: arm64 | |
- os: macos-latest | |
arch: arm64 | |
runs-on: ${{ matrix.os }} | |
env: | |
GOARCH: ${{ matrix.arch }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: ./.github/actions/setup-go-env | |
- name: Unit tests | |
run: | | |
gotestsum --format standard-quiet -- -v ./... | |
build-packages: | |
needs: [ go-lint-linux, generate ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: ./.github/actions/setup-go-env | |
- name: Build nexodus packages | |
id: build | |
shell: bash | |
run: | | |
NEXODUS_BUILD_PROFILE=prod make -j dist/packages | |
- name: Upload nexodus zip packages | |
uses: actions/upload-artifact@v4 | |
with: | |
name: nexodus-packages-zip | |
if-no-files-found: error | |
path: | | |
dist/packages/*.zip | |
- name: Upload nexodus tar.gz packages | |
uses: actions/upload-artifact@v4 | |
with: | |
name: nexodus-packages-tar | |
if-no-files-found: error | |
path: | | |
dist/packages/*.tar.gz | |
upload-s3-packages: | |
needs: ["build-packages", "build-rpm", "go-unit", "e2e"] | |
permissions: | |
id-token: write | |
contents: read | |
runs-on: ubuntu-latest | |
environment: image-repositories | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: download zip binary artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: nexodus-packages-zip | |
path: dist/packages | |
- name: download tar.gz binary artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: nexodus-packages-tar | |
path: dist/packages | |
- name: Display structure of downloaded files | |
run: ls -lah -R | |
working-directory: dist/packages | |
- name: configure aws credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ secrets.AWS_ROLE }} | |
role-session-name: nexodus-ci-deploy | |
aws-region: us-east-1 | |
- name: copy binaries to s3 | |
run: | | |
aws s3 sync dist/packages s3://nexodus-io/qa | |
e2e: | |
needs: [build-images] | |
name: e2e-integration | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
matrix: | |
# todo: work on getting the cockroach overlay working ["dev", "cockroach"] | |
overlay: ["dev"] | |
steps: | |
- name: Remove unnecessary files on the runner for additional space | |
run: | | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /opt/ghc | |
sudo apt-get clean | |
sudo apt-get autoremove | |
docker system prune -a -f | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-buildx-action@v3 | |
- name: Setup Go | |
uses: ./.github/actions/setup-go-env | |
- name: Install deps | |
run: | | |
sudo apt update | |
sudo apt-get -qy install libnss3-tools | |
- name: Download apiserver image | |
uses: actions/download-artifact@v4 | |
with: | |
name: apiserver | |
path: /tmp | |
- name: Download frontend image | |
uses: actions/download-artifact@v4 | |
with: | |
name: frontend | |
path: /tmp | |
- name: Download ipam image | |
uses: actions/download-artifact@v4 | |
with: | |
name: ipam | |
path: /tmp | |
- name: Download nexd image | |
uses: actions/download-artifact@v4 | |
with: | |
name: nexd | |
path: /tmp | |
- name: Download envsubst image | |
uses: actions/download-artifact@v4 | |
with: | |
name: envsubst | |
path: /tmp | |
- name: Download playwright image | |
uses: actions/download-artifact@v4 | |
with: | |
name: playwright | |
path: /tmp | |
- name: Load Docker images | |
run: | | |
docker load --input /tmp/apiserver.tar | |
docker load --input /tmp/frontend.tar | |
docker load --input /tmp/ipam.tar | |
docker load --input /tmp/nexd.tar | |
docker load --input /tmp/envsubst.tar | |
docker load --input /tmp/playwright.tar | |
- name: Setup KIND | |
run: | | |
OVERLAY=${{ matrix.overlay }} make setup-kind install-olm deploy-operators load-images deploy cacerts derpcerts | |
- name: Build dist | |
run: | | |
make dist/nexd dist/nexctl | |
- name: Run e2e Tests | |
run: | | |
gotestsum --format standard-quiet -- -v --tags=integration ./integration-tests/... | |
- name: Get Logs | |
if: always() | |
run: | | |
kubectl logs -n nexodus -l app.kubernetes.io/part-of=nexodus --all-containers=true > logs.txt | |
- name: Upload Logs and Test Reports | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: e2e-${{ matrix.overlay }}-logs | |
path: | | |
logs.txt | |
./ui/playwright-report/ | |
- name: Check Disk Space | |
if: always() | |
run: df -h | |
build-rpm: | |
needs: [ go-lint-linux, generate ] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- mock_root: fedora-38-x86_64 | |
srpm_mock_root: fedora-38-x86_64 | |
srpm_distro: fc38 | |
- mock_root: fedora-39-x86_64 | |
srpm_mock_root: fedora-39-x86_64 | |
srpm_distro: fc39 | |
- mock_root: centos-stream-9-x86_64 | |
srpm_mock_root: centos-stream-9-x86_64 | |
srpm_distro: el9 | |
steps: | |
- uses: actions/checkout@v4 | |
# Needed for building binaries to generate manpages | |
- name: Setup Go | |
uses: ./.github/actions/setup-go-env | |
- name: Build rpm | |
id: build-rpm | |
run: | | |
MOCK_ROOT="${{ matrix.mock_root }}" SRPM_MOCK_ROOT="${{ matrix.srpm_mock_root }}" SRPM_DISTRO="${{ matrix.srpm_distro }}" make rpm | |
echo "artifact-name=$(pwd)/dist/rpm/mock/nexodus-${{ matrix.mock_root }}-*.x86_64.rpm" >> "$GITHUB_OUTPUT" | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: nexodus-rpms-${{ matrix.mock_root }} | |
path: | | |
${{ steps.build-rpm.outputs.artifact-name }} | |
build-workflow-complete: | |
needs: ["build-packages", "build-rpm", "go-unit", "e2e", "k8s-lint", "opa-lint", "ui-lint"] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Build Complete | |
run: echo "Build Complete" |