Skip to content

Readme

Readme #121

Workflow file for this run

# Copyright (c) The stash contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Test Action
on:
pull_request:
push:
branches:
- main
permissions:
contents: read
jobs:
test-deps:
name: "check for dependencies"
runs-on: ubuntu-latest
container: quay.io/centos/centos:stream8
steps:
- uses: actions/checkout@v4
- name: Run action
continue-on-error: true
id: fail
uses: ./restore
with:
path: .github
key: this-must-fail
- name: It did not fail
if: ${{ steps.fail.outputs.stash-hit != '' }}
run: |
echo "::error ::Dependency check should have failed!"
exit 1
test-save:
name: "stash/save on ${{ matrix.os }}"
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Run unittests
shell: bash
env:
GH_TOKEN: "${{ github.token }}"
run: |
cd restore
python3 test_get_stash.py
- name: Test Save
uses: ./save
with:
path: .github/
# Create a unique key to test intra workflow artifacts.
key: test/stash-${{ matrix.os }}-${{ github.sha }}
retention-days: '1'
- name: Show rate limit
env:
GH_TOKEN: "${{ github.token }}"
run: gh api -q '.rate' rate_limit
- name: Test Overwrite
id: test
uses: ./save
with:
path: .github/
# Create a unique key to test intra workflow artifacts.
key: test/stash-${{ matrix.os }}-${{ github.sha }}
retention-days: '1'
- name: Show rate limit
env:
GH_TOKEN: "${{ github.token }}"
run: gh api -q '.rate' rate_limit
- name: Check Output
shell: bash
env:
ID: ${{ steps.test.outputs.stash-id }}
URL: ${{ steps.test.outputs.stash-url }}
run: |
if [ -z "$ID" -o -z "$URL" ]; then
echo "Output empty"
exit 1
fi
- name: Check if inter-workflow stash exists
id: stash
uses: ./restore
with:
key: test-stash-cross-${{ matrix.os }}
path: test-stash
- name: Show rate limit
env:
GH_TOKEN: "${{ github.token }}"
run: gh api -q '.rate' rate_limit
- name: Save cross-workflow Stash
if: ${{ steps.stash.outputs.stash-hit == 'false' }}
uses: ./save
with:
path: .github/
key: test-stash-cross-${{ matrix.os }}
retention-days: '90'
test-restore:
name: "stash/restore on ${{ matrix.os }}"
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
needs: test-save
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Test intra-workflow stash
uses: ./restore
with:
key: test/stash-${{ matrix.os }}-${{ github.sha }}
path: intra/.github/
- shell: bash
run: ls -laR intra
- name: Test inter-workflow stash
uses: ./restore
with:
key: test-stash-cross-${{ matrix.os }}
path: inter/.github/
- shell: bash
run: ls -laR inter/