Skip to content

Commit

Permalink
Update to latest master
Browse files Browse the repository at this point in the history
  • Loading branch information
beqaabu committed Oct 4, 2021
2 parents dd95f52 + 8e86572 commit 1f53996
Show file tree
Hide file tree
Showing 35 changed files with 5,976 additions and 1,683 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: "daily"
67 changes: 67 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: continuous-intergration/windows

on:
pull_request:
push:
branches:
- master
tags:
- v*
paths-ignore:
- 'README.md'

jobs:
check:
name: build-contract-template
strategy:
matrix:
platform:
- windows-latest
toolchain:
- nightly
runs-on: ${{ matrix.platform }}
env:
RUST_BACKTRACE: full
steps:

- uses: engineerd/configurator@v0.0.6
with:
name: "wasm-opt.exe"
url: "https://github.com/WebAssembly/binaryen/releases/download/version_101/binaryen-version_101-x86_64-windows.tar.gz"
pathInArchive: "binaryen-version_101/bin/wasm-opt.exe"

- name: Checkout sources & submodules
uses: actions/checkout@master
with:
fetch-depth: 1
submodules: recursive

- name: Install toolchain
id: toolchain
uses: actions-rs/toolchain@master
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
components: rust-src
override: true

- name: Rust Cache
uses: Swatinem/rust-cache@v1.2.0

- name: Build contract template on ${{ matrix.platform }}-${{ matrix.toolchain }}
run: |
wasm-opt --version
cargo -vV
cargo run -- contract --version
cargo run -- contract new foobar
echo "[workspace]" >> foobar/Cargo.toml
cargo run -- contract build --manifest-path=foobar/Cargo.toml
cargo run -- contract check --manifest-path=foobar/Cargo.toml
cargo run -- contract test --manifest-path=foobar/Cargo.toml
- name: Run tests on {{ matrix.platform }}-${{ matrix.toolchain }}
# The tests take a long time in the GitHub Actions runner (~30 mins),
# hence we run them only on `master`.
if: github.ref == 'refs/heads/master'
run: |
cargo test --verbose --workspace --all-features
75 changes: 54 additions & 21 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,18 @@ stages:

variables:
GIT_STRATEGY: fetch
GIT_DEPTH: 3
CARGO_HOME: "/ci-cache/${CI_PROJECT_NAME}/cargo/${CI_JOB_NAME}"
GIT_DEPTH: "100"
CARGO_HOME: "/ci-cache/${CI_PROJECT_NAME}/cargo/${CI_COMMIT_REF_NAME}/${CI_JOB_NAME}"
CARGO_TARGET_DIR: "/ci-cache/${CI_PROJECT_NAME}/targets/${CI_COMMIT_REF_NAME}/${CI_JOB_NAME}"
CI_SERVER_NAME: "GitLab CI"
REGISTRY: "paritytech"
RUSTUP_TOOLCHAIN: nightly
RUST_LIB_BACKTRACE: 0
RUST_LIB_BACKTRACE: "0"
# this var is changed to "-:staging" when the CI image gets rebuilt
# read more https://github.com/paritytech/cargo-contract/pull/115
CI_IMAGE: "paritytech/contracts-ci-linux:production"

workflow:
rules:
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH

.collect-artifacts: &collect-artifacts
artifacts:
Expand All @@ -29,28 +34,28 @@ variables:
- artifacts/

.docker-env: &docker-env
image: ${REGISTRY}/contracts-ci-linux:latest
image: "${CI_IMAGE}"
before_script:
- cargo -vV
- rustc -vV
- rustup show
- bash --version
- mkdir -p ${CARGO_HOME}; touch ${CARGO_HOME}/config
- mkdir -p ${CARGO_TARGET_DIR}
- ./scripts/pre_cache.sh
# global RUSTFLAGS overrides the linker args so this way is better to pass the flags
- printf '[build]\nrustflags = ["-C", "link-dead-code"]\n' | tee ${CARGO_HOME}/config
- printf '[build]\nrustflags = ["-C", "link-dead-code"]\n' > ${CARGO_HOME}/config
- sccache -s
- git show
only:
- master
- /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
- schedules
- web
- /^[0-9]+$/ # PRs
rules:
- if: $CI_PIPELINE_SOURCE == "web"
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_NAME == "master"
- if: $CI_COMMIT_REF_NAME == "tags"
- if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
dependencies: []
interruptible: true
retry:
max: 2
max: 2
when:
- runner_system_failure
- unknown_failure
Expand All @@ -68,23 +73,51 @@ fmt:
script:
- cargo fmt --verbose --all -- --check

clippy:
stage: check
<<: *docker-env
script:
- cargo clippy --verbose --all-targets --all-features -- -D warnings;

#### stage: test (all features)

test:
stage: test
<<: *docker-env
script:
- cargo test --verbose --all-features
- cargo test --verbose --workspace --all-features

test-new-project-template:
stage: test
<<: *docker-env
script:
- cargo run -- contract new new_project

# needed because otherwise:
# `error: current package believes it's in a workspace when it's not`
- echo "[workspace]" >> new_project/Cargo.toml

- cargo run --all-features -- contract build --manifest-path new_project/Cargo.toml
- cargo run --all-features -- contract check --manifest-path new_project/Cargo.toml
- cargo run --all-features -- contract test --manifest-path new_project/Cargo.toml
- cd new_project

- cargo check --verbose
- cargo test --verbose --all
- cargo fmt --verbose --all -- --check
- cargo clippy --verbose --manifest-path Cargo.toml -- -D warnings;

#### stage: build (default features)

build:
stage: build
<<: *docker-env
<<: *collect-artifacts
only:
- schedules
- master
rules:
- if: $CI_PIPELINE_SOURCE == "web"
- if: $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_REF_NAME == "master"
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1
script:
- cargo build --verbose --release
after_script:
Expand Down
103 changes: 103 additions & 0 deletions .images/cargo-contract.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .images/ink-squid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
license_template_path = "FILE_HEADER" # changed
report_todo = "Always"
report_fixme = "Always"
Loading

0 comments on commit 1f53996

Please sign in to comment.