Improve CI
This commit is contained in:
parent
792097060b
commit
84566c1b55
3 changed files with 26 additions and 20 deletions
5
.github/workflows/check.yml
vendored
5
.github/workflows/check.yml
vendored
|
|
@ -25,7 +25,7 @@ jobs:
|
|||
|
||||
- name: Setup rust
|
||||
run: |
|
||||
cargo install sqlx-cli
|
||||
cargo install sqlx-cli wasm-pack
|
||||
cd backend
|
||||
sqlx database create --database-url sqlite://db.sqlite3
|
||||
sqlx migrate run --source sync_server/src/database/migrations --database-url sqlite://db.sqlite3
|
||||
|
|
@ -33,7 +33,6 @@ jobs:
|
|||
- name: Build wasm
|
||||
run: |
|
||||
cd backend
|
||||
cargo install wasm-pack
|
||||
wasm-pack build --target web sync_lib
|
||||
|
||||
- name: Lint backend
|
||||
|
|
@ -57,7 +56,7 @@ jobs:
|
|||
npm run lint
|
||||
if [[ $(git status --porcelain) ]]; then
|
||||
git status --porcelain
|
||||
echo "Failing CI because the working directory is not clean after linting."
|
||||
echo "Failing CI because the working directory is not clean after linting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
|||
12
.github/workflows/e2e.yml
vendored
12
.github/workflows/e2e.yml
vendored
|
|
@ -39,7 +39,17 @@ jobs:
|
|||
run: |
|
||||
cd backend
|
||||
RUST_BACKTRACE=1 cargo run -p sync_server &
|
||||
cd ../frontend
|
||||
cd ..
|
||||
|
||||
scripts/update-api-types.sh
|
||||
cd frontend
|
||||
npm ci
|
||||
npm run lint
|
||||
if [[ $(git status --porcelain) ]]; then
|
||||
git status --porcelain
|
||||
echo "Failing CI because the working directory is not clean after updating the API types"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd ..
|
||||
scripts/e2e.sh 32
|
||||
|
|
|
|||
29
.github/workflows/publish-docker.yml
vendored
29
.github/workflows/publish-docker.yml
vendored
|
|
@ -1,14 +1,11 @@
|
|||
name: Publish server Docker image
|
||||
|
||||
# This workflow uses actions that are not certified by GitHub.
|
||||
# They are provided by a third-party and are governed by
|
||||
# separate terms of service, privacy policy, and support
|
||||
# documentation.
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "*"
|
||||
branches: ["master"]
|
||||
tags: ["*"]
|
||||
pull_request:
|
||||
branches: ["master"]
|
||||
|
||||
env:
|
||||
# Use docker.io for Docker Hub if empty
|
||||
|
|
@ -24,7 +21,7 @@ jobs:
|
|||
contents: read
|
||||
packages: write
|
||||
# This is used to complete the identity challenge
|
||||
# with sigstore/fulcio when running outside of PRs.
|
||||
# with sigstore/fulcio.
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
|
|
@ -37,10 +34,10 @@ jobs:
|
|||
echo "github.ref_type: ${{ github.ref_type }}"
|
||||
echo "github.event_name: ${{ github.event_name }}"
|
||||
|
||||
# Install the cosign tool except on PR
|
||||
# Install the cosign tool
|
||||
# https://github.com/sigstore/cosign-installer
|
||||
- name: Install cosign
|
||||
if: github.event_name != 'pull_request'
|
||||
if: github.ref_type == 'tag'
|
||||
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0
|
||||
with:
|
||||
cosign-release: "v2.2.4"
|
||||
|
|
@ -51,10 +48,10 @@ jobs:
|
|||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
|
||||
|
||||
# Login against a Docker registry except on PR
|
||||
# Login against a Docker registry
|
||||
# https://github.com/docker/login-action
|
||||
- name: Log into registry ${{ env.REGISTRY }}
|
||||
if: github.event_name != 'pull_request'
|
||||
if: github.ref_type == 'tag'
|
||||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
|
|
@ -69,26 +66,26 @@ jobs:
|
|||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
|
||||
# Build and push Docker image with Buildx (don't push on PR)
|
||||
# Build and push Docker image with Buildx
|
||||
# https://github.com/docker/build-push-action
|
||||
- name: Build and push Docker image
|
||||
id: build-and-push
|
||||
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
|
||||
with:
|
||||
context: backend
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
push: ${{ github.ref_type == 'tag' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
# Sign the resulting Docker image digest except on PRs.
|
||||
# Sign the resulting Docker image digest.
|
||||
# This will only write to the public Rekor transparency log when the Docker
|
||||
# repository is public to avoid leaking data. If you would like to publish
|
||||
# transparency data even for private images, pass --force to cosign below.
|
||||
# https://github.com/sigstore/cosign
|
||||
- name: Sign the published Docker image
|
||||
if: ${{ github.event_name != 'pull_request' }}
|
||||
if: ${{ github.ref_type == 'tag' }}
|
||||
env:
|
||||
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
|
||||
TAGS: ${{ steps.meta.outputs.tags }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue