Update repo
All checks were successful
Upload Artifact Example / build-and-upload (push) Successful in 8s
All checks were successful
Upload Artifact Example / build-and-upload (push) Successful in 8s
This commit is contained in:
@@ -1,53 +1,20 @@
|
|||||||
name: Passing Files In Artifacts
|
name: Upload Artifact Example
|
||||||
|
|
||||||
|
on: [push]
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
unit-tests:
|
build-and-upload:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout source code
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Install Python 3.10.12 # Setup Python inside the runner
|
- name: Create an artifact
|
||||||
uses: actions/setup-python@v4
|
run: echo "This is my artifact content." > my_artifact.txt
|
||||||
with:
|
|
||||||
python-version: '3.10.12'
|
|
||||||
|
|
||||||
- name: Install tox # Tool used for Python unit tests
|
|
||||||
run: pip install tox
|
|
||||||
- name: Run unit tests
|
|
||||||
run: |
|
|
||||||
cd backend
|
|
||||||
COVERAGE_FILE=.coverage tox -e unit
|
|
||||||
ls -la ${{ github.workspace }}/backend
|
|
||||||
stat ./.coverage
|
|
||||||
|
|
||||||
- name: Stage coverage into RUNNER_TEMP
|
|
||||||
run: |
|
|
||||||
echo "RUNNER_TEMP=${RUNNER_TEMP}"
|
|
||||||
mkdir -p "${RUNNER_TEMP}/cov"
|
|
||||||
cp "${{ github.workspace }}/backend/.coverage" "${RUNNER_TEMP}/cov/.coverage"
|
|
||||||
ls -la "${RUNNER_TEMP}/cov"
|
|
||||||
stat "${RUNNER_TEMP}/cov/.coverage"
|
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: coverage
|
name: my-build-artifact
|
||||||
path: ${RUNNER_TEMP}/cov/.coverage
|
path: my_artifact.txt
|
||||||
if-no-files-found: error
|
retention-days: 5 # Optional: Set the retention period for the artifact
|
||||||
|
|
||||||
load-file-example:
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
needs: [unit-tests]
|
|
||||||
steps:
|
|
||||||
- name: Download artifact
|
|
||||||
uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: coverage
|
|
||||||
path: ${{ github.workspace }} # Move the coverage to ${{ github.workspace }}
|
|
||||||
|
|
||||||
- name: List folder
|
|
||||||
run: ls -la ${{ github.workspace }}
|
|
||||||
Reference in New Issue
Block a user