From 6b3212610ff09d835bfde300f85c0f6bdec3ef79 Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Thu, 18 Aug 2022 16:33:31 -0700 Subject: [PATCH 1/8] Add tests --- .github/workflows/test.yml | 37 +++++++++++++++++++++++++++++++++++++ script/new-artifact.sh | 10 ++++++++++ 2 files changed, 47 insertions(+) create mode 100644 .github/workflows/test.yml create mode 100755 script/new-artifact.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..f75ea84 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,37 @@ +name: Run Tests + +on: + push: + branches: + - main + pull_request: + +jobs: + test: + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Generate artifacts + run: mkdir artifact && mkdir artifact2 && cd artifact && ../script/new-artifact.sh + shell: bash + + - name: Upload artifacts + uses: . + with: + path: artifact + + - name: Download artifacts + uses: actions/download-artifact@v3 + with: + name: github-pages + path: artifact2 + + - name: Compare artifacts + run: diff -qr artifact artifact2 + shell: bash diff --git a/script/new-artifact.sh b/script/new-artifact.sh new file mode 100755 index 0000000..f2614fd --- /dev/null +++ b/script/new-artifact.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# Create some files and directories in the current folder +echo 'hello' > hello.txt +mkdir subdir +echo 'world' > subdir/world.txt + +# Add some symlinks (which we should dereference properly when archiving) +ln -s subdir subdir-link +ln -s hello.txt bonjour.txt From 78f064a158b5dbfbf5b331103d5a2b3a3df74d96 Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Thu, 18 Aug 2022 16:36:57 -0700 Subject: [PATCH 2/8] Fix path --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f75ea84..df78a07 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,7 +22,7 @@ jobs: shell: bash - name: Upload artifacts - uses: . + uses: ./ with: path: artifact From ae9ee82aa699a1f7a27b59b4db70769b8d04ee1a Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Thu, 18 Aug 2022 16:41:23 -0700 Subject: [PATCH 3/8] Add extract --- .github/workflows/test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index df78a07..992f21a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,6 +32,10 @@ jobs: name: github-pages path: artifact2 + - name: Extract artifacts + run: tar --force-local -xf artifact2/artifact.tar -C artifact2 && rm artifact2/artifact.tar + shell: bash + - name: Compare artifacts run: diff -qr artifact artifact2 shell: bash From 2ab5cde5b296566f5949ba18c45c0435f0fffa09 Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Thu, 18 Aug 2022 16:42:34 -0700 Subject: [PATCH 4/8] Normalize --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 992f21a..62a7b9a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,7 +33,7 @@ jobs: path: artifact2 - name: Extract artifacts - run: tar --force-local -xf artifact2/artifact.tar -C artifact2 && rm artifact2/artifact.tar + run: tar -xf artifact2/artifact.tar -C artifact2 && rm artifact2/artifact.tar shell: bash - name: Compare artifacts From 888798aeba903df8e187d5e960d5818c930d78b4 Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Thu, 18 Aug 2022 16:49:51 -0700 Subject: [PATCH 5/8] Add symlink check --- .github/workflows/test.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 62a7b9a..0907a6c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,25 +17,29 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Generate artifacts + - name: Generate files run: mkdir artifact && mkdir artifact2 && cd artifact && ../script/new-artifact.sh shell: bash - - name: Upload artifacts + - name: Upload artifact uses: ./ with: path: artifact - - name: Download artifacts + - name: Download artifact uses: actions/download-artifact@v3 with: name: github-pages path: artifact2 - - name: Extract artifacts + - name: Extract artifact run: tar -xf artifact2/artifact.tar -C artifact2 && rm artifact2/artifact.tar shell: bash - - name: Compare artifacts + - name: Compare files run: diff -qr artifact artifact2 shell: bash + + - name: Check for absence of symlinks + run: if [ $(find artifact2 -type l | wc -l) != 0 ]; then echo "Symlinks found"; exit 1; fi + shell: bash From fc6db751bf3919b1a735ca7089ae1b9cf182957c Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Thu, 18 Aug 2022 17:43:49 -0700 Subject: [PATCH 6/8] doc --- .github/workflows/{test.yml => test-hosted-runners.yml} | 7 +++++++ 1 file changed, 7 insertions(+) rename .github/workflows/{test.yml => test-hosted-runners.yml} (82%) diff --git a/.github/workflows/test.yml b/.github/workflows/test-hosted-runners.yml similarity index 82% rename from .github/workflows/test.yml rename to .github/workflows/test-hosted-runners.yml index 0907a6c..3ec5af5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test-hosted-runners.yml @@ -1,5 +1,12 @@ name: Run Tests +# +# Create some files with script/new-artifact.sh and confirm they are properly packaged and uploaded +# as artifacts with the actions. +# +# This is tested on all OS platforms where we have hosted runners. +# + on: push: branches: From 2f3239288b815f38ab49573b017ce1d4f9289372 Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Fri, 19 Aug 2022 08:55:15 -0700 Subject: [PATCH 7/8] Update .github/workflows/test-hosted-runners.yml Co-authored-by: James M. Greene --- .github/workflows/test-hosted-runners.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-hosted-runners.yml b/.github/workflows/test-hosted-runners.yml index 3ec5af5..5b0dab9 100644 --- a/.github/workflows/test-hosted-runners.yml +++ b/.github/workflows/test-hosted-runners.yml @@ -28,7 +28,7 @@ jobs: run: mkdir artifact && mkdir artifact2 && cd artifact && ../script/new-artifact.sh shell: bash - - name: Upload artifact + - name: Upload Pages artifact uses: ./ with: path: artifact From 8ad82273b5c08c755b1df09656b740ccb51b4018 Mon Sep 17 00:00:00 2001 From: Yoann Chaudet Date: Fri, 19 Aug 2022 08:55:21 -0700 Subject: [PATCH 8/8] Update script/new-artifact.sh Co-authored-by: James M. Greene --- script/new-artifact.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/new-artifact.sh b/script/new-artifact.sh index f2614fd..136e632 100755 --- a/script/new-artifact.sh +++ b/script/new-artifact.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env sh # Create some files and directories in the current folder echo 'hello' > hello.txt