File: action.yaml

package info (click to toggle)
cryfs 1.0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 28,404 kB
  • sloc: cpp: 150,188; asm: 10,493; python: 1,455; javascript: 65; sh: 50; makefile: 17; xml: 7
file content (82 lines) | stat: -rw-r--r-- 3,459 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: 'S3 Cache'
description: 'S3 Cache'
inputs:
  action:
    description: "`load` or `save` the cache"
    required: true
  paths:
    description: "Directory paths to cache"
    required: true
  cache_key:
    description: "Cache key"
    required: true
  secret_aws_access_key_id:
    description: "AWS access key ID"
    required: false
  secret_aws_secret_access_key:
    description: "AWS secret access key"
    required: false
runs:
  using: "composite"
  steps:
    - name: Zip cache files
      if: ${{ inputs.action == 'save' && github.event_name == 'push' }}
      shell: bash
      run: |
        set -e
        set -v
        mkdir -p "/tmp/s3_cache/${{inputs.cache_key}}"
        tar --zstd --create -Pp --same-owner --file "/tmp/s3_cache/${{inputs.cache_key}}/cache.tar.zstd" ${{ inputs.paths }}
        echo "Zipped cache:"
        ls -lh "/tmp/s3_cache/${{inputs.cache_key}}"
    - name: Store cache
      # note: this access key has write access to the cache. This can't run on PRs.
      if: ${{ inputs.action == 'save' && github.event_name == 'push' }}
      # Cache things sometimes indeterministically fail (roughly 1% of times this is run), let's not fail the job for it
      continue-on-error: true
      uses: leroy-merlin-br/action-s3-cache@7fad0a81b31884660211f24b62e29b4777a6ac4c # v1.0.6
      with:
        action: put
        aws-access-key-id: ${{ inputs.secret_aws_access_key_id }}
        aws-secret-access-key: ${{ inputs.secret_aws_secret_access_key }}
        aws-region: eu-west-1
        bucket: ci-cache.cryfs
        s3-class: ONEZONE_IA
        key: v2-${{ inputs.cache_key }}
        artifacts: "/tmp/s3_cache/${{inputs.cache_key}}"
    - name: Not saving cache on PRs
      if: ${{ inputs.action == 'save' && github.event_name != 'push' }}
      shell: bash
      run: |
        echo "Not saving cache because this is a PR"


    - name: Retrieve cache
      if: ${{ inputs.action == 'load' }}
      # Many jobs access the cache in parallel an we might observe an incomplete state that isn't valid. This would fail with a checksum error. Let's not fail the CI job but continue it, later on this job will upload a new new cache as part of the regular job run.
      continue-on-error: true
      # We're using an S3 based cache because the standard GitHub Action cache (actions/cache) only gives us 5GB of storage and we need more
      uses: leroy-merlin-br/action-s3-cache@7fad0a81b31884660211f24b62e29b4777a6ac4c # v1.0.6
      with:
        action: get
        # note: this access key has read-only access to the cache. It's public so it runs on PRs.
        aws-access-key-id: AKIAV5S2KH4F5OUZXV5E
        aws-secret-access-key: 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
        aws-region: eu-west-1
        bucket: ci-cache.cryfs
        key: v2-${{ inputs.cache_key }}
    - name: Unzip cache files
      if: ${{ inputs.action == 'load' }}
      # If the cache is corrupted, we still want to continue. Later, this job (if successful) will upload a new cache.
      continue-on-error: true
      shell: bash
      run: |
        set -e
        set -v
        if [ -f "/tmp/s3_cache/${{inputs.cache_key}}/cache.tar.zstd" ]; then
          echo "Zipped cache:"
          ls -lh "/tmp/s3_cache/${{inputs.cache_key}}"
          tar --extract --zstd -Pp --same-owner --file "/tmp/s3_cache/${{inputs.cache_key}}/cache.tar.zstd" ${{ inputs.paths }}
        else
          echo "Warning: Cache not found"
        fi