Skip to content

Update dependency tsup to v8.1.2 #3131

Update dependency tsup to v8.1.2

Update dependency tsup to v8.1.2 #3131

Workflow file for this run

name: CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
env:
IMAGE_VERSION: ci-run-${{ github.run_id }}
# renovate: datasource=npm packageName=npm
NPM_VERSION: 10.8.2
jobs:
build-node:
name: Build / Node ${{ matrix.node }}
runs-on: ubuntu-latest
strategy:
matrix:
node: [ 18, 20, 21 ]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-node
name: Setup Node.js environment
with:
node-version: ${{ matrix.node }}
npm-version: ${{ env.NPM_VERSION }}
turbo-cache-key: build
- name: Run Build
run: npm run build
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-node
name: Setup Node.js environment
with:
node-version: 20
npm-version: ${{ env.NPM_VERSION }}
turbo-cache-key: lint
- name: Run Lint
run: npm run lint
build-docker:
name: Build / Docker / ${{ matrix.target }}
runs-on: ubuntu-latest
strategy:
matrix:
target: [ web, demo, database-migration ]
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build the Docker image
uses: docker/bake-action@v5.4.0
with:
files: ./docker-compose.yml
targets: ${{ matrix.target }}
set: |
${{ matrix.target }}.output=type=image,push=true
*.platform=linux/amd64,linux/arm64
*.cache-from=type=gha,scope=build-${{ matrix.target }}
*.cache-to=type=gha,scope=build-${{ matrix.target }},mode=max
test-compose:
name: Test / docker compose
runs-on: ubuntu-latest
needs: build-docker
steps:
- uses: actions/checkout@v4
- name: Pull images
run: docker compose pull
- run: docker images
- name: Start docker compose
run: docker compose up -d
- name: Wait 15s
run: sleep 15
- run: docker compose ps -a
- run: docker compose logs
- name: Verify docker containers are running
run: docker inspect --format "{{.ID}} {{.Name}} {{.State.Status}} {{.RestartCount}}" $(docker compose ps -aq) | node .github/actions/docker-compose-status.js
- name: Stop docker compose
run: docker compose down
test-kubernetes:
name: Test / kubernetes
runs-on: ubuntu-latest
needs: build-docker
steps:
- uses: actions/checkout@v4
- uses: nolar/setup-k3d-k3s@v1
with:
version: v1.26
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: build temporary kustomization.yaml
run: |
mkdir -p .temp
cat <<EOF > .temp/kustomization.yaml
resources:
- ../kubernetes/local
images:
- name: ghcr.io/gw2treasures/gw2.me/web
newTag: ${{ env.IMAGE_VERSION }}
- name: ghcr.io/gw2treasures/gw2.me/demo
newTag: ${{ env.IMAGE_VERSION }}
- name: ghcr.io/gw2treasures/gw2.me/database-migration
newTag: ${{ env.IMAGE_VERSION }}
EOF
- run: kubectl kustomize .temp
- run: kubectl apply -k .temp
- run: kubectl rollout status deployment web demo database -n gw2me --timeout=120s
- run: kubectl get deployment -n gw2me
if: success() || failure()
- run: kubectl get job -n gw2me
if: success() || failure()
- run: kubectl logs -l app.kubernetes.io/part-of=gw2me -n gw2me --all-containers --ignore-errors
if: failure() || runner.debug == '1'
test-unit:
name: Test / Unit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-node
name: Setup Node.js environment
with:
node-version: 20
npm-version: ${{ env.NPM_VERSION }}
turbo-cache-key: test
- name: Run Tests
run: npm run test
success:
name: Success
needs: [build-node, lint, test-compose, test-kubernetes, test-unit]
runs-on: ubuntu-latest
if: always()
steps:
- run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
- run: exit 0
publish-docker:
name: Publish / Docker / ${{ matrix.target }}
runs-on: ubuntu-latest
if: github.event_name == 'push'
needs: [success]
strategy:
matrix:
target: [ web, demo, database-migration ]
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Tag image version
run: |
IMAGE_ID=ghcr.io/${{ github.repository }}/${{ matrix.target }}
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "main" ] && VERSION=latest
CI_TAG=ci-run-${{ github.run_id }}
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker buildx imagetools create $IMAGE_ID:$CI_TAG --tag $IMAGE_ID:$VERSION
publish-npm:
name: Publish / npm / ${{ matrix.target }}
runs-on: ubuntu-latest
needs: [success]
permissions:
contents: read
id-token: write
pull-requests: write
strategy:
matrix:
target: [ client ]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-node
name: Setup Node.js environment
with:
node-version: 20
npm-version: ${{ env.NPM_VERSION }}
turbo-cache-key: publish
- name: Run Publish
run: npm run publish-package -- --filter=@gw2me/${{ matrix.target }} --env-mode=loose
id: publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true
GITHUB_EVENT_NAME: ${{ github.event_name }}
- name: Find Comment
if: github.event_name == 'pull_request'
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Publish / npm / ${{ matrix.target }}
- name: Delete comment if found but nothing will be published
if: github.event_name == 'pull_request' && steps.fc.outputs.comment-id && !steps.publish.outputs.publish
uses: actions/github-script@v7
with:
script: |
github.rest.issues.deleteComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: ${{ steps.fc.outputs.comment-id }}
})
- name: Add comment with packages to be published
if: github.event_name == 'pull_request' && steps.publish.outputs.publish
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
edit-mode: replace
body: |
**Publish / npm / ${{ matrix.target }}**
Merging this PR will publish the npm package `${{ steps.publish.outputs.publish }}`