Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github-actions-toolkit/
17 changes: 17 additions & 0 deletions .github/actions/setup-toolkit/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Set up github-actions-toolkit
description: Checks out and builds the customised toolkit cache package that `@actions/cache` resolves to
runs:
using: composite
steps:
# Pinned to the source dist/ is built from: upstream @actions/cache 3.2.4 plus the local cache client
# (branch local-cache-3.2.4). Bump together with a dist/ rebuild.
- name: Checkout github-actions-toolkit
uses: actions/checkout@v5
with:
repository: finmid/github-actions-toolkit
ref: 21ead9f4ed28f51755898e27b39d5a3479f4046f
path: github-actions-toolkit
- name: Build the cache package
shell: bash
working-directory: github-actions-toolkit/packages/cache
run: npm ci && npm run tsc
34 changes: 30 additions & 4 deletions .github/workflows/check-dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,34 @@ on:
workflow_dispatch:

jobs:
call-check-dist:
check-dist:
name: Check dist/
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main
with:
node-version: "20.x"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup Node.js 24.x
uses: actions/setup-node@v5
with:
node-version: 24.x
cache: npm
- name: Set up github-actions-toolkit
uses: ./.github/actions/setup-toolkit
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Rebuild the dist directory
run: npm run build
- name: Compare the expected and actual dist directories
id: diff
run: |
if [ "$(git diff --ignore-space-at-eol dist | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after the build. See the status below:"
git diff
exit 1
fi
- name: Upload artifact
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
26 changes: 23 additions & 3 deletions .github/workflows/licensed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,26 @@ on:
workflow_dispatch:

jobs:
call-licensed:
name: Licensed
uses: actions/reusable-workflows/.github/workflows/licensed.yml@main
licensed:
name: Check licenses
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set up github-actions-toolkit
uses: ./.github/actions/setup-toolkit
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4'
- name: Install licensed tool
run: |
cd "$RUNNER_TEMP"
curl -Lfs -o licensed.tar.gz https://github.com/licensee/licensed/archive/refs/tags/v5.1.0.tar.gz
tar -xzf licensed.tar.gz
cd licensed-5.1.0
bundle install
- name: Check cached dependency records
run: BUNDLE_GEMFILE=$RUNNER_TEMP/licensed-5.1.0/Gemfile bundle exec $RUNNER_TEMP/licensed-5.1.0/exe/licensed status
91 changes: 21 additions & 70 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js 20.x
uses: actions/setup-node@v3
uses: actions/checkout@v5
- name: Setup Node.js 24.x
uses: actions/setup-node@v5
with:
node-version: 20.x
node-version: 24.x
cache: npm
- name: Set up github-actions-toolkit
uses: ./.github/actions/setup-toolkit
- run: npm ci
- name: Prettier Format Check
run: npm run format-check
Expand All @@ -34,96 +36,45 @@ 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]
fail-fast: false
runs-on: ${{ matrix.os }}
# End to end save and restore. The local cache backend stores archives under /cache on the runner,
# so saving and restoring has to happen on the same machine.
test-save-restore:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v5
- name: Prepare local cache directory
run: sudo mkdir -p /cache && sudo chmod 777 /cache
- name: Generate files in working directory
shell: bash
run: __tests__/create-cache-files.sh ${{ runner.os }} test-cache
- name: Generate files outside working directory
shell: bash
run: __tests__/create-cache-files.sh ${{ runner.os }} ~/test-cache
- name: Save cache
uses: ./
uses: ./save
with:
key: test-${{ runner.os }}-${{ github.run_id }}
path: |
test-cache
~/test-cache
test-restore:
needs: test-save
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Remove generated files
shell: bash
run: rm -rf test-cache ~/test-cache
- name: Restore cache
id: restore
uses: ./
with:
key: test-${{ runner.os }}-${{ github.run_id }}
path: |
test-cache
~/test-cache
- name: Verify cache hit
shell: bash
run: test "${{ steps.restore.outputs.cache-hit }}" = "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
2 changes: 1 addition & 1 deletion .licenses/npm/@actions/cache.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .licenses/npm/@actions/io-1.1.3.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions .licenses/npm/@azure/core-auth-1.4.0.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions .licenses/npm/@azure/core-http-3.0.2.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions .licenses/npm/@azure/core-lro-2.5.4.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions .licenses/npm/@azure/core-util-1.3.2.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading