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
|
- name: Setup rust
|
||||||
run: |
|
run: |
|
||||||
cargo install sqlx-cli
|
cargo install sqlx-cli wasm-pack
|
||||||
cd backend
|
cd backend
|
||||||
sqlx database create --database-url sqlite://db.sqlite3
|
sqlx database create --database-url sqlite://db.sqlite3
|
||||||
sqlx migrate run --source sync_server/src/database/migrations --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
|
- name: Build wasm
|
||||||
run: |
|
run: |
|
||||||
cd backend
|
cd backend
|
||||||
cargo install wasm-pack
|
|
||||||
wasm-pack build --target web sync_lib
|
wasm-pack build --target web sync_lib
|
||||||
|
|
||||||
- name: Lint backend
|
- name: Lint backend
|
||||||
|
|
@ -57,7 +56,7 @@ jobs:
|
||||||
npm run lint
|
npm run lint
|
||||||
if [[ $(git status --porcelain) ]]; then
|
if [[ $(git status --porcelain) ]]; then
|
||||||
git status --porcelain
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
12
.github/workflows/e2e.yml
vendored
12
.github/workflows/e2e.yml
vendored
|
|
@ -39,7 +39,17 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
cd backend
|
cd backend
|
||||||
RUST_BACKTRACE=1 cargo run -p sync_server &
|
RUST_BACKTRACE=1 cargo run -p sync_server &
|
||||||
cd ../frontend
|
cd ..
|
||||||
|
|
||||||
|
scripts/update-api-types.sh
|
||||||
|
cd frontend
|
||||||
npm ci
|
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 ..
|
cd ..
|
||||||
scripts/e2e.sh 32
|
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
|
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:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
branches: ["master"]
|
||||||
- "*"
|
tags: ["*"]
|
||||||
|
pull_request:
|
||||||
|
branches: ["master"]
|
||||||
|
|
||||||
env:
|
env:
|
||||||
# Use docker.io for Docker Hub if empty
|
# Use docker.io for Docker Hub if empty
|
||||||
|
|
@ -24,7 +21,7 @@ jobs:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
# This is used to complete the identity challenge
|
# This is used to complete the identity challenge
|
||||||
# with sigstore/fulcio when running outside of PRs.
|
# with sigstore/fulcio.
|
||||||
id-token: write
|
id-token: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
@ -37,10 +34,10 @@ jobs:
|
||||||
echo "github.ref_type: ${{ github.ref_type }}"
|
echo "github.ref_type: ${{ github.ref_type }}"
|
||||||
echo "github.event_name: ${{ github.event_name }}"
|
echo "github.event_name: ${{ github.event_name }}"
|
||||||
|
|
||||||
# Install the cosign tool except on PR
|
# Install the cosign tool
|
||||||
# https://github.com/sigstore/cosign-installer
|
# https://github.com/sigstore/cosign-installer
|
||||||
- name: Install cosign
|
- name: Install cosign
|
||||||
if: github.event_name != 'pull_request'
|
if: github.ref_type == 'tag'
|
||||||
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0
|
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0
|
||||||
with:
|
with:
|
||||||
cosign-release: "v2.2.4"
|
cosign-release: "v2.2.4"
|
||||||
|
|
@ -51,10 +48,10 @@ jobs:
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
|
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
|
# https://github.com/docker/login-action
|
||||||
- name: Log into registry ${{ env.REGISTRY }}
|
- 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
|
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
|
||||||
with:
|
with:
|
||||||
registry: ${{ env.REGISTRY }}
|
registry: ${{ env.REGISTRY }}
|
||||||
|
|
@ -69,26 +66,26 @@ jobs:
|
||||||
with:
|
with:
|
||||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
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
|
# https://github.com/docker/build-push-action
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
id: build-and-push
|
id: build-and-push
|
||||||
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
|
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
|
||||||
with:
|
with:
|
||||||
context: backend
|
context: backend
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.ref_type == 'tag' }}
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
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
|
# 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
|
# repository is public to avoid leaking data. If you would like to publish
|
||||||
# transparency data even for private images, pass --force to cosign below.
|
# transparency data even for private images, pass --force to cosign below.
|
||||||
# https://github.com/sigstore/cosign
|
# https://github.com/sigstore/cosign
|
||||||
- name: Sign the published Docker image
|
- name: Sign the published Docker image
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
if: ${{ github.ref_type == 'tag' }}
|
||||||
env:
|
env:
|
||||||
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
|
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
|
||||||
TAGS: ${{ steps.meta.outputs.tags }}
|
TAGS: ${{ steps.meta.outputs.tags }}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue