message: CI: split build-tests into separate job
diff: @@ -10,10 +10,8 @@ env:
  RUST_BACKTRACE: 1
  jobs:
  - test:
  - name: Test
  + build:
  runs-on: ubuntu-latest
  -
  steps:
  - uses: actions/checkout@master
  - id: install
  @@ -25,6 +23,36 @@ jobs:
  - name: restore build & cargo cache
  uses: Swatinem/rust-cache@v1
  + - name: Build
  + run: cargo build --workspace --locked
  +
  + - name: compile test binaries
  + run: |
  + cargo test --no-run
  + mkdir ./test-binaries/
  + find ./target \
  + -name "docs_rs*" \
  + -executable -type f \
  + -exec cp {} ./test-binaries/ \;
  +
  + - name: set up test binaries to cache
  + uses: actions/cache@v2
  + with:
  + path: "./test-binaries"
  + key: test-binaries-${{ github.sha }}
  +
  + test:
  + runs-on: ubuntu-latest
  + needs: build
  + steps:
  + - uses: actions/checkout@master
  +
  + - name: get test binaries from cache
  + uses: actions/cache@v2
  + with:
  + path: "./test-binaries"
  + key: test-binaries-${{ github.sha }}
  +
  - name: Launch postgres and min.io
  run: |
  cp .env.sample .env
  @@ -36,17 +64,50 @@ jobs:
  # Make sure the database is actually working
  psql "${CRATESFYI_DATABASE_URL}"
  - - name: Build
  - run: cargo build --workspace --locked
  + - name: run tests
  + shell: bash
  + run: |
  + for f in ./test-binaries/*; do
  + echo "running $f"
  + $f || exit 1
  + done
  - - name: fast tests
  - run: cargo test --workspace --locked
  + - name: Clean up the database
  + run: docker-compose down --volumes
  +
  + build_tests:
  + runs-on: ubuntu-latest
  + needs: build
  +
  + steps:
  + - uses: actions/checkout@master
  +
  + - name: get test binaries from cache
  + uses: actions/cache@v2
  + with:
  + path: "./test-binaries"
  + key: test-binaries-${{ github.sha }}
  +
  + - name: Launch postgres and min.io
  + run: |
  + cp .env.sample .env
  + . .env
  + mkdir -p ${CRATESFYI_PREFIX}/public-html
  + docker-compose up -d db s3
  + # Give the database enough time to start up
  + sleep 5
  + # Make sure the database is actually working
  + psql "${CRATESFYI_DATABASE_URL}"
  - name: slow tests
  env:
  DOCSRS_INCLUDE_DEFAULT_TARGETS: true
  DOCSRS_DOCKER_IMAGE: ghcr.io/rust-lang/crates-build-env/linux-micro
  - run: cargo test --workspace --locked -- --ignored
  + run: |
  + for f in ./test-binaries/*; do
  + echo "running $f"
  + $f --ignored || exit 1
  + done
  - name: Clean up the database
  run: docker-compose down --volumes
  