Skip to content

Commit

Permalink
2024-04-21
Browse files Browse the repository at this point in the history
  • Loading branch information
bestia.dev committed Apr 22, 2024
1 parent c785f26 commit a04260d
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/clear_all_cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: cleanup caches on main

# Configure Manual Trigger with workflow_dispatch
on:
workflow_dispatch:

jobs:
cleanup:
runs-on: ubuntu-latest
permissions:
# `actions:write` permission is required to delete caches
# See also: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#delete-a-github-actions-cache-for-a-repository-using-a-cache-id
actions: write
contents: read
steps:
- name: checkout
uses: actions/checkout@v4

- name: Cleanup
run: |
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
printf "$REPO\n"
BRANCH=main
printf "$BRANCH\n"
# loop until the list is empty, because it deletes only 30 per page
has_items=true
while [ "$has_items" = true ]
do
printf "\033[0;33m Fetching list of cache key\n\033[0m\n"
printf "\033[0;32m gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 \n\033[0m\n"
cache_keys=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 )
# printf "$cache_keys\n"
if [ -z "$cache_keys" ]; then
printf "\033[0;35m gh actions-cache list returned nothing.\n\033[0m\n"
has_items=false
fi
## Setting this to not fail the workflow while deleting cache keys.
set +e
for cacheKey in $cache_keys
do
# printf "\033[0;32m gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm\n\033[0m\n"
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
done
done
printf "\033[0;33m Done\n\033[0m\n"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

43 changes: 43 additions & 0 deletions .github/workflows/docs_pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Simple workflow for deploying static content to GitHub Pages
name: docs_pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: 'docs'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
54 changes: 54 additions & 0 deletions .github/workflows/rust_fmt_auto_build_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: rust_fmt_auto_build_test

on:
# push to any branch
push:

# any pull requests
pull_request:

env:
CARGO_TERM_COLOR: always

jobs:
rust_fmt_auto_build_test:

runs-on: ubuntu-latest

steps:
- name: checkout
uses: actions/checkout@v4

- name: cargo fmt -- --check
run: cargo fmt -- --check

- name: Run cache for rust dependencies
uses: Swatinem/rust-cache@v2.7.3

- name: Configure sccache
run: printf "RUSTC_WRAPPER=sccache\n" >> $GITHUB_ENV; printf "SCCACHE_GHA_ENABLED=true\n" >> $GITHUB_ENV

- name: Run sccache-cache for artifacts
uses: mozilla-actions/sccache-action@v0.0.4

- name: install and cache cargo-auto
uses: baptiste0928/cargo-install@v3.0.0
with:
crate: cargo-auto

- name: Cache for automation tasks
uses: actions/cache@v4.0.0
with:
path: |
automation_tasks_rs/.file_hashes.json
automation_tasks_rs/target
automation_tasks_rs/Cargo.toml
automation_tasks_rs/Cargo.lock
key: automation_tasks_rs

- name: cargo auto build
run: cargo auto build

- name: cargo auto test
run: cargo auto test

0 comments on commit a04260d

Please sign in to comment.