console.log
go brrr
#706
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: CI | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
concurrency: | |
group: ci-${{ github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
needs: [lint, test] | |
strategy: | |
matrix: | |
environment: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.environment }} | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Speed up Go (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
DIR='D:\a\local' | |
mkdir -p "$DIR" && cd "$DIR" | |
mkdir go go-cache go-tmp tmpdir | |
go env -w GOPATH="$DIR\\go" | |
go env -w GOCACHE="$DIR\\go-cache" | |
go env -w GOTMPDIR="$DIR\\go-tmp" | |
printf '%s\\go\\bin\n' "$DIR" | tee -a "$GITHUB_PATH" | |
printf 'TMP=%s\\tmpdir\n' "$DIR" | tee -a "$GITHUB_ENV" | |
printf 'TEMP=%s\\tmpdir\n' "$DIR" | tee -a "$GITHUB_ENV" | |
go env | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: "^1.18.1" | |
- name: Build (Linux and macOS) | |
if: runner.os == 'Linux' || runner.os == 'macOS' | |
run: go build -o medusa -v . | |
- name: Compress (Linux and macOS) | |
if: runner.os == 'Linux' || runner.os == 'macOS' | |
run: tar -czvf medusa.tar.gz medusa | |
- name: Build (Windows) | |
if: runner.os == 'Windows' | |
run: go build -o medusa.exe -v . | |
- name: Compress (Windows) | |
if: runner.os == 'Windows' | |
run: tar -czvf medusa.tar.gz medusa.exe | |
- name: Upload artifact on merge to master | |
if: github.ref == 'refs/heads/master' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: medusa-${{ runner.os }} | |
path: medusa.tar.gz | |
lint: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: "^1.18.1" | |
- name: Actionlint | |
run: | | |
go install github.com/rhysd/actionlint/cmd/actionlint@latest | |
actionlint | |
- name: Prettier | |
run: | | |
npm install -g prettier | |
prettier --check '**.json' '**/*.md' '**/*.yml' '!(pkg)' | |
- name: Markdown link check | |
run: | | |
npm install -g markdown-link-check@3.10.3 | |
markdown-link-check --config .github/workflows/resources/markdown_link_check.json ./*.md | |
- name: Format | |
run: | | |
go fmt ./... | |
git diff --exit-code | |
- name: Lint | |
run: | | |
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest | |
golangci-lint run --timeout 5m0s | |
test: | |
strategy: | |
matrix: | |
environment: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.environment }} | |
timeout-minutes: 20 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Speed up Go, Python, Node (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
DIR='D:\a\local' | |
mkdir -p "$DIR" && cd "$DIR" | |
echo "::group::Go" | |
mkdir -p go go-cache go-tmp tmpdir | |
go env -w GOPATH="$DIR\\go" | |
go env -w GOCACHE="$DIR\\go-cache" | |
go env -w GOTMPDIR="$DIR\\go-tmp" | |
printf '%s\\go\\bin\n' "$DIR" | tee -a "$GITHUB_PATH" | |
printf 'TMP=%s\\tmpdir\n' "$DIR" | tee -a "$GITHUB_ENV" | |
printf 'TEMP=%s\\tmpdir\n' "$DIR" | tee -a "$GITHUB_ENV" | |
go env | |
echo "::endgroup::" | |
echo "::group::Python" | |
python3 -m venv venv | |
printf '%s\\venv\\Scripts\n' "$DIR" | tee -a "$GITHUB_PATH" | |
printf 'VIRTUAL_ENV=%s\\venv\n' "$DIR" | tee -a "$GITHUB_ENV" | |
echo "::endgroup::" | |
echo "::group::Node" | |
npm config set cache "$DIR\\npm-cache" --global | |
echo "::endgroup::" | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: "^1.18.1" | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18.15 | |
- name: Install Node dependencies | |
run: npm install hardhat | |
- name: Install Python dependencies | |
run: | | |
pip3 install --no-cache-dir solc-select crytic-compile | |
- name: Install solc | |
run: | | |
solc-select use 0.8.17 --always-install | |
- name: Test | |
run: go test ./... | |
all-checks: | |
needs: [lint, test, build] | |
runs-on: ubuntu-latest | |
steps: | |
- run: true |