Remove ani from Projects #28770
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@v4 | |
- name: Get cargo sort version | |
run: jq -r '"CARGO_SORT_VERSION=\(.defaults.build.config.CARGO_SORT_VERSION)"' dfx.json >> $GITHUB_ENV | |
- name: Get node version | |
run: jq -r '"NODE_VERSION=\(.defaults.build.config.NODE_VERSION)"' dfx.json >> $GITHUB_ENV | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Install shfmt | |
run: sudo snap install --classic shfmt | |
- name: Install yq | |
run: sudo snap install yq | |
- name: Install cargo dependency sorter | |
run: cargo install cargo-sort@${{ env.CARGO_SORT_VERSION }} | |
- name: Format | |
run: ./scripts/fmt | |
- name: Check formatted | |
run: | | |
test -z "$(git status --porcelain)" || { | |
echo "FIX: Please run ./scripts/fmt" | |
git diff | |
exit 1 | |
} | |
spelling: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install spellcheck | |
run: | | |
cd / | |
sudo apt-get update | |
sudo apt-get install -yy hunspell hunspell-en-gb hunspell-en-us clang libclang-dev | |
cargo install --locked --target x86_64-unknown-linux-gnu [email protected] | |
- name: Spellcheck Rust | |
run: cargo spellcheck --code 1 | |
- name: Spellcheck changelog | |
run: scripts/spellcheck-changelog | |
cargo-tests: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-20.04] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
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 Unit Tests | |
shell: bash | |
run: | | |
RUSTFLAGS="-D warnings" cargo test --lib --bins --benches --examples --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@v4 | |
- name: Get node version | |
run: jq -r '"NODE_VERSION=\(.defaults.build.config.NODE_VERSION)"' dfx.json >> $GITHUB_ENV | |
- uses: actions/setup-node@v4 | |
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@v4 | |
- name: Get node version | |
run: jq -r '"NODE_VERSION=\(.defaults.build.config.NODE_VERSION)"' dfx.json >> $GITHUB_ENV | |
- uses: actions/setup-node@v4 | |
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@v4 | |
- 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@v4 | |
- 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 for proposals | |
run: | | |
./scripts/update_ic_commit --crate proposals --ic_commit "$(jq -re .defaults.build.config.IC_COMMIT_FOR_PROPOSALS dfx.json)" | |
./scripts/proposals/did2rs | |
- name: Run the ic_commit code generator for sns_aggregator | |
run: | | |
./scripts/update_ic_commit --crate sns_aggregator --ic_commit "$(jq -re .defaults.build.config.IC_COMMIT_FOR_SNS_AGGREGATOR dfx.json)" | |
./scripts/sns/aggregator/mk_nns_patch.sh | |
- 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@v4 | |
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 | |
uses: dfinity/setup-dfx@main | |
- 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 | |
config-check: | |
name: Config is as expected | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dfx | |
uses: dfinity/setup-dfx@main | |
- name: Install cargo binstall | |
uses: ./.github/actions/install_binstall | |
- name: Install tools | |
run: | | |
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@v4 | |
- name: Test chunking | |
run: scripts/nns-dapp/split-assets.test | |
migration-test-utils-work: | |
name: Migration test utilities work | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install cargo binstall | |
uses: ./.github/actions/install_binstall | |
- name: Install idl2json | |
run: cargo binstall --no-confirm "idl2json_cli@$(jq -r .defaults.build.config.IDL2JSON_VERSION dfx.json)" && idl2json --version | |
- name: Test migration utilities | |
run: | | |
set +x | |
scripts/nns-dapp/migration-test.getters.test | |
scripts/nns-dapp/migration-test.on-exit.test | |
scripts/nns-dapp/migration-test.canister.test | |
dfx-nns-proposal-args-works: | |
# TODO: Re-enable (add it in line 338) once fixed, should it depend on mainnet? | |
if: false | |
name: Can get NNS proposal args | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- 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 cargo binstall | |
uses: ./.github/actions/install_binstall | |
- 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 | |
uses: dfinity/setup-dfx@main | |
- 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@v4 | |
- 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@v4 | |
- 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: Get node version | |
run: jq -r '"NODE_VERSION=\(.defaults.build.config.NODE_VERSION)"' dfx.json >> $GITHUB_ENV | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- 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: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04, macos-13] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install bash and sha256sum if on Mac | |
run: | | |
if command -v brew ; then | |
brew install bash | |
brew install coreutils | |
fi | |
- 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 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04, macos-13] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install bash if on Mac | |
run: | | |
if command -v brew ; then | |
brew install bash | |
fi | |
- run: scripts/canister_ids.test | |
release-sop: | |
name: Test release-sop script | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04, macos-13] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install bash if on Mac | |
run: | | |
if command -v brew ; then | |
brew install bash | |
fi | |
- run: scripts/nns-dapp/release-sop.test | |
split-changelog: | |
name: Test split-changelog script | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04, macos-13] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install bash if on Mac | |
run: | | |
if command -v brew ; then | |
brew install bash | |
fi | |
- run: scripts/nns-dapp/split-changelog.test | |
unused-i18n: | |
name: Find unused i18n messages | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- run: scripts/unused-i18n | |
version-match: | |
name: The nns-dapp npm and cargo versions should match | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Backend and frontend have the same version | |
run: | | |
backend_version="$(cargo metadata | jq -r '.packages[] | select(.name == "nns-dapp").version')" | |
frontend_version="$(jq -r .version frontend/package.json)" | |
[[ "${backend_version}" == "${frontend_version}" ]] || { | |
echo "ERROR: The nns-dapp frontend and backend should have the same version but:" | |
echo "Backend: $backend_version" | |
echo "Frontend: $frontend_version" | |
exit 1 | |
} >&2 | |
network-config: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install sponge | |
run: sudo apt-get update -yy && sudo apt-get install -yy moreutils && command -v sponge | |
- name: Getting network config works | |
run: scripts/network-config.test | |
checks-pass: | |
needs: | |
- formatting | |
- spelling | |
- cargo-tests | |
- svelte-lint | |
- svelte-tests | |
- shell-checks | |
- ic-commit-consistency | |
- release-templating-works | |
- config-check | |
- asset-chunking-works | |
- docker-build-cli-flags | |
- download-nns-dapp-ci-wasm | |
- canister-ids-tool | |
- release-sop | |
- split-changelog | |
- minor-version-bump-works | |
- version-match | |
- network-config | |
- migration-test-utils-work | |
if: ${{ always() }} | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/needs_success | |
with: | |
needs: '${{ toJson(needs) }}' |