Skip to content
Snippets Groups Projects
.gitlab-ci.yml 2.31 KiB
Newer Older
  • Learn to ignore specific revisions
  • image: hivesolutions/ubuntu_dev
    
    
    variables:
      NETLIFY_SITE_ID: chip-ahoyto
    
    João Magalhães's avatar
    João Magalhães committed
      NETLIFY_AUTH_TOKEN: $NETLIFY_AUTH_TOKEN
      CLOUDFLARE_API_TOKEN: $CLOUDFLARE_API_TOKEN
    
    stages:
      - build
    
    
    before_script:
    
    João Magalhães's avatar
    João Magalhães committed
      - apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -q pkg-config
    
      - curl -sf -L https://static.rust-lang.org/rustup.sh | sh -s -- -y
      - export PATH=$PATH:$HOME/.cargo/bin
    
    João Magalhães's avatar
    João Magalhães committed
      - curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
      - export NVM_DIR="$HOME/.nvm"
    
      - \[ -s "$NVM_DIR/nvm.sh" \] && \. "$NVM_DIR/nvm.sh"
      - \[ -s "$NVM_DIR/bash_completion" \] && \. "$NVM_DIR/bash_completion"
    
      - nvm install stable
    
    
    build-rust:
      stage: build
      parallel:
        matrix:
    
          - RUST_VERSION: ["1.56.1", "1.60.0", "stable", "nightly"]
    
      script:
        - rustup toolchain install $RUST_VERSION
        - rustup override set $RUST_VERSION
        - rustc --version
        - cargo build
        - cargo build --release
    
    
    build-wasm:
      stage: build
      parallel:
        matrix:
          - RUST_VERSION: ["1.60.0"]
      script:
        - rustup toolchain install $RUST_VERSION
        - rustup override set $RUST_VERSION
        - rustc --version
        - cargo install wasm-pack
        - wasm-pack build --release --target=web --out-dir=examples/web/lib -- --features wasm
    
        - cd examples/web && npm install && npm run build
    
      artifacts:
        paths:
    
          - examples/web/dist
    
        expire_in: 1 day
    
    
    deploy-netlify-preview:
      stage: deploy
      script:
    
        - cd examples/web/dist
    
        - npm_config_yes=true npx --package=netlify-cli netlify deploy --dir=.
    
      dependencies:
        - build-wasm
    
      only:
        - master
    
    deploy-netlify-prod:
      stage: deploy
      script:
    
        - cd examples/web/dist
    
        - npm_config_yes=true npx --package=netlify-cli netlify deploy --dir=. --prod
    
      dependencies:
        - build-wasm
    
    
    deploy-cloudfare-preview:
      stage: deploy
      script:
        - cd examples/web/dist
    
        - npm_config_yes=true npx wrangler pages publish . --project-name=chip-ahoyto --branch master
    
      dependencies:
        - build-wasm
    
    
    deploy-cloudfare-prod:
      stage: deploy
      script:
        - cd examples/web/dist
        - npm_config_yes=true npx wrangler pages publish . --project-name=chip-ahoyto --branch stable
      dependencies:
        - build-wasm
      only:
        - tags