diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index ef1b48d3..fbad302f 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -8,8 +8,8 @@ env: go-version: "1.20" filename: 'main.yaml' jobs: - build: - name: Build + unit-test: + name: Unit Test runs-on: ubuntu-22.04 steps: - name: Checkout @@ -34,28 +34,13 @@ jobs: - name: Build binaries run: make build - - name: Check e2e - run: echo $RUN_E2E + - name: Run test run: make test - - name: Prepare for uploading sabakan binaries - run: | - mkdir /tmp/workspace - cp ./sabakan ./sabactl ./sabakan-cryptsetup /tmp/workspace - cp LICENSE /tmp/workspace - - - name: Upload sabakan binaries - uses: actions/upload-artifact@v3 - with: - name: sabakan-binaries - path: /tmp/workspace - retention-days: 1 - - build-image: - name: Build Images + e2e-test: + name: e2e Test runs-on: ubuntu-22.04 - needs: build steps: - name: Checkout uses: actions/checkout@v3 @@ -65,24 +50,18 @@ jobs: with: go-version: ${{ env.go-version }} - - name: Download sabakan binaries - uses: actions/download-artifact@v3 - with: - name: sabakan-binaries - path: ./docker + - name: Install test tools + run: make SUDO="sudo" test-tools - - name: Build sabakan image - run: docker build -t quay.io/cybozu/sabakan:latest ./docker + - name: Build binaries + run: make build - - name: Save Image - run: | - mkdir -p /tmp/docker - docker save quay.io/cybozu/sabakan:latest -o /tmp/docker/image + - name: Run test + run: make e2e mtest: name: Multi-host test runs-on: ubuntu-22.04 - needs: build steps: - name: Checkout uses: actions/checkout@v3 diff --git a/bin/run-mtest.sh b/bin/run-mtest.sh index 088ef5e9..31d26ca5 100755 --- a/bin/run-mtest.sh +++ b/bin/run-mtest.sh @@ -45,7 +45,7 @@ git checkout -qf ${GITHUB_SHA} cd mtest cp /assets/etcd-*.tar.gz . cp /assets/ubuntu-*.img . -make setup +sudo make setup make placemat sleep 3 exec make test TARGET="${TARGET}" diff --git a/e2e/main_test.go b/e2e/main_test.go index b660a63a..1524a2ee 100644 --- a/e2e/main_test.go +++ b/e2e/main_test.go @@ -21,12 +21,6 @@ const ( sabakanTLSKeyFile = "./certs/server.key.insecure" ) -var ci = false - -func init() { - ci = os.Getenv("CI") == "true" -} - func testMain(m *testing.M) (int, error) { stopEtcd := runEtcd() defer func() { @@ -78,11 +72,6 @@ func runEtcd() func() { } func TestMain(m *testing.M) { - if ci { - code := m.Run() - os.Exit(code) - } - if len(os.Getenv("RUN_E2E")) == 0 { os.Exit(0) } diff --git a/mtest/Makefile b/mtest/Makefile index c442b18b..dc1c83f4 100644 --- a/mtest/Makefile +++ b/mtest/Makefile @@ -184,3 +184,4 @@ clean: .PHONY: setup setup: go install github.com/onsi/ginkgo/v2/ginkgo + sudo make -C ../ setup-cfssl