Skip to content

Commit

Permalink
chore: add new workflow to download latest ic and test examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason I committed Apr 24, 2024
1 parent c4f9901 commit 6689860
Show file tree
Hide file tree
Showing 68 changed files with 170 additions and 17 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/check-interface-spec-compatibility.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# A GitHub Actions workflow that regularly installs the latest replica and builds/deploys all examples
name: Check Examples Compatibility with Latest IC SHA

on:
# TODO: remove `push` trigger; this is only for testing
push:
schedule:
# run the test suite every monday
- cron: '0 0 * * MON'

jobs:
build-and-deploy-examples-against-latest-ic-sha-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

# First, check if there is a newer version and update the artifacts referencing the version
- name: Check new ic version
id: update
run: |
# Not all ic commits are built and released, so we go through the last commits until we found one
# which has associated artefacts
while read -r sha
do
echo "sha: $sha"
# Send a HEAD to the URL to see if it exists
if curl --fail --head --silent --location \
"https://download.dfinity.systems/ic/$sha/binaries/x86_64-linux/replica.gz"
then
echo "$sha appears to have associated binary, using"
latest_sha="$sha"
break
else
echo "$sha does not seem to have associated binary"
fi
done < <(curl \
-SsL \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/dfinity/ic/commits | jq -cMr '.[] | .sha')
# If we couldn't find any sha with associated artefacts, abort
if [ -z "${latest_sha:-}" ]
then
echo no sha found
exit 1
fi
- name: Download latest ic artifacts
run: |
curl -O "https://download.dfinity.systems/ic/$latest_sha/binaries/x86_64-linux/replica.gz"
curl -O "https://download.dfinity.systems/ic/$latest_sha/binaries/x86_64-linux/canister_sandbox.gz"
curl -O "https://download.dfinity.systems/ic/$latest_sha/binaries/x86_64-linux/ic-admin.gz"
curl -O "https://download.dfinity.systems/ic/$latest_sha/binaries/x86_64-linux/ic-btc-adapter.gz"
curl -O "https://download.dfinity.systems/ic/$latest_sha/binaries/x86_64-linux/ic-https-outcalls-adapter.gz"
curl -O "https://download.dfinity.systems/ic/$latest_sha/binaries/x86_64-linux/ic-nns-init.gz"
curl -O "https://download.dfinity.systems/ic/$latest_sha/binaries/x86_64-linux/ic-starter.gz"
curl -O "https://download.dfinity.systems/ic/$latest_sha/binaries/x86_64-linux/sandbox_launcher.gz"
curl -O "https://download.dfinity.systems/ic/$latest_sha/binaries/x86_64-linux/sns.gz"
- name: Overwrite artifacts in dfx cache
run: |
gzip -d replica.gz
mv replica $(dfx cache show)
gzip -d canister_sandbox.gz
mv canister_sandbox $(dfx cache show)
gzip -d ic-admin.gz
mv ic-admin $(dfx cache show)
gzip -d ic-btc-adapter.gz
mv ic-btc-adapter $(dfx cache show)
gzip -d ic-https-outcalls-adapter.gz
mv ic-https-outcalls-adapter $(dfx cache show)
gzip -d ic-nns-init.gz
mv ic-nns-init $(dfx cache show)
gzip -d ic-starter.gz
mv ic-starter $(dfx cache show)
gzip -d sandbox_launcher.gz
mv sandbox_launcher $(dfx cache show)
gzip -d sns.gz
mv sns $(dfx cache show)
- name: Skip cache install
run: |
export "skip_dfx_cache_install=1"
- name: Build and deploy all examples
run: |
.github/workflows/hosting-photo-storage-example.test.sh
9 changes: 9 additions & 0 deletions .github/workflows/hosting-photo-storage-example.test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
pushd hosting/photo-storage
# verify frontend deps install and build
npm install
npm run build
# verify that frontend asset canister deploys
dfx start --background
dfx deploy
popd
20 changes: 4 additions & 16 deletions .github/workflows/hosting-photo-storage-example.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: hosting-photo-storage
on:
workflow_dispatch:
workflow_call:
push:
branches:
- master
Expand All @@ -21,14 +23,7 @@ jobs:
run: bash .github/workflows/provision-darwin.sh
- name: Hosting Photo Storage Darwin
run: |
pushd hosting/photo-storage
# verify frontend deps install and build
npm install
npm run build
# verify that frontend asset canister deploys
dfx start --background
dfx deploy
popd
.github/workflows/hosting-photo-storage-example.test.sh
hosting-photo-storage-linux:
runs-on: ubuntu-20.04
steps:
Expand All @@ -37,11 +32,4 @@ jobs:
run: bash .github/workflows/provision-linux.sh
- name: Hosting Photo Storage Linux
run: |
pushd hosting/photo-storage
# verify frontend deps install and build
npm install
npm run build
# verify that frontend asset canister deploys
dfx start --background
dfx deploy
popd
.github/workflows/hosting-photo-storage-example.test.sh
1 change: 1 addition & 0 deletions .github/workflows/hosting-static-website-example.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: hosting-static-website
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/hosting-unity-webgl-example.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: hosting-unity-webgl
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-actor_reference-example.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-actor-reference
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-basic-bitcoin.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-basic-bitcoin
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-basic-dao-example.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-basic-dao
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-calc-example.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-calc
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-cert_var-example.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-cert-var
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-classes-example.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-classes
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-composite-query-example.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-composite-query
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-counter-example.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-counter
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-defi-example.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-defi
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-dip721-example.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-dip721
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-echo-example.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-echo
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-encrypted-notes-example.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-encrypted-notes
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-encrypted-notes-vetkd-example.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-encrypted-notes-vetkd
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-factorial-example.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-factorial
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-hello-example.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-hello
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-hello-world-example.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-hello-world
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-hello_cycles-example.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-hello_cycles
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-http_counter-example.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-http_counter
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-icp-transfer-example.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Known failure: https://dfinity.atlassian.net/browse/EM-5
name: motoko-icp_transfer
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-icrc2-swap-example.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-icrc2-swap
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-internet-identity-integration
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-invoice-e2e.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Known failure: https://dfinity.atlassian.net/browse/EM-9
name: motoko-invoice-canister-e2e
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-invoice-unit.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-invoice-canister-unit
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-ios-notifications-example.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-ios-notifications
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-life-example.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-life
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-minimal-counter-dapp-example.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-minimal-counter-dapp
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-persistent-storage-example.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-persistent-storage
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-phone-book-example.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-phone-book
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-pub-sub-example.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-pub-sub
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-quicksort-example.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-quicksort
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-random_maze-example.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-random_maze
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-send-http-get-example.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-send-http-get-example
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-send-http-post-example.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-send-http-post-example
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-simple-to-do-example.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-simple-to-do
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/motoko-superheroes-example.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: motoko-superheroes
on:
workflow_dispatch:
push:
branches:
- master
Expand Down
Loading

0 comments on commit 6689860

Please sign in to comment.