ci: strategy #28
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ⚗️Check | ||
on: | ||
push: | ||
env: | ||
GH_TOKEN: ${{ secrets.WRITE_PACKAGE }} | ||
jobs: | ||
# 共通処理 | ||
setup: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: set up | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ^1.20 | ||
id: go | ||
- name: check out | ||
uses: actions/checkout@v3 | ||
- name: Cache | ||
uses: actions/cache@main | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ matrix.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ matrix.os }}-go- | ||
build: | ||
needs: setup | ||
Check failure on line 33 in .github/workflows/check.yml GitHub Actions / ⚗️CheckInvalid workflow file
|
||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: build | ||
run: make build | ||
run: | ||
needs: setup | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: run | ||
run: | | ||
touch upload.zip | ||
docker-compose up -d | ||
sleep 3 | ||
make run | ||
test: | ||
needs: setup | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: test | ||
run: | | ||
docker-compose up -d | ||
sleep 3 | ||
make test | ||
# lint: | ||
# needs: setup | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - uses: actions/checkout@v3 | ||
# - name: golangci-lint | ||
# uses: golangci/golangci-lint-action@v3 | ||
# with: | ||
# args: --verbose | ||
# version: v1.54 | ||
image: | ||
needs: setup | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Get git tag(short) | ||
id: git-tag | ||
run: | | ||
GIT_TAG=$(git rev-parse --short HEAD) | ||
echo "::set-output name=git-tag::$GIT_TAG" | ||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@master | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.WRITE_PACKAGE }} | ||
- name: Cache Docker layers | ||
uses: actions/cache@v3 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Build image for release | ||
if: github.ref == 'refs/heads/main' | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
builder: ${{ steps.buildx.outputs.name }} | ||
target: release | ||
push: true | ||
tags: ghcr.io/kijimad/upl:${{ steps.git-tag.outputs.git-tag }},ghcr.io/kijimad/upl:latest | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new | ||
- name: Move cache | ||
if: github.ref == 'refs/heads/main' | ||
run: | | ||
rm -rf /tmp/.buildx-cache | ||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |