mirror of https://github.com/actions/cache.git
Update workflows. Keep only necessary ones
parent
f77a1cd7fa
commit
3c8f50ae72
@ -1 +1 @@
|
||||
* @actions/actions-cache
|
||||
* @danySam
|
||||
|
@ -0,0 +1,127 @@
|
||||
name: GCS Integration Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
pull_request:
|
||||
branches: [main]
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
test-gcs-basic:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GCS_BUCKET: ${{ secrets.GCS_TEST_BUCKET }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up GCP credentials
|
||||
uses: google-github-actions/auth@v2
|
||||
with:
|
||||
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
|
||||
|
||||
- name: Generate test files
|
||||
run: |
|
||||
mkdir -p gcs-test-cache
|
||||
echo "Test content $(date)" > gcs-test-cache/test1.txt
|
||||
echo "More test content $(date)" > gcs-test-cache/test2.txt
|
||||
|
||||
- name: Save cache to GCS
|
||||
id: cache-save
|
||||
uses: ./
|
||||
with:
|
||||
path: gcs-test-cache
|
||||
key: gcs-integration-${{ github.run_id }}
|
||||
gcs-bucket: ${{ env.GCS_BUCKET }}
|
||||
|
||||
- name: Delete local cache
|
||||
run: rm -rf gcs-test-cache
|
||||
|
||||
- name: Restore cache from GCS
|
||||
id: cache-restore
|
||||
uses: ./
|
||||
with:
|
||||
path: gcs-test-cache
|
||||
key: gcs-integration-${{ github.run_id }}
|
||||
gcs-bucket: ${{ env.GCS_BUCKET }}
|
||||
|
||||
- name: Verify cache contents
|
||||
run: |
|
||||
if [ ! -f "gcs-test-cache/test1.txt" ] || [ ! -f "gcs-test-cache/test2.txt" ]; then
|
||||
echo "Cache files not restored correctly"
|
||||
exit 1
|
||||
fi
|
||||
echo "Cache successfully restored from GCS"
|
||||
|
||||
test-gcs-cross-runner:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
fail-fast: false
|
||||
runs-on: ${{ matrix.os }}
|
||||
env:
|
||||
GCS_BUCKET: ${{ secrets.GCS_TEST_BUCKET }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up GCP credentials
|
||||
uses: google-github-actions/auth@v2
|
||||
with:
|
||||
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
|
||||
|
||||
- name: Generate cross-platform files
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p cross-platform-cache
|
||||
echo "Cross-platform test content ${{ runner.os }} $(date)" > cross-platform-cache/test-${{ runner.os }}.txt
|
||||
|
||||
- name: Save to GCS with cross-platform key
|
||||
uses: ./
|
||||
with:
|
||||
path: cross-platform-cache
|
||||
key: cross-platform-${{ github.run_id }}
|
||||
gcs-bucket: ${{ env.GCS_BUCKET }}
|
||||
gcs-path-prefix: cross-platform-tests
|
||||
|
||||
test-gcs-fallback:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Generate fallback test files
|
||||
run: |
|
||||
mkdir -p fallback-cache
|
||||
echo "Fallback test content $(date)" > fallback-cache/fallback.txt
|
||||
|
||||
- name: Test fallback to GitHub cache
|
||||
uses: ./
|
||||
with:
|
||||
path: fallback-cache
|
||||
key: fallback-test-${{ github.run_id }}
|
||||
gcs-bucket: "this-bucket-does-not-exist-${{ github.run_id }}"
|
||||
|
||||
- name: Delete local cache
|
||||
run: rm -rf fallback-cache
|
||||
|
||||
- name: Restore with fallback
|
||||
id: restore-fallback
|
||||
uses: ./
|
||||
with:
|
||||
path: fallback-cache
|
||||
key: fallback-test-${{ github.run_id }}
|
||||
gcs-bucket: "this-bucket-does-not-exist-${{ github.run_id }}"
|
||||
|
||||
- name: Verify fallback mechanism worked
|
||||
run: |
|
||||
if [ ! -f "fallback-cache/fallback.txt" ]; then
|
||||
echo "Fallback mechanism did not work correctly"
|
||||
exit 1
|
||||
fi
|
||||
echo "Successfully fell back to GitHub cache"
|
@ -1,16 +0,0 @@
|
||||
name: Assign issue
|
||||
on:
|
||||
issues:
|
||||
types: [opened]
|
||||
jobs:
|
||||
run-action:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Get current oncall
|
||||
id: oncall
|
||||
run: |
|
||||
echo "CURRENT=$(curl --request GET 'https://api.pagerduty.com/oncalls?include[]=users&schedule_ids[]=P5VG2BX&earliest=true' --header 'Authorization: Token token=${{ secrets.PAGERDUTY_TOKEN }}' --header 'Accept: application/vnd.pagerduty+json;version=2' --header 'Content-Type: application/json' | jq -r '.oncalls[].user.name')" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: add_assignees
|
||||
run: |
|
||||
curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN}}" https://api.github.com/repos/${{github.repository}}/issues/${{ github.event.issue.number}}/assignees -d '{"assignees":["${{steps.oncall.outputs.CURRENT}}"]}'
|
@ -1,20 +0,0 @@
|
||||
name: Add Reviewer PR
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened]
|
||||
jobs:
|
||||
run-action:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Get current oncall
|
||||
id: oncall
|
||||
run: |
|
||||
echo "CURRENT=$(curl --request GET 'https://api.pagerduty.com/oncalls?include[]=users&schedule_ids[]=P5VG2BX&earliest=true' --header 'Authorization: Token token=${{ secrets.PAGERDUTY_TOKEN }}' --header 'Accept: application/vnd.pagerduty+json;version=2' --header 'Content-Type: application/json' | jq -r '.oncalls[].user.name')" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Request Review
|
||||
run: |
|
||||
curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN}}" https://api.github.com/repos/${{github.repository}}/pulls/${{ github.event.pull_request.number}}/requested_reviewers -d '{"reviewers":["${{steps.oncall.outputs.CURRENT}}"]}'
|
||||
|
||||
- name: Add Assignee
|
||||
run: |
|
||||
curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN}}" https://api.github.com/repos/${{github.repository}}/issues/${{ github.event.pull_request.number}}/assignees -d '{"assignees":["${{steps.oncall.outputs.CURRENT}}"]}'
|
@ -1,20 +0,0 @@
|
||||
name: 'Publish Immutable Action Version'
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [released]
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checking out
|
||||
uses: actions/checkout@v4
|
||||
- name: Publish
|
||||
id: publish
|
||||
uses: actions/publish-immutable-action@0.0.3
|
@ -1,28 +0,0 @@
|
||||
name: Release new action version
|
||||
on:
|
||||
release:
|
||||
types: [released]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
TAG_NAME:
|
||||
description: 'Tag name that the major tag will point to'
|
||||
required: true
|
||||
|
||||
env:
|
||||
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
update_tag:
|
||||
name: Update the major tag to include the ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} changes
|
||||
environment:
|
||||
name: releaseNewActionVersion
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Update the ${{ env.TAG_NAME }} tag
|
||||
id: update-major-tag
|
||||
uses: actions/publish-action@v0.3.0
|
||||
with:
|
||||
source-tag: ${{ env.TAG_NAME }}
|
||||
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
|
Loading…
Reference in New Issue