postcss 0.0.2

🚀 Fast and 100% API compatible postcss replacer
Documentation
name: ci

on: [push, pull_request]

jobs:
  build:
    name: ${{ matrix.kind }} ${{ matrix.os }} ${{ matrix.rust }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: 
          - macOS-latest
          - ubuntu-latest
          - windows-latest
        rust:
          - stable
          # - beta
          # - nightly

    env:
      CARGO_INCREMENTAL: 0
      RUST_BACKTRACE: full
      CARGO_TERM_COLOR: always

    steps:
      - name: Clone repository
        uses: actions/checkout@v2

      - name: Install rust (${{ matrix.rust }}) toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{ matrix.rust }}
          profile: minimal
          override: true
          components: rustfmt, clippy

      - name: Log versions
        run: |
          rustc --version
          cargo --version

      - name: Configure cargo data directory
        # After this point, all cargo registry and crate data is stored in
        # $GITHUB_WORKSPACE/.cargo_home. This allows us to cache only the files
        # that are needed during the build process. Additionally, this works
        # around a bug in the 'cache' action that causes directories outside of
        # the workspace dir to be saved/restored incorrectly.
        run: |
          echo "CARGO_HOME=$(pwd)/.cargo_home" >> $GITHUB_ENV

      - name: Cache
        uses: actions/cache@v2
        with:
          # Note: crates from the denoland/deno git repo always get rebuilt,
          # and their outputs ('deno', 'libdeno.rlib' etc.) are quite big,
          # so we cache only those subdirectories of target/{debug|release} that
          # contain the build output for crates that come from the registry.
          path: |-
            .cargo_home
            target/*/.*
            target/*/build
            target/*/deps
          key:
            ${{ matrix.config.os }}-${{ matrix.config.rust }}-${{ hashFiles('Cargo.lock') }}
          restore-keys: |
            ${{ matrix.config.os }}-${{ matrix.config.rust }}

      - name: Run cargo fmt
        run: cargo fmt --all -- --check

      - name: Run cargo check
        run: cargo check --locked

      - name: Run cargo clippy
        # run: cargo clippy -- -D warnings
        run: cargo clippy --locked

      - name: Build release
        run: cargo build --release --locked

      - name: Run cargo test
        run: cargo test --locked

      - name: Pre-release (linux)
        if: startsWith(matrix.os, 'ubuntu') && matrix.rust == 'stable'
        run: |
          cd target/release
          strip postcss
          zip -r postcss-x86_64-unknown-linux-gnu.zip postcss
      - name: Pre-release (mac)
        if: startsWith(matrix.os, 'macOS') && matrix.rust == 'stable'
        run: |
          cd target/release
          strip postcss
          zip -r postcss-x86_64-apple-darwin.zip postcss
      - name: Pre-release (windows)
        if: startsWith(matrix.os, 'windows') && matrix.rust == 'stable'
        run: |
          Compress-Archive -CompressionLevel Optimal -Force -Path target/release/postcss.exe -DestinationPath target/release/postcss-x86_64-pc-windows-msvc.zip

      - name: Release
        uses: softprops/action-gh-release@v1
        if: |
          startsWith(github.repository, 'justjavac') &&
          startsWith(github.ref, 'refs/tags/') &&
          matrix.rust == 'stable'
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          files: |
            target/release/postcss-x86_64-pc-windows-msvc.zip
            target/release/postcss-x86_64-unknown-linux-gnu.zip
            target/release/postcss-x86_64-apple-darwin.zip
          draft: true

      # - name: Release postcss
      #   uses: justjavac/action-postcss-release@v1
      #   if: |
      #     startsWith(github.repository, 'justjavac') &&
      #     startsWith(github.ref, 'refs/tags/')
      #   env:
      #     GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
      #   with:
      #     files: |
      #       target/release/postcss-x86_64-pc-windows-msvc.zip
      #       target/release/postcss-x86_64-unknown-linux-gnu.zip
      #       target/release/postcss-x86_64-apple-darwin.zip
      
      - name: Publish
        if: |
          startsWith(matrix.os, 'ubuntu') &&
          matrix.rust == 'stable' &&
          startsWith(github.repository, 'justjavac') &&
          startsWith(github.ref, 'refs/tags/')
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
        run: |
          cargo publish