-
Notifications
You must be signed in to change notification settings - Fork 14
124 lines (111 loc) · 4.49 KB
/
Copy pathrefresh-data.yaml
File metadata and controls
124 lines (111 loc) · 4.49 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: data-assets
on:
workflow_dispatch:
inputs:
mode:
description: Inspect upstream sources or rebuild an already-pinned release
required: true
type: choice
options: [refresh, rebuild]
data_version:
description: Explicit immutable data version (for example 2026.08)
required: true
type: string
build_timestamp:
description: Explicit ISO-8601 build timestamp
required: true
type: string
source_archive:
description: HTTPS URL or local path to a checksum-pinned source/reproducibility archive (rebuild only)
required: false
type: string
source_archive_sha256:
description: SHA256 of source_archive (rebuild only)
required: false
type: string
upload_artifacts:
description: Upload candidates after validation (disable only for local Act runs)
required: true
default: true
type: boolean
permissions:
contents: read
jobs:
data-assets:
runs-on: ubuntu-latest
env:
CENSUS_API_KEY: ${{ secrets.CENSUS_API_KEY }}
PIPELINE_DATA_VERSION: ${{ inputs.data_version }}
PIPELINE_PROPOSED_VERSION: ${{ inputs.data_version }}
PIPELINE_BUILD_TIMESTAMP: ${{ inputs.build_timestamp }}
PIPELINE_COMMIT: ${{ github.sha }}
PIPELINE_MODE: ${{ inputs.mode }}
PIPELINE_SOURCE_ARCHIVE: ${{ inputs.source_archive }}
PIPELINE_SOURCE_ARCHIVE_SHA256: ${{ inputs.source_archive_sha256 }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: r-lib/actions/setup-r@v2
with:
r-version: '4.6.1'
use-public-rspm: true
- name: Restore the pinned pipeline library
run: |
echo "762ec8acc2d2ccbe5a217859c846c2de83254e3948112b437dde7a0ad5b15999 data-raw/vendor/pak_0.11.1.tar.gz" | sha256sum --check
R CMD INSTALL data-raw/vendor/pak_0.11.1.tar.gz
Rscript -e 'pak::lockfile_install("data-raw/pkg.lock")'
- name: Inspect upstream source bytes
if: inputs.mode == 'refresh'
run: Rscript data-raw/refresh_sources.R
- name: Upload source-refresh proposal for human review
if: inputs.mode == 'refresh' && inputs.upload_artifacts
uses: actions/upload-artifact@v4
with:
name: source-refresh-${{ inputs.data_version }}
path: data-raw/refresh-candidate/${{ inputs.data_version }}/
if-no-files-found: error
- name: Restore checksum-pinned rebuild inputs
if: inputs.mode == 'rebuild'
run: Rscript data-raw/restore_rebuild_inputs.R
- name: Deterministic rebuild, pass one
if: inputs.mode == 'rebuild'
run: |
Rscript data-raw/run_pipeline.R
sha256sum \
data-raw/release/zipcodeR-data-${{ inputs.data_version }}.rds \
data-raw/release/manifest-${{ inputs.data_version }}.json \
data-raw/release/zipcodeR-reproducibility-${{ inputs.data_version }}.tar.gz \
> /tmp/first.sha256
- name: Deterministic rebuild, pass two
if: inputs.mode == 'rebuild'
run: |
Rscript data-raw/run_pipeline.R
sha256sum --check /tmp/first.sha256
- name: Standalone rebuild from the reproducibility archive
if: inputs.mode == 'rebuild'
run: |
standalone="$(mktemp -d)"
tar -xzf \
"data-raw/release/zipcodeR-reproducibility-${{ inputs.data_version }}.tar.gz" \
-C "$standalone"
(
cd "$standalone"
PIPELINE_WORKING_TREE_DIRTY=false Rscript data-raw/run_pipeline.R
)
cmp \
"data-raw/release/zipcodeR-data-${{ inputs.data_version }}.rds" \
"$standalone/data-raw/release/zipcodeR-data-${{ inputs.data_version }}.rds"
cmp \
"data-raw/release/manifest-${{ inputs.data_version }}.json" \
"$standalone/data-raw/release/manifest-${{ inputs.data_version }}.json"
cmp \
"data-raw/release/zipcodeR-reproducibility-${{ inputs.data_version }}.tar.gz" \
"$standalone/data-raw/release/zipcodeR-reproducibility-${{ inputs.data_version }}.tar.gz"
- name: Upload unpublished release candidates
if: inputs.mode == 'rebuild' && inputs.upload_artifacts
uses: actions/upload-artifact@v4
with:
name: zipcodeR-data-${{ inputs.data_version }}-unpublished
path: data-raw/release/
if-no-files-found: error