diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 342d7b0..a981b16 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @actions/actions-cache +* @danySam diff --git a/.github/workflows/close-inactive-issues.yml b/.github/workflows/close-inactive-issues.yml index fe6d19f..f1df398 100644 --- a/.github/workflows/close-inactive-issues.yml +++ b/.github/workflows/close-inactive-issues.yml @@ -12,11 +12,11 @@ jobs: steps: - uses: actions/stale@v9 with: - days-before-issue-stale: 200 - days-before-issue-close: 5 + days-before-issue-stale: 90 + days-before-issue-close: 14 stale-issue-label: "stale" - stale-issue-message: "This issue is stale because it has been open for 200 days with no activity. Leave a comment to avoid closing this issue in 5 days." - close-issue-message: "This issue was closed because it has been inactive for 5 days since being marked as stale." + stale-issue-message: "This issue is stale because it has been open for 90 days with no activity. Leave a comment to avoid closing this issue in 14 days." + close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale." days-before-pr-stale: -1 days-before-pr-close: -1 repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/gcs-integration-test.yml b/.github/workflows/gcs-integration-test.yml new file mode 100644 index 0000000..6f0918b --- /dev/null +++ b/.github/workflows/gcs-integration-test.yml @@ -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" \ No newline at end of file diff --git a/.github/workflows/issue-opened-workflow.yml b/.github/workflows/issue-opened-workflow.yml deleted file mode 100644 index 185eb1d..0000000 --- a/.github/workflows/issue-opened-workflow.yml +++ /dev/null @@ -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}}"]}' diff --git a/.github/workflows/pr-opened-workflow.yml b/.github/workflows/pr-opened-workflow.yml deleted file mode 100644 index 3346d9e..0000000 --- a/.github/workflows/pr-opened-workflow.yml +++ /dev/null @@ -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}}"]}' diff --git a/.github/workflows/publish-immutable-actions.yml b/.github/workflows/publish-immutable-actions.yml deleted file mode 100644 index 6001733..0000000 --- a/.github/workflows/publish-immutable-actions.yml +++ /dev/null @@ -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 diff --git a/.github/workflows/release-new-action-version.yml b/.github/workflows/release-new-action-version.yml deleted file mode 100644 index 0b64c97..0000000 --- a/.github/workflows/release-new-action-version.yml +++ /dev/null @@ -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 }} diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 5fd1dab..628d543 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -127,3 +127,72 @@ jobs: path: test-cache - name: Verify cache run: __tests__/verify-cache-files.sh proxy test-cache + + # GCS integration tests + test-gcs-save: + runs-on: ubuntu-latest + if: github.event_name == 'workflow_dispatch' || github.event_name == 'push' + 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 files + run: __tests__/create-cache-files.sh gcs test-gcs-cache + - name: Save cache to GCS + uses: ./ + with: + key: test-gcs-${{ github.run_id }} + path: test-gcs-cache + gcs-bucket: ${{ env.GCS_BUCKET }} + + test-gcs-restore: + needs: test-gcs-save + runs-on: ubuntu-latest + if: github.event_name == 'workflow_dispatch' || github.event_name == 'push' + 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: Restore cache from GCS + uses: ./ + with: + key: test-gcs-${{ github.run_id }} + path: test-gcs-cache + gcs-bucket: ${{ env.GCS_BUCKET }} + - name: Verify GCS cache + run: __tests__/verify-cache-files.sh gcs test-gcs-cache + + test-gcs-fallback: + runs-on: ubuntu-latest + if: github.event_name == 'workflow_dispatch' || github.event_name == 'push' + env: + GCS_BUCKET: "non-existent-bucket-for-test" + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Generate files + run: __tests__/create-cache-files.sh fallback test-fallback-cache + - name: Save with GCS fallback + uses: ./ + with: + key: test-fallback-${{ github.run_id }} + path: test-fallback-cache + gcs-bucket: ${{ env.GCS_BUCKET }} + - name: Restore with GCS fallback + uses: ./ + with: + key: test-fallback-${{ github.run_id }} + path: test-fallback-cache + gcs-bucket: ${{ env.GCS_BUCKET }} + - name: Verify Fallback cache + run: __tests__/verify-cache-files.sh fallback test-fallback-cache