-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add basic ci workflows * rm 32 cores machines and adjust binaries builds * run prettier * fix fmt and clippy
- Loading branch information
Showing
26 changed files
with
34,592 additions
and
345 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
--- | ||
name: Task - Build binaries and publish | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release_tag_name: | ||
description: "Release tag name" | ||
type: string | ||
required: true | ||
workflow_call: | ||
inputs: | ||
release_tag_name: | ||
description: "Release tag name" | ||
type: string | ||
required: true | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
build: | ||
- aarch64-apple-darwin | ||
- aarch64-unknown-linux-gnu | ||
- x86_64-apple-darwin | ||
- x86_64-unknown-linux-gnu | ||
# - x86_64-pc-windows-gnu | ||
- x86_64-pc-windows-msvc | ||
include: | ||
- build: aarch64-apple-darwin | ||
os: macos-latest | ||
bin_name: madara | ||
- build: aarch64-unknown-linux-gnu | ||
os: ubuntu-latest | ||
bin_name: madara | ||
- build: x86_64-apple-darwin | ||
os: macos-latest | ||
bin_name: madara | ||
- build: x86_64-unknown-linux-gnu | ||
os: ubuntu-latest | ||
bin_name: madara | ||
- build: x86_64-pc-windows-msvc | ||
os: windows-latest | ||
bin_name: madara.exe | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup rust toolchain | ||
run: | | ||
rustup target add ${{ matrix.build }} | ||
- name: Build binaries | ||
run: cargo build --release --target ${{ matrix.build }} | ||
|
||
- name: Upload binaries to release | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: target/${{ matrix.build }}/release/${{ matrix.bin_name }} | ||
asset_name: ${{ matrix.build}}-${{ matrix.bin_name }} | ||
tag: ${{ inputs.release_tag_name }} | ||
overwrite: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
name: Workflow - Daily Cron | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 0 * * *" | ||
|
||
jobs: | ||
stale_issues: | ||
name: Stale issues | ||
uses: ./.github/workflows/stale-issues.yml | ||
|
||
lock_closed: | ||
name: Lock closed issues/PRs | ||
uses: ./.github/workflows/lock-closed.yml | ||
|
||
security_audit: | ||
name: Security audit | ||
uses: ./.github/workflows/security-audit.yml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
--- | ||
name: Task - Build and Push Docker Image | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release_tag_name: | ||
description: "Release tag name" | ||
type: string | ||
required: true | ||
workflow_call: | ||
inputs: | ||
release_tag_name: | ||
description: "Release tag name" | ||
type: string | ||
required: true | ||
|
||
env: | ||
REGISTRY_IMAGE: ghcr.io/${{ github.repository }} | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
platform: | ||
- linux/amd64 | ||
- linux/arm64 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.REGISTRY_IMAGE }} | ||
tags: | | ||
type=raw,value=${{ inputs.release_tag_name }} | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push by digest | ||
id: build | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
file: Dockerfile | ||
platforms: ${{ matrix.platform }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
outputs: type=image,name=${{ env.REGISTRY_IMAGE | ||
}},push-by-digest=true,name-canonical=true,push=true | ||
|
||
- name: Export digest | ||
run: | | ||
mkdir -p /tmp/digests | ||
digest="${{ steps.build.outputs.digest }}" | ||
touch "/tmp/digests/${digest#sha256:}" | ||
- name: Upload digest | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: digests | ||
path: /tmp/digests/* | ||
if-no-files-found: error | ||
retention-days: 1 | ||
|
||
merge: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build | ||
steps: | ||
- name: Download digests | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: digests | ||
path: /tmp/digests | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.REGISTRY_IMAGE }} | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create manifest list and push | ||
working-directory: /tmp/digests | ||
run: | | ||
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ | ||
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *) | ||
- name: Inspect image | ||
run: | | ||
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
name: Task - Linters Cargo | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
|
||
jobs: | ||
cargo-lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Retrieve cached build | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}-${{ | ||
github.run_id }} | ||
fail-on-cache-miss: true | ||
restore-keys: | | ||
${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}-${{ | ||
github.run_id }} | ||
${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} | ||
${{ runner.os }}-cargo | ||
- name: Format and clippy | ||
run: | | ||
cargo fmt -- --check | ||
cargo clippy --no-deps -- -D warnings | ||
cargo clippy --tests --no-deps -- -D warnings |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
name: Task - Linters | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
|
||
jobs: | ||
prettier: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Run prettier | ||
run: |- | ||
npx prettier --check . |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
name: Task - Lock Closed Issues/PRs | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
|
||
jobs: | ||
lock: | ||
name: 🔒 Lock closed issues and PRs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: dessant/[email protected] | ||
with: | ||
github-token: ${{ github.token }} | ||
issue-lock-inactive-days: "30" | ||
issue-lock-reason: "" | ||
issue-comment: > | ||
Issue closed and locked due to lack of activity. | ||
If you encounter this same issue, please open a new issue and refer | ||
to this closed one. | ||
pr-lock-inactive-days: "1" | ||
pr-lock-reason: "" | ||
pr-comment: > | ||
Pull Request closed and locked due to lack of activity. | ||
If you'd like to build on this closed PR, you can clone it using | ||
this method: https://stackoverflow.com/a/14969986 | ||
Then open a new PR, referencing this closed PR in your message. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
name: Task - Pre-Release | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
|
||
jobs: | ||
build: | ||
name: Take Snapshot | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get the tags by date | ||
id: tags | ||
run: | | ||
echo "new=$(date +'weekly-%Y-%m-%d')" >> $GITHUB_OUTPUT | ||
echo "old=$(date -d'1 week ago' +'weekly-%Y-%m-%d')" >> $GITHUB_OUTPUT | ||
- name: Checkout branch "main" | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: "main" | ||
fetch-depth: 0 | ||
- name: Generate changelog | ||
id: changelog | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
echo "# Automatic snapshot pre-release ${{ steps.tags.outputs.new }}" > Changelog.md | ||
echo "" >> Changelog.md | ||
echo "## Changes since last snapshot (${{ steps.tags.outputs.old }})" >> Changelog.md | ||
echo "" >> Changelog.md | ||
- name: Release snapshot | ||
id: release-snapshot | ||
uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e # v1.1.4 latest version, repo archived | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.tags.outputs.new }} | ||
release_name: ${{ steps.tags.outputs.new }} | ||
draft: false | ||
prerelease: true | ||
body_path: Changelog.md |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
name: Workflow - Pull Request | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
linters: | ||
name: Run linters | ||
uses: ./.github/workflows/linters.yml | ||
|
||
rust_build: | ||
name: Build Rust project | ||
uses: ./.github/workflows/rust-build.yml | ||
|
||
linters_cargo: | ||
name: Run Cargo linters | ||
uses: ./.github/workflows/linters-cargo.yml | ||
needs: rust_build |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
name: Workflow - Push | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
linters: | ||
name: Run linters | ||
uses: ./.github/workflows/linters.yml | ||
|
||
rust_build: | ||
name: Build Rust project | ||
uses: ./.github/workflows/rust-build.yml | ||
|
||
linters_cargo: | ||
name: Run Cargo linters | ||
uses: ./.github/workflows/linters-cargo.yml | ||
needs: rust_build |
Oops, something went wrong.