diff --git a/.github/workflows/build_binaries.yml b/.github/workflows/build_binaries.yml new file mode 100644 index 0000000..f9d7ce4 --- /dev/null +++ b/.github/workflows/build_binaries.yml @@ -0,0 +1,43 @@ +name: Build and Commit Binaries + +on: + push: + branches: [master] + +concurrency: + group: building + cancel-in-progress: true + +jobs: + + build: + # Prevents the workflow from running on non-human triggers. + if: github.actor != 'github-actions[bot]' + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Set Up Go Environment + uses: actions/setup-go@v5 + with: + go-version: '1.22.1' + + - name: Build embed_code.go for Windows + run: GOOS=windows GOARCH=amd64 go build -trimpath -o bin/embed-code-windows.exe main.go + + - name: Build embed_code.go for Ubuntu + run: GOOS=linux GOARCH=amd64 go build -trimpath -o bin/embed-code-linux main.go + + - name: Build embed_code.go for MacOS + run: GOOS=darwin GOARCH=amd64 go build -trimpath -o bin/embed-code-macos main.go + + - name: Commit Built Files + uses: EndBug/add-and-commit@v9 + with: + add: './bin' + message: 'Update binaries.' + default_author: github_actions + push: true diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..c40aa71 --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,27 @@ +name: Run Tests + +on: pull_request + +jobs: + build: + # Prevents the workflow from running on non-human triggers. + if: github.actor != 'github-actions[bot]' + runs-on: ${{ matrix.os }} + timeout-minutes: 10 + strategy: + matrix: + os: [windows-latest, macos-latest, ubuntu-latest] + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Set Up Go Environment + uses: actions/setup-go@v5 + with: + go-version: '1.22.1' + + - name: Run Tests + # Tests must be run sequentially because they create temporary files that can cause issues. + # Therefore, the "-p 1" argument is required. + run: go test -v ./... -p 1