-
Notifications
You must be signed in to change notification settings - Fork 6
142 lines (111 loc) · 4.78 KB
/
ci.yml
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}
env:
BUCKET_NAME: 'agoric-snapshots-public'
IMAGE_NAME: ${{ github.repository }}
REGISTRY: 'ghcr.io'
PROJECT_ID: 60745596728
jobs:
test-package:
runs-on: 'ubuntu-latest'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install deps
run: |
# Enable corepack for packageManager config
corepack enable || sudo corepack enable
yarn install
- name: Lint repo
run: yarn lint
- name: Typecheck synthetic-chain
run: yarn tsc
working-directory: packages/synthetic-chain
- name: Test synthetic-chain
run: yarn test
working-directory: packages/synthetic-chain
test-proposals:
permissions:
contents: read
id-token: write
packages: write
runs-on: 'depot-ubuntu-22.04-16'
steps:
- name: free up disk space
run: |
df -h
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
echo "=== After cleanup:"
df -h
- name: Generate Timestamp
run: echo "TIMESTAMP=$(date '+%s')" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Cloud SDK auth
uses: google-github-actions/auth@v2
with:
project_id: ${{ env.PROJECT_ID }}
workload_identity_provider: projects/${{ env.PROJECT_ID }}/locations/global/workloadIdentityPools/github/providers/${{ github.event.repository.name }}
- name: Set up gcloud
uses: google-github-actions/setup-gcloud@v2
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
password: ${{ secrets.GITHUB_TOKEN }}
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
- name: Install deps
run: |
corepack enable || sudo corepack enable
yarn install
- name: Build
run: yarn build
- name: Tests
run: yarn test
- name: Upload state to storage
run: |
#! /bin/bash
set -o errexit -o errtrace -o xtrace
IMAGE_ID="$(echo "${{ env.REGISTRY }}/${{ github.repository }}" | awk '{print tolower($0)}')"
TAG="use-fast-usdc-beta"
TIMESTAMP="$(date '+%s')"
if test -z "$(docker image ls --filter "reference=$IMAGE_ID:$TAG" --format json)"
then
echo "Pulling image $IMAGE_ID:$TAG"
docker pull --quiet "$IMAGE_ID:$TAG"
fi
CONTAINER_ID="$(docker container run --detach --entrypoint /bin/sleep "$IMAGE_ID:$TAG" infinity)"
docker exec "$CONTAINER_ID" /bin/bash -c "
set -o errexit
source \"/usr/src/upgrade-test-scripts/source.sh\"
set -o nounset
ls --almost-all \$HOME/.agoric | \
grep --extended-regexp --invert-match '^(config|data|keyring-test)$' | \
xargs -I {} rm --force --recursive \$HOME/.agoric/{}
echo \"Zipping data of size \$(du --human-readable --null --summarize \$HOME/.agoric/data | awk '{printf \"%s\", \$1}')\"
tar --create --file \"/tmp/data-$TIMESTAMP\" --directory \$HOME/.agoric --gzip data
echo \"Zipping config of size \$(du --human-readable --null --summarize \$HOME/.agoric/config | awk '{printf \"%s\", \$1}')\"
tar --create --file \"/tmp/config-$TIMESTAMP\" --directory \$HOME/.agoric --gzip config
echo \"Zipping keyring-test of size \$(du --human-readable --null --summarize \$HOME/.agoric/keyring-test | awk '{printf \"%s\", \$1}')\"
tar --create --file \"/tmp/keyring-test-$TIMESTAMP\" --directory \$HOME/.agoric --gzip keyring-test
"
docker container cp --quiet "$CONTAINER_ID:/tmp/data-$TIMESTAMP" "/tmp/data-$TIMESTAMP"
docker container cp --quiet "$CONTAINER_ID:/tmp/config-$TIMESTAMP" "/tmp/config-$TIMESTAMP"
docker container cp --quiet "$CONTAINER_ID:/tmp/keyring-test-$TIMESTAMP" "/tmp/keyring-test-$TIMESTAMP"
docker container stop "$CONTAINER_ID" > /dev/null
docker container rm "$CONTAINER_ID" > /dev/null
gsutil cp "/tmp/state-$TIMESTAMP" gs://${{ env.BUCKET_NAME }}/a3p/\$CHAIN_ID/data-$TIMESTAMP.tar.gz
gsutil cp "/tmp/state-$TIMESTAMP" gs://${{ env.BUCKET_NAME }}/a3p/\$CHAIN_ID/config-$TIMESTAMP.tar.gz
gsutil cp "/tmp/state-$TIMESTAMP" gs://${{ env.BUCKET_NAME }}/a3p/\$CHAIN_ID/keyring-test-$TIMESTAMP.tar.gz
timeout-minutes: 60
name: Proposal tests
on:
push:
branches: [usman/reset-emerynet]