Skip to content

Commit

Permalink
Remove custom CI cache and prefer Swatinem/rust-cache@v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Urgau authored and syphar committed Feb 14, 2024
1 parent f7a077a commit 3c81b53
Showing 1 changed file with 12 additions and 75 deletions.
87 changes: 12 additions & 75 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ jobs:
- name: Clean up the database
run: docker-compose down --volumes

build:
test:
env:
SQLX_OFFLINE: 1
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -80,39 +82,11 @@ jobs:
- name: restore build & cargo cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: "rust-cache-20231109"
prefix-key: "rust-cache-20240201"

- 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/ \;
- uses: actions/upload-artifact@v4
name: set up test binaries to cache
with:
name: test-binaries-${{ github.sha }}
path: ./test-binaries/
retention-days: 1

test:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4

- name: get test binaries from cache
uses: actions/download-artifact@v4
with:
name: test-binaries-${{ github.sha }}
path: ./test-binaries/

- name: Launch postgres and min.io
run: |
cp .env.sample .env
Expand All @@ -122,22 +96,22 @@ jobs:
sleep 5
# Make sure the database is actually working
psql "${DOCSRS_DATABASE_URL}"
- name: run workspace tests
run: |
cargo test --workspace --locked --no-fail-fast
- name: run tests
shell: bash
- name: run slow tests
env:
DOCSRS_INCLUDE_DEFAULT_TARGETS: false
run: |
for f in ./test-binaries/*; do
echo "running $f"
chmod +x $f # GH action artifacts don't handle permissions
$f || exit 1
done
cargo test --locked -- --test-threads=1
- name: Clean up the database
run: docker-compose down --volumes

GUI_test:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- id: install
Expand All @@ -164,43 +138,6 @@ jobs:
- name: Clean up the database
run: docker-compose down --volumes

build_tests:
runs-on: ubuntu-latest
needs: build

steps:
- uses: actions/checkout@v4

- name: get test binaries from cache
uses: actions/download-artifact@v4
with:
name: test-binaries-${{ github.sha }}
path: ./test-binaries/

- name: Launch postgres and min.io
run: |
cp .env.sample .env
mkdir -p ${DOCSRS_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 "${DOCSRS_DATABASE_URL}"
- name: slow tests
env:
DOCSRS_INCLUDE_DEFAULT_TARGETS: true
run: |
for f in ./test-binaries/*; do
echo "running $f"
chmod +x $f # GH action artifacts don't handle permissions
# run build-tests. Limited to one thread since we don't support parallel builds.
$f --ignored --test-threads=1 || exit 1
done
- name: Clean up the database
run: docker-compose down --volumes

fmt:
name: Rustfmt
runs-on: ubuntu-latest
Expand Down

0 comments on commit 3c81b53

Please sign in to comment.