Run integration test with GCS mock #123
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: optable-pair-cli CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
env: | |
GOPATH: ${{ github.workspace }} | |
jobs: | |
golangci-lint: | |
name: GolangCI Lint | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: v1.62.2 | |
pre-commit: | |
name: Pre-commit | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v3 | |
- name: Setup Pre-commit | |
run: pip install pre-commit | |
- name: Install pre-commit | |
run: pre-commit install | |
- name: Run all pre-commit hooks | |
run: SKIP=golangci-lint pre-commit run --all-files | |
build: | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: '${{ env.GOPATH }}/go.mod' | |
- name: Install dependencies | |
run: go get ./... | |
- name: Build | |
run: make build | |
- name: Start fake-gcs-server | |
run: | | |
docker run -d --name fake-gcs-server -p 4443:4443 fsouza/fake-gcs-server \ | |
-scheme http \ | |
-public-host 0.0.0.0:4443 | |
- name: Wait for fake-gcs-server to start | |
run: | | |
for i in {1..10}; do | |
if curl -s http://0.0.0.0:4443/storage/v1/; then | |
echo "fake-gcs-server is ready" | |
break | |
fi | |
echo "Waiting for fake-gcs-server..." | |
sleep 2 | |
done | |
- name: Run go tests | |
env: | |
STORAGE_EMULATOR_HOST: http://0.0.0.0:4443 | |
run: go test ./... | |
- name: Cleanup | |
if: always() | |
run: docker stop fake-gcs-server && docker rm fake-gcs-server |