Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
groups:
actions-minor:
update-types:
- minor
- patch

- package-ecosystem: npm
directory: /
schedule:
interval: weekly
ignore:
- dependency-name: '@types/node'
update-types:
- 'version-update:semver-major'
groups:
npm-development:
dependency-type: development
update-types:
- minor
- patch
npm-production:
dependency-type: production
update-types:
- patch
2 changes: 1 addition & 1 deletion .github/workflows/close-inactive-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v3
- uses: actions/stale@v9
with:
days-before-issue-stale: 200
days-before-issue-close: 5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
# Override language selection by uncommenting this and choosing your languages
# with:
# languages: go, javascript, csharp, python, cpp, java, ruby

# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below).
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Expand All @@ -43,4 +43,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
37 changes: 37 additions & 0 deletions .github/workflows/dependabot-dist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: dependabot-dist

on:
pull_request:
paths:
- '**.js'
- '**.ts'
- '**.json'

permissions:
contents: write
pull-requests: write
id-token: write

jobs:
build:
runs-on: ubuntu-latest
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'sparebank1utvikling/actions-cache-s3'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: 22.x
cache: npm
- run: npm ci
- name: Build
run: npm run build
- name: Commit and push dist/
run: |
git config --global user.name "dependabot[bot]"
git config --global user.email "dependabot[bot]@users.noreply.github.com"
git add dist/
git commit -m "dependabot dist" || echo "No changes to commit" && exit 0
git push

20 changes: 0 additions & 20 deletions .github/workflows/pr-opened-workflow.yml

This file was deleted.

178 changes: 116 additions & 62 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,34 @@ on:
pull_request:
branches:
- main
- releases/**
- '**'
push:
branches:
- main
- releases/**
- '**'

jobs:
# Build and unit test
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
os: [ubuntu-latest]
fail-fast: false
env:
AWS_ACCESS_KEY_ID: LSIAQAAAAAAVNCBMPNSG
AWS_SECRET_ACCESS_KEY: LSIAQAAAAAAVNCBMPNSG
AWS_REGION: us-east-1
AWS_ENDPOINT_URL: http://localhost:4566
AWS_S3_BUCKET: tmp-cache-bucket
runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js 16.x
uses: actions/setup-node@v3
uses: actions/checkout@v4
- name: Setup Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 22.x
cache: npm
- run: npm ci
- name: Prettier Format Check
Expand All @@ -34,16 +41,37 @@ jobs:
- name: Build & Test
run: npm run test


# End to end save and restore
test-save:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
os: [ubuntu-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
services:
localstack:
image: localstack/localstack:latest
env:
SERVICES: s3
AWS_ACCESS_KEY_ID: LSIAQAAAAAAVNCBMPNSG
AWS_SECRET_ACCESS_KEY: LSIAQAAAAAAVNCBMPNSG
ports:
- 4566:4566
- 4572:4572

steps:
- name: create bucket
env:
AWS_ACCESS_KEY_ID: LSIAQAAAAAAVNCBMPNSG
AWS_SECRET_ACCESS_KEY: LSIAQAAAAAAVNCBMPNSG
AWS_REGION: us-east-1
AWS_ENDPOINT_URL: http://localhost:4566
run: |
aws --no-cli-pager --endpoint-url=http://127.0.0.1:4566 s3api create-bucket --bucket tmp-cache-bucket

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Generate files in working directory
shell: bash
run: __tests__/create-cache-files.sh ${{ runner.os }} test-cache
Expand All @@ -52,78 +80,104 @@ jobs:
run: __tests__/create-cache-files.sh ${{ runner.os }} ~/test-cache
- name: Save cache
uses: ./

with:
key: test-${{ runner.os }}-${{ github.run_id }}
path: |
path: |-
test-cache
~/test-cache
aws-s3-bucket: tmp-cache-bucket
aws-endpoint: http://localhost:4566
aws-region: us-east-1
aws-access-key-id: LSIAQAAAAAAVNCBMPNSG
aws-secret-access-key: LSIAQAAAAAAVNCBMPNSG
aws-s3-bucket-endpoint: false
aws-s3-force-path-style: true

test-restore:
needs: test-save
services:
localstack:
image: localstack/localstack:latest
env:
SERVICES: s3
AWS_ACCESS_KEY_ID: LSIAQAAAAAAVNCBMPNSG
AWS_SECRET_ACCESS_KEY: LSIAQAAAAAAVNCBMPNSG
ports:
- 4566:4566

#needs: test-save # localstack is ephemeral to each job
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
os: [ubuntu-latest] #, macOS-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: create bucket
env:
AWS_ACCESS_KEY_ID: LSIAQAAAAAAVNCBMPNSG
AWS_SECRET_ACCESS_KEY: LSIAQAAAAAAVNCBMPNSG
AWS_REGION: us-east-1
AWS_ENDPOINT_URL: http://localhost:4566
run: |
__tests__/create-cache-files.sh ${{ runner.os }} test-cache
__tests__/create-cache-files.sh ${{ runner.os }} ~/test-cache
#tar -cvzf test-${{ runner.os }}-${{ github.run_id }} test-cache ~/test-cache
#echo "Content of current tar"
#tar -tvzf test-${{ runner.os }}-${{ github.run_id }}

echo "Content of ~/test-cache"
find ~/test-cache
echo "Content of $(pwd)/test-cache"
find $(pwd)/test-cache

echo "creating bucket and uploading cache tar"
aws --no-cli-pager --endpoint-url=http://127.0.0.1:4566 s3api create-bucket --bucket tmp-cache-bucket

- name: Save
uses: ./save
with:
key: test-${{ runner.os }}-${{ github.run_id }}
path: |-
test-cache
~/test-cache
aws-s3-bucket: tmp-cache-bucket
aws-endpoint: http://localhost:4566
aws-region: us-east-1
aws-access-key-id: LSIAQAAAAAAVNCBMPNSG
aws-secret-access-key: LSIAQAAAAAAVNCBMPNSG
aws-s3-bucket-endpoint: false
aws-s3-force-path-style: true

- name: Verify content of s3 cache and remove local files
env:
AWS_ACCESS_KEY_ID: LSIAQAAAAAAVNCBMPNSG
AWS_SECRET_ACCESS_KEY: LSIAQAAAAAAVNCBMPNSG
AWS_REGION: us-east-1
AWS_ENDPOINT_URL: http://localhost:4566
run: |
rm -r test-cache ~/test-cache
aws --no-cli-pager --endpoint-url=http://127.0.0.1:4566 s3 ls s3://tmp-cache-bucket

- name: Restore cache
uses: ./
uses: ./restore
with:
key: test-${{ runner.os }}-${{ github.run_id }}
path: |
path: |-
test-cache
~/test-cache
aws-s3-bucket: tmp-cache-bucket
aws-endpoint: http://localhost:4566
aws-region: us-east-1
aws-access-key-id: LSIAQAAAAAAVNCBMPNSG
aws-secret-access-key: LSIAQAAAAAAVNCBMPNSG
aws-s3-bucket-endpoint: false
aws-s3-force-path-style: true
- name: Verify cache files in working directory
shell: bash
run: __tests__/verify-cache-files.sh ${{ runner.os }} test-cache
- name: Verify cache files outside working directory
shell: bash
run: __tests__/verify-cache-files.sh ${{ runner.os }} ~/test-cache

# End to end with proxy
test-proxy-save:
runs-on: ubuntu-latest
container:
image: ubuntu:latest
options: --dns 127.0.0.1
services:
squid-proxy:
image: ubuntu/squid:latest
ports:
- 3128:3128
env:
https_proxy: http://squid-proxy:3128
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Generate files
run: __tests__/create-cache-files.sh proxy test-cache
- name: Save cache
uses: ./
with:
key: test-proxy-${{ github.run_id }}
path: test-cache
test-proxy-restore:
needs: test-proxy-save
runs-on: ubuntu-latest
container:
image: ubuntu:latest
options: --dns 127.0.0.1
services:
squid-proxy:
image: ubuntu/squid:latest
ports:
- 3128:3128
env:
https_proxy: http://squid-proxy:3128
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Restore cache
uses: ./
with:
key: test-proxy-${{ github.run_id }}
path: test-cache
- name: Verify cache
run: __tests__/verify-cache-files.sh proxy test-cache
Loading