feat: auto provision databases for tests (#3448) #1623
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
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.ref }}-writecache | |
cancel-in-progress: true | |
name: Write Cache | |
jobs: | |
write-cache: | |
name: Write Cache | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Init Hermit | |
uses: cashapp/[email protected] | |
- name: Install Hermit Packages | |
run: hermit install | |
- name: Docker Compose | |
run: docker compose up -d --wait | |
- name: Init DB | |
run: just init-db | |
- name: Rebuild All | |
run: just build-all | |
- name: Download Go Dependencies | |
run: go mod download -x | |
- name: Download pnpm dependencies | |
run: pnpm install | |
- name: Download playwright browsers | |
run: npx playwright install | |
- id: find-go-build-cache | |
shell: bash | |
run: echo "cache=$(go env GOCACHE)" >> "$GITHUB_OUTPUT" | |
- id: bin-hash | |
shell: bash | |
run: | | |
hash="$(find ./bin ! -type d | sort | xargs openssl sha256 | openssl sha256 -r | cut -d' ' -f1)" | |
echo "hash=$hash" >> "$GITHUB_OUTPUT" | |
- name: Save Hermit Cache | |
uses: actions/cache/save@v4 | |
with: | |
path: ${{ runner.os == 'macOS' && '~/Library/Caches/hermit/pkg' || '~/.cache/hermit/pkg' }} | |
key: ${{ runner.os }}-hermit-cache-${{ steps.bin-hash.outputs.hash }} | |
- name: Save Go Module Cache | |
uses: actions/cache/save@v4 | |
with: | |
path: | | |
~/go/pkg/mod | |
${{ steps.find-go-build-cache.outputs.cache }} | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
- name: Delete Maven Snapshots | |
id: maven-delete-snapshots | |
run: | | |
find ~/.m2/repository -type d -name "*SNAPSHOT" -exec rm -rf {} + | |
- name: Save Maven Modules Cache | |
id: cache-maven | |
uses: actions/cache/save@v4 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
- name: Save pnpm Modules Cache | |
id: cache-pnpm | |
uses: actions/cache/save@v4 | |
with: | |
path: | | |
~/.pnpm-store | |
node_modules | |
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | |
- name: Save Playwright Browser Cache | |
id: cache-playwright | |
uses: actions/cache/save@v4 | |
with: | |
path: ~/.cache/ms-playwright | |
key: ${{ runner.os }}-playwright-${{ hashFiles('**/pnpm-lock.yaml') }} | |
- name: Save Docker Images | |
uses: ScribeMD/[email protected] | |
with: | |
key: docker-${{ runner.os }}-${{ hashFiles('docker-compose.yml') }} |