This repository has been archived by the owner on Oct 18, 2024. It is now read-only.
Update GitHub actions #283
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: Test | |
on: | |
push: | |
branches: | |
- develop | |
- main | |
tags-ignore: | |
- "**" | |
pull_request: | |
branches: | |
- develop | |
- main | |
# Cancel previous workflow run groups that have not completed. | |
concurrency: | |
# Group workflow runs by workflow name, along with the head branch ref of the pull request | |
# or otherwise the branch or tag ref. | |
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
go-test: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Install Latest Docker | |
run: | | |
sudo install -m 0755 -d /etc/apt/keyrings | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg | |
sudo chmod a+r /etc/apt/keyrings/docker.gpg | |
echo \ | |
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ | |
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ | |
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | |
sudo apt-get update | |
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.22" | |
- name: Setup a Browser | |
run: | | |
sudo apt-get install -y w3m | |
sudo update-alternatives --install /usr/bin/www-browser www-browser /usr/bin/w3m 500 | |
sudo update-alternatives --set www-browser /usr/bin/w3m | |
sudo update-alternatives --config www-browser | |
- name: Build test cli | |
run: | | |
go mod vendor | |
go build \ | |
-o ./build/kana \ | |
-ldflags "-s -w -X github.com/ChrisWiegman/kana/internal/cmd.Version=1.0.0 -X github.com/ChrisWiegman/kana/internal/cmd.Timestamp=2024-03-16_10:50:11PM" \ | |
./cmd/... | |
- name: Test | |
uses: robherley/go-test-action@v0.2.0 |