Update README.md #9
This file contains hidden or 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: Xodium CI/CD | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| packages: write | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "${{ github.workflow }}-${{ github.ref }}" | |
| cancel-in-progress: true | |
| env: | |
| CARGO_TERM_COLOR: always | |
| SCCACHE_GHA_ENABLED: "true" | |
| RUSTC_WRAPPER: "sccache" | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: "${{ github.ref_name }}" | |
| steps: | |
| - id: checkout | |
| name: Checkout | |
| uses: actions/checkout@v6.0.2 | |
| - id: setup_rust | |
| name: Setup Rust | |
| uses: actions-rust-lang/setup-rust-toolchain@d197c158264056996cfba74a9c2d93886346edc3 | |
| with: | |
| toolchain: stable | |
| components: rustfmt, clippy | |
| - id: run_sccache_cache | |
| name: Run sccache-cache | |
| uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad | |
| - id: run_lint | |
| name: Run Lint | |
| run: | | |
| cargo clippy --all-targets --all-features -- -D warnings | |
| cargo fmt --all -- --check | |
| shell: bash | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: "${{ github.ref_name }}" | |
| url: "${{ steps.upload_artifact.outputs.artifact-url }}" | |
| outputs: | |
| VERSION: "${{ steps.get_version.outputs.VERSION }}" | |
| NAME: "${{ steps.get_name.outputs.NAME }}" | |
| steps: | |
| - id: checkout | |
| name: Checkout | |
| uses: actions/checkout@v6.0.2 | |
| - id: cache_dependencies | |
| name: Cache dependencies | |
| uses: actions/cache@v5.0.5 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - id: setup_rust | |
| name: Setup Rust | |
| uses: actions-rust-lang/setup-rust-toolchain@d197c158264056996cfba74a9c2d93886346edc3 | |
| with: | |
| toolchain: stable | |
| - id: run_sccache_cache | |
| name: Run sccache-cache | |
| uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad | |
| - id: build_artifact | |
| name: Build Artefact | |
| run: cargo build --release --timings | |
| shell: bash | |
| - id: get_name | |
| name: Get Name | |
| run: echo "NAME=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].name')" >> $GITHUB_OUTPUT | |
| shell: bash | |
| - id: get_version | |
| name: Get Version | |
| run: | | |
| echo "VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)" >> $GITHUB_OUTPUT | |
| shell: bash | |
| - id: upload_artifact | |
| name: Upload Artifact | |
| uses: actions/upload-artifact@v7.0.1 | |
| with: | |
| name: ${{ steps.get_name.outputs.NAME }}-linux-x64 | |
| path: target/release/${{ steps.get_name.outputs.NAME }} | |
| retention-days: 7 | |
| nightly_release: | |
| name: Nightly Release | |
| needs: [ lint, build ] | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: "${{ github.ref_name }}" | |
| permissions: | |
| contents: write | |
| steps: | |
| - id: checkout | |
| name: Checkout | |
| uses: actions/checkout@v6.0.2 | |
| - id: download_artifacts | |
| name: Download Artefacts | |
| uses: actions/download-artifact@v8.0.1 | |
| with: | |
| pattern: "${{ needs.build.outputs.NAME }}-*" | |
| path: dist/ | |
| merge-multiple: true | |
| - id: update_nightly_tag | |
| name: Update Nightly Tag | |
| run: | | |
| gh api repos/${{ github.repository }}/git/refs/tags/nightly \ | |
| --method PATCH \ | |
| --field sha=${{ github.sha }} \ | |
| --field force=true 2>/dev/null || \ | |
| gh api repos/${{ github.repository }}/git/refs \ | |
| --method POST \ | |
| --field ref=refs/tags/nightly \ | |
| --field sha=${{ github.sha }} | |
| env: | |
| GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
| - id: create_nightly_release | |
| name: Create Nightly Release | |
| uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe | |
| env: | |
| GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
| with: | |
| prerelease: true | |
| files: dist/${{ needs.build.outputs.NAME }}* | |
| tag_name: nightly | |
| name: Nightly Build | |
| body: | | |
| From commit: ${{ github.sha }} | |
| Generated on: ${{ github.event.head_commit.timestamp }} | |
| docker: | |
| name: Docker | |
| needs: [ lint, build ] | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: "${{ github.ref_name }}" | |
| steps: | |
| - id: checkout | |
| name: Checkout | |
| uses: actions/checkout@v6.0.2 | |
| - id: download_artifact | |
| name: Download Binary Artifact | |
| uses: actions/download-artifact@v8.0.1 | |
| with: | |
| name: ${{ needs.build.outputs.NAME }}-linux-x64 | |
| path: ./dist/ | |
| - id: prepare_binary | |
| name: Prepare Binary | |
| run: | | |
| chmod +x ./dist/${{ needs.build.outputs.NAME }} | |
| cp ./dist/${{ needs.build.outputs.NAME }} ./streamocracy | |
| shell: bash | |
| - id: setup_docker_buildx | |
| name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd | |
| - id: login_ghcr | |
| name: Login to GitHub Container Registry | |
| uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - id: docker_meta | |
| name: Docker Metadata | |
| uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf | |
| with: | |
| images: ghcr.io/${{ github.repository_owner }}/streamocracy | |
| tags: | | |
| type=raw,value=nightly | |
| type=sha,prefix=,suffix=,format=short | |
| - id: build_and_push | |
| name: Build and Push | |
| uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f | |
| with: | |
| context: . | |
| file: ./Dockerfile.runtime | |
| push: true | |
| tags: ${{ steps.docker_meta.outputs.tags }} | |
| labels: ${{ steps.docker_meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - id: summary | |
| name: Summary | |
| run: | | |
| echo "## Docker Image Published" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "| Tag | Image |" >> $GITHUB_STEP_SUMMARY | |
| echo "|-----|-------|" >> $GITHUB_STEP_SUMMARY | |
| for tag in $(echo "${{ steps.docker_meta.outputs.tags }}" | tr '\n' ' '); do | |
| echo "| $tag | \`$tag\` |" >> $GITHUB_STEP_SUMMARY | |
| done | |
| shell: bash | |
| docs: | |
| name: Documentation | |
| needs: [ lint, build ] | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: "${{ steps.deployment.outputs.page_url }}" | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| steps: | |
| - id: checkout | |
| name: Checkout | |
| uses: actions/checkout@v6.0.2 | |
| - id: setup_rust | |
| name: Setup Rust | |
| uses: actions-rust-lang/setup-rust-toolchain@d197c158264056996cfba74a9c2d93886346edc3 | |
| with: | |
| toolchain: stable | |
| - id: run_sccache_cache | |
| name: Run sccache-cache | |
| uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad | |
| - id: build_docs | |
| name: Build Documentation | |
| run: cargo doc --no-deps | |
| - id: flatten_docs | |
| name: Flatten Docs | |
| run: | | |
| cp -r target/doc/streamocracy/* target/doc/ | |
| rm -rf target/doc/streamocracy | |
| - id: upload_artifact | |
| name: Upload Pages Artifact | |
| uses: actions/upload-pages-artifact@v5 | |
| with: | |
| path: target/doc/ | |
| - id: deployment | |
| name: Deploy to GitHub Pages | |
| uses: actions/deploy-pages@v5 |