This repository has been archived by the owner on Aug 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide CI for developer environments(#2)
* Provide devenv CI * Fix a typo * Fix quotation * Fix inverted condition around cache handling * Fix inverted condition around cache handling more * Need to wrapt with nix-shell * Log with tee * Fix both of quotation and actionlint issue * Extract fmt task from default task * Revert "Bump itself" This reverts commit b7ada01. * Add test for basic task
- Loading branch information
Showing
5 changed files
with
86 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: CI - Development Environment | ||
on: | ||
push: | ||
branches: [main] | ||
paths: | ||
- '.github/workflows/ci-dev.yml' | ||
- '*.nix' | ||
- 'Taskfile.yml' | ||
pull_request: | ||
paths: | ||
- '.github/workflows/ci-dev.yml' | ||
- '*.nix' | ||
- 'Taskfile.yml' | ||
schedule: | ||
# About JST 8:00 | ||
- cron: '0 17 * * *' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
get-version: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
outputs: | ||
current: ${{ steps.current.outputs.current }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: 'go.mod' | ||
cache-dependency-path: 'go.sum' | ||
- run: go install . | ||
- id: current | ||
run: | | ||
current="$(nix-headbump -current)" | ||
echo "current=${current}" | tee -a "$GITHUB_OUTPUT" | ||
tasks: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
needs: [get-version] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: 'Cache Nix store' | ||
uses: actions/cache@v3 | ||
id: nix-cache | ||
with: | ||
path: /tmp/nixcache | ||
key: ${{ runner.os }}-nix_${{ needs.get-version.outputs.current }} | ||
- uses: cachix/install-nix-action@v21 | ||
with: | ||
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/${{ needs.get-version.outputs.current }}.tar.gz | ||
# https://github.com/cachix/install-nix-action/issues/56#issuecomment-1240991760 | ||
- name: 'Import Nix store cache' | ||
if: ${{ steps.nix-cache.outputs.cache-hit == 'true' }} | ||
run: 'nix-store --import < /tmp/nixcache' | ||
- run: nix-build | ||
if: ${{ steps.nix-cache.outputs.cache-hit != 'true' }} | ||
- name: Log current versions | ||
run: nix-shell --run 'task versions' | ||
- name: 'Export Nix store cache' | ||
if: ${{ steps.nix-cache.outputs.cache-hit != 'true' }} | ||
run: | | ||
readarray -t paths < <(find /nix/store -maxdepth 1 -name '*-*') | ||
nix-store --export "${paths[@]}" > /tmp/nixcache | ||
- name: Run main task | ||
run: nix-shell --run 'task' |
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
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