Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #16 from actions/add-tests
Add tests
  • Loading branch information
Yoann Chaudet authored and GitHub committed Aug 19, 2022
2 parents 6a57e48 + 8ad8227 commit d3a918b
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/test-hosted-runners.yml
@@ -0,0 +1,52 @@
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:
- 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 files
run: mkdir artifact && mkdir artifact2 && cd artifact && ../script/new-artifact.sh
shell: bash

- name: Upload Pages artifact
uses: ./
with:
path: artifact

- name: Download artifact
uses: actions/download-artifact@v3
with:
name: github-pages
path: artifact2

- name: Extract artifact
run: tar -xf artifact2/artifact.tar -C artifact2 && rm artifact2/artifact.tar
shell: bash

- 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
10 changes: 10 additions & 0 deletions script/new-artifact.sh
@@ -0,0 +1,10 @@
#!/usr/bin/env 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

0 comments on commit d3a918b

Please sign in to comment.