Skip to content
This repository has been archived by the owner on Jan 11, 2025. It is now read-only.

Commit

Permalink
init: first version setup
Browse files Browse the repository at this point in the history
  • Loading branch information
schonfinkel committed Sep 15, 2024
1 parent 7da1fa4 commit 2b13500
Show file tree
Hide file tree
Showing 20 changed files with 1,745 additions and 2 deletions.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
### Prerequisites

* [ ] Can you reproduce the problem? If so, please the relevant code.
* [ ] Are you running the latest version?
* [ ] Are you reporting to the correct repository?
* [ ] Did you perform a cursory search?

### Description

[Description of the bug or feature]

### Steps to Reproduce

1. [First Step]
2. [Second Step]
3. [and so on...]

**Expected behavior:** [What you expected to happen]

**Actual behavior:** [What actually happened]
11 changes: 11 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] I have read the **CONTRIBUTING** document.
- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
41 changes: 41 additions & 0 deletions .github/workflows/build-container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "[Nix] Build Container"

on:
push:
branches: [ "master" ]
paths:
- '.github/**'
- 'flake.nix'
- 'flake.lock'
- 'src/**'
- 'tests/**'
pull_request:
paths:
- '.github/**'
- 'flake.nix'
- 'flake.lock'
- 'src/**'
- 'tests/**'

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
token: ${{ github.token }}

- name: Install Nix
uses: cachix/install-nix-action@v24
with:
# Mostly to avoid GitHub rate limiting
extra_nix_config: |
access-tokens = github.com=${{ github.token }}
- name: Install Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@main

- name: Build OCI Image
run: nix build .#dockerImage
43 changes: 43 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: "[.Net] Build & Test"

on:
push:
branches: [ "master" ]
paths:
- '.github/**'
- 'flake.nix'
- 'flake.lock'
- 'src/**'
- 'tests/**'
pull_request:
paths:
- '.github/**'
- 'flake.nix'
- 'flake.lock'
- 'src/**'
- 'tests/**'

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
token: ${{ github.token }}

- name: Install Nix
uses: cachix/install-nix-action@v24
with:
# Mostly to avoid GitHub rate limiting
extra_nix_config: |
access-tokens = github.com=${{ github.token }}
- name: Install Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@main

- name: Build
run: nix develop .#ci --impure -c just build
- name: Run testing suite
run: nix develop .#ci --impure -c just test
61 changes: 61 additions & 0 deletions .github/workflows/clear-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Clear cache

on:
workflow_dispatch:
schedule:
- cron: "*/15 2-4 * * *"
pull_request:
types:
- closed

permissions:
actions: write

jobs:
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries
pr-cleanup:
if: ${{ github.event_name == 'pull_request' && github.event.action == 'closed' }}
runs-on: ubuntu-latest
steps:
- name: Closed PR Cleanup
run: |
gh extension install actions/gh-actions-cache
echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH -L 100 | cut -f 1 )
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge

scheduled-cleanup:
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
steps:
- name: Clear Cache
uses: actions/github-script@v7
with:
script: |
console.log("About to clear")
const caches = await github.rest.actions.getActionsCacheList({
owner: context.repo.owner,
repo: context.repo.repo,
})
for (const cache of caches.data.actions_caches) {
console.log(cache)
github.rest.actions.deleteActionsCacheById({
owner: context.repo.owner,
repo: context.repo.repo,
cache_id: cache.id,
})
}
console.log("Clear completed")
39 changes: 39 additions & 0 deletions .github/workflows/nuget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Nuget

on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"

jobs:
push:
name: Push to Nuget
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ github.token }}
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x

- name: Install Nix
uses: cachix/install-nix-action@v24
with:
# Mostly to avoid GitHub rate limiting
extra_nix_config: |
access-tokens = github.com=${{ github.token }}
- name: Install Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@main

- name: Test before releasing
run: nix develop .#ci --impure -c just test
- name: Pack release
run: nix develop .#ci --impure -c just pack
- name: Publish the package to nuget.org
run: nix develop .#ci --impure -c just release
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
22 changes: 22 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Create Release

on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"

jobs:
create-github-release:
name: Create GitHub Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ github.token }}
- name: Create Release
run: gh release create ${{ github.ref }} --generate-notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading

0 comments on commit 2b13500

Please sign in to comment.