Skip to content

Commit

Permalink
ci: use ghcr to ci env
Browse files Browse the repository at this point in the history
  • Loading branch information
zakuro9715 committed Sep 30, 2023
1 parent c483ee4 commit 1b7e471
Showing 1 changed file with 33 additions and 13 deletions.
46 changes: 33 additions & 13 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,46 @@ on:
pull_request:
branches: [ "main" ]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}-pr${{ github.event.pull_request.number }}

jobs:
# Run each jobs in container by use of shared Dockerfile
prepare-container:
runs-on: ubuntu-latest
steps:
- uses: docker/login-action@v3
with:
registry: ${{ env.CONTAINER_REGISTRY }
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v5
id: meta
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build:
needs: prepare-container
runs-on: ubuntu-latest
container:
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- run: |
git clone https://github.com/vlang/v /opt/v --depth 1
cd /opt/v
make
./v symlink
- run: make build
- run: make run args=-help
test:
runs-on: ubuntu-latest
container:
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- run: |
git clone https://github.com/vlang/v /opt/v --depth 1
cd /opt/v
make
./v symlink
- run: make test

0 comments on commit 1b7e471

Please sign in to comment.