GIX-1890: Fix typo #20023
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Unit Tests | |
on: | |
push: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash -euxlo pipefail {0} | |
jobs: | |
formatting: | |
runs-on: ubuntu-20.04 | |
env: | |
DFX_NETWORK: mainnet | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Get node version | |
run: jq -r '"NODE_VERSION=\(.defaults.build.config.NODE_VERSION)"' dfx.json >> $GITHUB_ENV | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Install shfmt | |
run: sudo snap install --classic shfmt | |
- name: Install yq | |
run: sudo snap install yq | |
- name: Format | |
run: ./scripts/fmt | |
- name: Check formatted | |
run: | | |
test -z "$(git status --porcelain)" || { | |
echo "FIX: Please run ./scripts/fmt" | |
git diff | |
exit 1 | |
} | |
cargo-tests: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-20.04] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-1 | |
- name: Lint rust code | |
run: ./scripts/lint-rs | |
- name: Run Tests | |
shell: bash | |
run: | | |
cargo test --all-targets --all-features | |
env: | |
RUST_BACKTRACE: 1 | |
- name: Lint rustdoc | |
run: ./scripts/lint-rustdoc | |
svelte-tests: | |
runs-on: ubuntu-latest-m | |
defaults: | |
run: | |
shell: bash | |
env: | |
DFX_NETWORK: mainnet | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Get node version | |
run: jq -r '"NODE_VERSION=\(.defaults.build.config.NODE_VERSION)"' dfx.json >> $GITHUB_ENV | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Install dependencies | |
run: npm ci | |
working-directory: ./frontend | |
- name: Test | |
run: npm run test | |
working-directory: ./frontend | |
svelte-lint: | |
runs-on: ubuntu-20.04 | |
defaults: | |
run: | |
shell: bash | |
env: | |
DFX_NETWORK: mainnet | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Get node version | |
run: jq -r '"NODE_VERSION=\(.defaults.build.config.NODE_VERSION)"' dfx.json >> $GITHUB_ENV | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Install dependencies | |
run: npm ci | |
working-directory: ./frontend | |
- name: Run linter | |
run: npm run check | |
working-directory: ./frontend | |
shell-checks: | |
name: ShellCheck | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Run ShellCheck | |
run: | | |
sudo apt-get update | |
sudo apt-get install -yy shellcheck | |
./scripts/lint-sh | |
ic-commit-consistency: | |
name: IC Commit | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install didc | |
run: | | |
USER_BIN="$HOME/.local/bin" | |
mkdir -p "$USER_BIN" | |
echo "$USER_BIN" >> $GITHUB_PATH | |
version="$(jq -r .defaults.build.config.DIDC_VERSION dfx.json)" | |
# TODO: Make `didc` support `binstall`, then use `binstall` here. | |
curl -Lf "https://github.com/dfinity/candid/releases/download/${version}/didc-linux64" | install -m 755 /dev/stdin "$USER_BIN/didc" | |
- name: Check didc | |
run: command -v didc | |
- name: Run the ic_commit code generator | |
run: ./scripts/update_ic_commit --ic_commit "$(jq -re .defaults.build.config.IC_COMMIT dfx.json)" | |
- name: Verify that there are no code changes | |
run: | | |
if git diff | grep . ; then | |
echo "ERROR: The code is not consistent with the IC_COMMIT in dfx.json" | |
echo "Note: didc version: $(didc --version)" | |
exit 1 | |
fi | |
release-templating-works: | |
name: Release template | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install didc | |
run: | | |
USER_BIN="$HOME/.local/bin" | |
mkdir -p "$USER_BIN" | |
echo "$USER_BIN" >> $GITHUB_PATH | |
version="$(jq -r .defaults.build.config.DIDC_VERSION dfx.json)" | |
# TODO: Use `binstall`, once `didc` supports it. | |
curl -Lf "https://github.com/dfinity/candid/releases/download/${version}/didc-linux64" | install -m 755 /dev/stdin "$USER_BIN/didc" | |
- name: Check didc | |
run: command -v didc | |
- name: Install dfx | |
run: DFX_VERSION="$(jq -r .dfx dfx.json)" sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)" | |
- name: Verify template creation | |
run: | | |
echo Create a fake wasm | |
mkdir -p release/ci | |
touch release/ci/nns-dapp.wasm.gz | |
echo Create a proposal template | |
scripts/nns-dapp/release-template | |
echo Check the proposal | |
./scripts/nns-dapp/release-check | |
sns-aggregator-patches: | |
name: SNS aggregator patches | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install didc | |
run: | | |
USER_BIN="$HOME/.local/bin" | |
mkdir -p "$USER_BIN" | |
echo "$USER_BIN" >> $GITHUB_PATH | |
version="$(jq -r .defaults.build.config.DIDC_VERSION dfx.json)" | |
# TODO: Use `binstall`, once `didc` supports it. | |
curl -Lf "https://github.com/dfinity/candid/releases/download/${version}/didc-linux64" | install -m 755 /dev/stdin "$USER_BIN/didc" | |
- name: Check didc | |
run: command -v didc | |
- name: Recreate and compare patches | |
run: scripts/mk_nns_patch.test | |
config-check: | |
name: Config is as expected | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dfx | |
run: DFX_VERSION="$(jq -r .dfx dfx.json)" sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)" | |
- name: Install tools | |
run: | | |
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/181b5293e73cfe16f7a79c5b3a4339bd522d31f3/install-from-binstall-release.sh | bash | |
cargo binstall --no-confirm "idl2json_cli@$(jq -r .defaults.build.config.IDL2JSON_VERSION dfx.json)" | |
- name: Check mainnet config | |
run: bash -x config.test | |
asset-chunking-works: | |
name: Asset chunking works | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Test chunking | |
run: scripts/nns-dapp/split-assets.test | |
dfx-nns-proposal-args-works: | |
name: Can get NNS proposal args | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install didc | |
run: | | |
USER_BIN="$HOME/.local/bin" | |
mkdir -p "$USER_BIN" | |
echo "$USER_BIN" >> $GITHUB_PATH | |
version="$(jq -r .defaults.build.config.DIDC_VERSION dfx.json)" | |
# TODO: Make `didc` support `binstall`, then use `binstall` here. | |
curl -Lf "https://github.com/dfinity/candid/releases/download/${version}/didc-linux64" | install -m 755 /dev/stdin "$USER_BIN/didc" | |
- name: Install binstall | |
run: curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/181b5293e73cfe16f7a79c5b3a4339bd522d31f3/install-from-binstall-release.sh | bash && cargo binstall -V | |
- name: Install idl2json | |
run: cargo binstall --no-confirm "idl2json_cli@$(jq -r .defaults.build.config.IDL2JSON_VERSION dfx.json)" && idl2json --version | |
- name: Install sponge | |
run: sudo apt-get update -yy && sudo apt-get install -yy moreutils && command -v sponge | |
- name: Install dfx | |
run: DFX_VERSION="$(jq -r .dfx dfx.json)" sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)" | |
- name: Test getting proposal args | |
run: scripts/dfx-nns-proposal-args.test | |
docker-build-cli-flags: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: docker-build prints help | |
run: ./scripts/docker-build --help | grep -i usage | |
minor-version-bump-works: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install yq | |
run: sudo snap install yq | |
- name: Install sponge | |
run: sudo apt-get update -yy && sudo apt-get install -yy moreutils && command -v sponge | |
- name: Bumping the package versions works | |
run: ./scripts/nns-dapp/bump-patch.test | |
- name: Set git user | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GIX bot" | |
- name: Command creates commits | |
run: | | |
original_commit="$(git rev-parse HEAD)" | |
git checkout . | |
./scripts/nns-dapp/bump-patch --commit | |
num_commits="$(git log --oneline "$original_commit..HEAD" | wc -l)" | |
(( num_commits == 2 )) || { | |
echo "Expected two commits. Got:" | |
git log --oneline "$original_commit..HEAD" | |
exit 1 | |
} >&2 | |
# TODO: Verify that the commits contain the expected changes. | |
download-nns-dapp-ci-wasm: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download NNS-dapp CI wasm | |
run: | | |
MAIN_COMMIT="$(git ls-remote --refs https://github.com/dfinity/nns-dapp.git main | awk '{print $1}')" | |
scripts/nns-dapp/download-ci-wasm.test --commit "$MAIN_COMMIT" | |
env: | |
GH_TOKEN: ${{ github.token }} | |
canister-ids-tool: | |
name: Test canister_ids tool | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- run: scripts/canister_ids.test | |
release-sop: | |
name: Test release-sop script | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- run: scripts/nns-dapp/release-sop.test | |
split-changelog: | |
name: Test split-changelog script | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- run: scripts/nns-dapp/split-changelog.test | |
past-changelog: | |
name: Test that no new change log entries are added to past releases. | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- run: scripts/past-changelog-test | |
- run: scripts/past-changelog-test.test | |
checks-pass: | |
needs: ["formatting", "cargo-tests", "svelte-lint", "svelte-tests", "shell-checks", "ic-commit-consistency", "release-templating-works", "config-check", "sns-aggregator-patches", "asset-chunking-works", "dfx-nns-proposal-args-works", "docker-build-cli-flags", "download-nns-dapp-ci-wasm", "canister-ids-tool", "release-sop", "split-changelog", "past-changelog", "minor-version-bump-works"] | |
if: ${{ always() }} | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/needs_success | |
with: | |
needs: '${{ toJson(needs) }}' |